ab0057ae4c6c50e67f2cc895fdcb5ae8fb8e7055
[platform/upstream/python-lxml.git] / src / lxml / sax.c
1 /* Generated by Cython 0.29.18 */
2
3 /* BEGIN: Cython Metadata
4 {
5     "distutils": {
6         "define_macros": [
7             [
8                 "CYTHON_CLINE_IN_TRACEBACK",
9                 "0"
10             ]
11         ],
12         "extra_compile_args": [
13             "-w"
14         ],
15         "include_dirs": [
16             "/usr/include/libxml2",
17             "src",
18             "src/lxml/includes"
19         ],
20         "name": "lxml.sax",
21         "sources": [
22             "src/lxml/sax.py"
23         ]
24     },
25     "module_name": "lxml.sax"
26 }
27 END: Cython Metadata */
28
29 #define PY_SSIZE_T_CLEAN
30 #include "Python.h"
31 #ifndef Py_PYTHON_H
32     #error Python headers needed to compile C extensions, please install development version of Python.
33 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
34     #error Cython requires Python 2.6+ or Python 3.3+.
35 #else
36 #define CYTHON_ABI "0_29_18"
37 #define CYTHON_HEX_VERSION 0x001D12F0
38 #define CYTHON_FUTURE_DIVISION 0
39 #include <stddef.h>
40 #ifndef offsetof
41   #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
42 #endif
43 #if !defined(WIN32) && !defined(MS_WINDOWS)
44   #ifndef __stdcall
45     #define __stdcall
46   #endif
47   #ifndef __cdecl
48     #define __cdecl
49   #endif
50   #ifndef __fastcall
51     #define __fastcall
52   #endif
53 #endif
54 #ifndef DL_IMPORT
55   #define DL_IMPORT(t) t
56 #endif
57 #ifndef DL_EXPORT
58   #define DL_EXPORT(t) t
59 #endif
60 #define __PYX_COMMA ,
61 #ifndef HAVE_LONG_LONG
62   #if PY_VERSION_HEX >= 0x02070000
63     #define HAVE_LONG_LONG
64   #endif
65 #endif
66 #ifndef PY_LONG_LONG
67   #define PY_LONG_LONG LONG_LONG
68 #endif
69 #ifndef Py_HUGE_VAL
70   #define Py_HUGE_VAL HUGE_VAL
71 #endif
72 #ifdef PYPY_VERSION
73   #define CYTHON_COMPILING_IN_PYPY 1
74   #define CYTHON_COMPILING_IN_PYSTON 0
75   #define CYTHON_COMPILING_IN_CPYTHON 0
76   #undef CYTHON_USE_TYPE_SLOTS
77   #define CYTHON_USE_TYPE_SLOTS 0
78   #undef CYTHON_USE_PYTYPE_LOOKUP
79   #define CYTHON_USE_PYTYPE_LOOKUP 0
80   #if PY_VERSION_HEX < 0x03050000
81     #undef CYTHON_USE_ASYNC_SLOTS
82     #define CYTHON_USE_ASYNC_SLOTS 0
83   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
84     #define CYTHON_USE_ASYNC_SLOTS 1
85   #endif
86   #undef CYTHON_USE_PYLIST_INTERNALS
87   #define CYTHON_USE_PYLIST_INTERNALS 0
88   #undef CYTHON_USE_UNICODE_INTERNALS
89   #define CYTHON_USE_UNICODE_INTERNALS 0
90   #undef CYTHON_USE_UNICODE_WRITER
91   #define CYTHON_USE_UNICODE_WRITER 0
92   #undef CYTHON_USE_PYLONG_INTERNALS
93   #define CYTHON_USE_PYLONG_INTERNALS 0
94   #undef CYTHON_AVOID_BORROWED_REFS
95   #define CYTHON_AVOID_BORROWED_REFS 1
96   #undef CYTHON_ASSUME_SAFE_MACROS
97   #define CYTHON_ASSUME_SAFE_MACROS 0
98   #undef CYTHON_UNPACK_METHODS
99   #define CYTHON_UNPACK_METHODS 0
100   #undef CYTHON_FAST_THREAD_STATE
101   #define CYTHON_FAST_THREAD_STATE 0
102   #undef CYTHON_FAST_PYCALL
103   #define CYTHON_FAST_PYCALL 0
104   #undef CYTHON_PEP489_MULTI_PHASE_INIT
105   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
106   #undef CYTHON_USE_TP_FINALIZE
107   #define CYTHON_USE_TP_FINALIZE 0
108   #undef CYTHON_USE_DICT_VERSIONS
109   #define CYTHON_USE_DICT_VERSIONS 0
110   #undef CYTHON_USE_EXC_INFO_STACK
111   #define CYTHON_USE_EXC_INFO_STACK 0
112 #elif defined(PYSTON_VERSION)
113   #define CYTHON_COMPILING_IN_PYPY 0
114   #define CYTHON_COMPILING_IN_PYSTON 1
115   #define CYTHON_COMPILING_IN_CPYTHON 0
116   #ifndef CYTHON_USE_TYPE_SLOTS
117     #define CYTHON_USE_TYPE_SLOTS 1
118   #endif
119   #undef CYTHON_USE_PYTYPE_LOOKUP
120   #define CYTHON_USE_PYTYPE_LOOKUP 0
121   #undef CYTHON_USE_ASYNC_SLOTS
122   #define CYTHON_USE_ASYNC_SLOTS 0
123   #undef CYTHON_USE_PYLIST_INTERNALS
124   #define CYTHON_USE_PYLIST_INTERNALS 0
125   #ifndef CYTHON_USE_UNICODE_INTERNALS
126     #define CYTHON_USE_UNICODE_INTERNALS 1
127   #endif
128   #undef CYTHON_USE_UNICODE_WRITER
129   #define CYTHON_USE_UNICODE_WRITER 0
130   #undef CYTHON_USE_PYLONG_INTERNALS
131   #define CYTHON_USE_PYLONG_INTERNALS 0
132   #ifndef CYTHON_AVOID_BORROWED_REFS
133     #define CYTHON_AVOID_BORROWED_REFS 0
134   #endif
135   #ifndef CYTHON_ASSUME_SAFE_MACROS
136     #define CYTHON_ASSUME_SAFE_MACROS 1
137   #endif
138   #ifndef CYTHON_UNPACK_METHODS
139     #define CYTHON_UNPACK_METHODS 1
140   #endif
141   #undef CYTHON_FAST_THREAD_STATE
142   #define CYTHON_FAST_THREAD_STATE 0
143   #undef CYTHON_FAST_PYCALL
144   #define CYTHON_FAST_PYCALL 0
145   #undef CYTHON_PEP489_MULTI_PHASE_INIT
146   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
147   #undef CYTHON_USE_TP_FINALIZE
148   #define CYTHON_USE_TP_FINALIZE 0
149   #undef CYTHON_USE_DICT_VERSIONS
150   #define CYTHON_USE_DICT_VERSIONS 0
151   #undef CYTHON_USE_EXC_INFO_STACK
152   #define CYTHON_USE_EXC_INFO_STACK 0
153 #else
154   #define CYTHON_COMPILING_IN_PYPY 0
155   #define CYTHON_COMPILING_IN_PYSTON 0
156   #define CYTHON_COMPILING_IN_CPYTHON 1
157   #ifndef CYTHON_USE_TYPE_SLOTS
158     #define CYTHON_USE_TYPE_SLOTS 1
159   #endif
160   #if PY_VERSION_HEX < 0x02070000
161     #undef CYTHON_USE_PYTYPE_LOOKUP
162     #define CYTHON_USE_PYTYPE_LOOKUP 0
163   #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
164     #define CYTHON_USE_PYTYPE_LOOKUP 1
165   #endif
166   #if PY_MAJOR_VERSION < 3
167     #undef CYTHON_USE_ASYNC_SLOTS
168     #define CYTHON_USE_ASYNC_SLOTS 0
169   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
170     #define CYTHON_USE_ASYNC_SLOTS 1
171   #endif
172   #if PY_VERSION_HEX < 0x02070000
173     #undef CYTHON_USE_PYLONG_INTERNALS
174     #define CYTHON_USE_PYLONG_INTERNALS 0
175   #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
176     #define CYTHON_USE_PYLONG_INTERNALS 1
177   #endif
178   #ifndef CYTHON_USE_PYLIST_INTERNALS
179     #define CYTHON_USE_PYLIST_INTERNALS 1
180   #endif
181   #ifndef CYTHON_USE_UNICODE_INTERNALS
182     #define CYTHON_USE_UNICODE_INTERNALS 1
183   #endif
184   #if PY_VERSION_HEX < 0x030300F0
185     #undef CYTHON_USE_UNICODE_WRITER
186     #define CYTHON_USE_UNICODE_WRITER 0
187   #elif !defined(CYTHON_USE_UNICODE_WRITER)
188     #define CYTHON_USE_UNICODE_WRITER 1
189   #endif
190   #ifndef CYTHON_AVOID_BORROWED_REFS
191     #define CYTHON_AVOID_BORROWED_REFS 0
192   #endif
193   #ifndef CYTHON_ASSUME_SAFE_MACROS
194     #define CYTHON_ASSUME_SAFE_MACROS 1
195   #endif
196   #ifndef CYTHON_UNPACK_METHODS
197     #define CYTHON_UNPACK_METHODS 1
198   #endif
199   #ifndef CYTHON_FAST_THREAD_STATE
200     #define CYTHON_FAST_THREAD_STATE 1
201   #endif
202   #ifndef CYTHON_FAST_PYCALL
203     #define CYTHON_FAST_PYCALL 1
204   #endif
205   #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
206     #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
207   #endif
208   #ifndef CYTHON_USE_TP_FINALIZE
209     #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
210   #endif
211   #ifndef CYTHON_USE_DICT_VERSIONS
212     #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
213   #endif
214   #ifndef CYTHON_USE_EXC_INFO_STACK
215     #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
216   #endif
217 #endif
218 #if !defined(CYTHON_FAST_PYCCALL)
219 #define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
220 #endif
221 #if CYTHON_USE_PYLONG_INTERNALS
222   #include "longintrepr.h"
223   #undef SHIFT
224   #undef BASE
225   #undef MASK
226   #ifdef SIZEOF_VOID_P
227     enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
228   #endif
229 #endif
230 #ifndef __has_attribute
231   #define __has_attribute(x) 0
232 #endif
233 #ifndef __has_cpp_attribute
234   #define __has_cpp_attribute(x) 0
235 #endif
236 #ifndef CYTHON_RESTRICT
237   #if defined(__GNUC__)
238     #define CYTHON_RESTRICT __restrict__
239   #elif defined(_MSC_VER) && _MSC_VER >= 1400
240     #define CYTHON_RESTRICT __restrict
241   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
242     #define CYTHON_RESTRICT restrict
243   #else
244     #define CYTHON_RESTRICT
245   #endif
246 #endif
247 #ifndef CYTHON_UNUSED
248 # if defined(__GNUC__)
249 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
250 #     define CYTHON_UNUSED __attribute__ ((__unused__))
251 #   else
252 #     define CYTHON_UNUSED
253 #   endif
254 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
255 #   define CYTHON_UNUSED __attribute__ ((__unused__))
256 # else
257 #   define CYTHON_UNUSED
258 # endif
259 #endif
260 #ifndef CYTHON_MAYBE_UNUSED_VAR
261 #  if defined(__cplusplus)
262      template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
263 #  else
264 #    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
265 #  endif
266 #endif
267 #ifndef CYTHON_NCP_UNUSED
268 # if CYTHON_COMPILING_IN_CPYTHON
269 #  define CYTHON_NCP_UNUSED
270 # else
271 #  define CYTHON_NCP_UNUSED CYTHON_UNUSED
272 # endif
273 #endif
274 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
275 #ifdef _MSC_VER
276     #ifndef _MSC_STDINT_H_
277         #if _MSC_VER < 1300
278            typedef unsigned char     uint8_t;
279            typedef unsigned int      uint32_t;
280         #else
281            typedef unsigned __int8   uint8_t;
282            typedef unsigned __int32  uint32_t;
283         #endif
284     #endif
285 #else
286    #include <stdint.h>
287 #endif
288 #ifndef CYTHON_FALLTHROUGH
289   #if defined(__cplusplus) && __cplusplus >= 201103L
290     #if __has_cpp_attribute(fallthrough)
291       #define CYTHON_FALLTHROUGH [[fallthrough]]
292     #elif __has_cpp_attribute(clang::fallthrough)
293       #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
294     #elif __has_cpp_attribute(gnu::fallthrough)
295       #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
296     #endif
297   #endif
298   #ifndef CYTHON_FALLTHROUGH
299     #if __has_attribute(fallthrough)
300       #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
301     #else
302       #define CYTHON_FALLTHROUGH
303     #endif
304   #endif
305   #if defined(__clang__ ) && defined(__apple_build_version__)
306     #if __apple_build_version__ < 7000000
307       #undef  CYTHON_FALLTHROUGH
308       #define CYTHON_FALLTHROUGH
309     #endif
310   #endif
311 #endif
312
313 #ifndef CYTHON_INLINE
314   #if defined(__clang__)
315     #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
316   #elif defined(__GNUC__)
317     #define CYTHON_INLINE __inline__
318   #elif defined(_MSC_VER)
319     #define CYTHON_INLINE __inline
320   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
321     #define CYTHON_INLINE inline
322   #else
323     #define CYTHON_INLINE
324   #endif
325 #endif
326
327 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
328   #define Py_OptimizeFlag 0
329 #endif
330 #define __PYX_BUILD_PY_SSIZE_T "n"
331 #define CYTHON_FORMAT_SSIZE_T "z"
332 #if PY_MAJOR_VERSION < 3
333   #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
334   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
335           PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
336   #define __Pyx_DefaultClassType PyClass_Type
337 #else
338   #define __Pyx_BUILTIN_MODULE_NAME "builtins"
339 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
340   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
341           PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
342 #else
343   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
344           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
345 #endif
346   #define __Pyx_DefaultClassType PyType_Type
347 #endif
348 #ifndef Py_TPFLAGS_CHECKTYPES
349   #define Py_TPFLAGS_CHECKTYPES 0
350 #endif
351 #ifndef Py_TPFLAGS_HAVE_INDEX
352   #define Py_TPFLAGS_HAVE_INDEX 0
353 #endif
354 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
355   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
356 #endif
357 #ifndef Py_TPFLAGS_HAVE_FINALIZE
358   #define Py_TPFLAGS_HAVE_FINALIZE 0
359 #endif
360 #ifndef METH_STACKLESS
361   #define METH_STACKLESS 0
362 #endif
363 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
364   #ifndef METH_FASTCALL
365      #define METH_FASTCALL 0x80
366   #endif
367   typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
368   typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
369                                                           Py_ssize_t nargs, PyObject *kwnames);
370 #else
371   #define __Pyx_PyCFunctionFast _PyCFunctionFast
372   #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
373 #endif
374 #if CYTHON_FAST_PYCCALL
375 #define __Pyx_PyFastCFunction_Check(func)\
376     ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
377 #else
378 #define __Pyx_PyFastCFunction_Check(func) 0
379 #endif
380 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
381   #define PyObject_Malloc(s)   PyMem_Malloc(s)
382   #define PyObject_Free(p)     PyMem_Free(p)
383   #define PyObject_Realloc(p)  PyMem_Realloc(p)
384 #endif
385 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
386   #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
387   #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
388   #define PyMem_RawFree(p)             PyMem_Free(p)
389 #endif
390 #if CYTHON_COMPILING_IN_PYSTON
391   #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
392   #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
393 #else
394   #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
395   #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
396 #endif
397 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
398   #define __Pyx_PyThreadState_Current PyThreadState_GET()
399 #elif PY_VERSION_HEX >= 0x03060000
400   #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
401 #elif PY_VERSION_HEX >= 0x03000000
402   #define __Pyx_PyThreadState_Current PyThreadState_GET()
403 #else
404   #define __Pyx_PyThreadState_Current _PyThreadState_Current
405 #endif
406 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
407 #include "pythread.h"
408 #define Py_tss_NEEDS_INIT 0
409 typedef int Py_tss_t;
410 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
411   *key = PyThread_create_key();
412   return 0;
413 }
414 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
415   Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
416   *key = Py_tss_NEEDS_INIT;
417   return key;
418 }
419 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
420   PyObject_Free(key);
421 }
422 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
423   return *key != Py_tss_NEEDS_INIT;
424 }
425 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
426   PyThread_delete_key(*key);
427   *key = Py_tss_NEEDS_INIT;
428 }
429 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
430   return PyThread_set_key_value(*key, value);
431 }
432 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
433   return PyThread_get_key_value(*key);
434 }
435 #endif
436 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
437 #define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
438 #else
439 #define __Pyx_PyDict_NewPresized(n)  PyDict_New()
440 #endif
441 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
442   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
443   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
444 #else
445   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
446   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
447 #endif
448 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
449 #define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
450 #else
451 #define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
452 #endif
453 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
454   #define CYTHON_PEP393_ENABLED 1
455   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
456                                               0 : _PyUnicode_Ready((PyObject *)(op)))
457   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
458   #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
459   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
460   #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
461   #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
462   #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
463   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
464   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
465 #else
466   #define CYTHON_PEP393_ENABLED 0
467   #define PyUnicode_1BYTE_KIND  1
468   #define PyUnicode_2BYTE_KIND  2
469   #define PyUnicode_4BYTE_KIND  4
470   #define __Pyx_PyUnicode_READY(op)       (0)
471   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
472   #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
473   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
474   #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
475   #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
476   #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
477   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
478   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
479 #endif
480 #if CYTHON_COMPILING_IN_PYPY
481   #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
482   #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
483 #else
484   #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
485   #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
486       PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
487 #endif
488 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
489   #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
490 #endif
491 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
492   #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
493 #endif
494 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
495   #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
496 #endif
497 #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))
498 #define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
499 #if PY_MAJOR_VERSION >= 3
500   #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
501 #else
502   #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
503 #endif
504 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
505   #define PyObject_ASCII(o)            PyObject_Repr(o)
506 #endif
507 #if PY_MAJOR_VERSION >= 3
508   #define PyBaseString_Type            PyUnicode_Type
509   #define PyStringObject               PyUnicodeObject
510   #define PyString_Type                PyUnicode_Type
511   #define PyString_Check               PyUnicode_Check
512   #define PyString_CheckExact          PyUnicode_CheckExact
513 #ifndef PyObject_Unicode
514   #define PyObject_Unicode             PyObject_Str
515 #endif
516 #endif
517 #if PY_MAJOR_VERSION >= 3
518   #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
519   #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
520 #else
521   #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
522   #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
523 #endif
524 #ifndef PySet_CheckExact
525   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
526 #endif
527 #if CYTHON_ASSUME_SAFE_MACROS
528   #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
529 #else
530   #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
531 #endif
532 #if PY_MAJOR_VERSION >= 3
533   #define PyIntObject                  PyLongObject
534   #define PyInt_Type                   PyLong_Type
535   #define PyInt_Check(op)              PyLong_Check(op)
536   #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
537   #define PyInt_FromString             PyLong_FromString
538   #define PyInt_FromUnicode            PyLong_FromUnicode
539   #define PyInt_FromLong               PyLong_FromLong
540   #define PyInt_FromSize_t             PyLong_FromSize_t
541   #define PyInt_FromSsize_t            PyLong_FromSsize_t
542   #define PyInt_AsLong                 PyLong_AsLong
543   #define PyInt_AS_LONG                PyLong_AS_LONG
544   #define PyInt_AsSsize_t              PyLong_AsSsize_t
545   #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
546   #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
547   #define PyNumber_Int                 PyNumber_Long
548 #endif
549 #if PY_MAJOR_VERSION >= 3
550   #define PyBoolObject                 PyLongObject
551 #endif
552 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
553   #ifndef PyUnicode_InternFromString
554     #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
555   #endif
556 #endif
557 #if PY_VERSION_HEX < 0x030200A4
558   typedef long Py_hash_t;
559   #define __Pyx_PyInt_FromHash_t PyInt_FromLong
560   #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
561 #else
562   #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
563   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
564 #endif
565 #if PY_MAJOR_VERSION >= 3
566   #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
567 #else
568   #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
569 #endif
570 #if CYTHON_USE_ASYNC_SLOTS
571   #if PY_VERSION_HEX >= 0x030500B1
572     #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
573     #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
574   #else
575     #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
576   #endif
577 #else
578   #define __Pyx_PyType_AsAsync(obj) NULL
579 #endif
580 #ifndef __Pyx_PyAsyncMethodsStruct
581     typedef struct {
582         unaryfunc am_await;
583         unaryfunc am_aiter;
584         unaryfunc am_anext;
585     } __Pyx_PyAsyncMethodsStruct;
586 #endif
587
588 #if defined(WIN32) || defined(MS_WINDOWS)
589   #define _USE_MATH_DEFINESg
590 #endif
591 #include <math.h>
592 #ifdef NAN
593 #define __PYX_NAN() ((float) NAN)
594 #else
595 static CYTHON_INLINE float __PYX_NAN() {
596   float value;
597   memset(&value, 0xFF, sizeof(value));
598   return value;
599 }
600 #endif
601 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
602 #define __Pyx_truncl trunc
603 #else
604 #define __Pyx_truncl truncl
605 #endif
606
607 #define __PYX_MARK_ERR_POS(f_index, lineno) \
608     { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
609 #define __PYX_ERR(f_index, lineno, Ln_error) \
610     { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
611
612 #ifndef __PYX_EXTERN_C
613   #ifdef __cplusplus
614     #define __PYX_EXTERN_C extern "C"
615   #else
616     #define __PYX_EXTERN_C extern
617   #endif
618 #endif
619
620 #define __PYX_HAVE__lxml__sax
621 #define __PYX_HAVE_API__lxml__sax
622 /* Early includes */
623 #ifdef _OPENMP
624 #include <omp.h>
625 #endif /* _OPENMP */
626
627 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
628 #define CYTHON_WITHOUT_ASSERTIONS
629 #endif
630
631 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
632                 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
633
634 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
635 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
636 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
637 #define __PYX_DEFAULT_STRING_ENCODING ""
638 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
639 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
640 #define __Pyx_uchar_cast(c) ((unsigned char)c)
641 #define __Pyx_long_cast(x) ((long)x)
642 #define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
643     (sizeof(type) < sizeof(Py_ssize_t))  ||\
644     (sizeof(type) > sizeof(Py_ssize_t) &&\
645           likely(v < (type)PY_SSIZE_T_MAX ||\
646                  v == (type)PY_SSIZE_T_MAX)  &&\
647           (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
648                                 v == (type)PY_SSIZE_T_MIN)))  ||\
649     (sizeof(type) == sizeof(Py_ssize_t) &&\
650           (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
651                                v == (type)PY_SSIZE_T_MAX)))  )
652 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
653     return (size_t) i < (size_t) limit;
654 }
655 #if defined (__cplusplus) && __cplusplus >= 201103L
656     #include <cstdlib>
657     #define __Pyx_sst_abs(value) std::abs(value)
658 #elif SIZEOF_INT >= SIZEOF_SIZE_T
659     #define __Pyx_sst_abs(value) abs(value)
660 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
661     #define __Pyx_sst_abs(value) labs(value)
662 #elif defined (_MSC_VER)
663     #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
664 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
665     #define __Pyx_sst_abs(value) llabs(value)
666 #elif defined (__GNUC__)
667     #define __Pyx_sst_abs(value) __builtin_llabs(value)
668 #else
669     #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
670 #endif
671 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
672 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
673 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
674 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
675 #define __Pyx_PyBytes_FromString        PyBytes_FromString
676 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
677 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
678 #if PY_MAJOR_VERSION < 3
679     #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
680     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
681 #else
682     #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
683     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
684 #endif
685 #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
686 #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
687 #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
688 #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
689 #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
690 #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
691 #define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
692 #define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
693 #define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
694 #define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
695 #define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
696 #define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
697 #define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
698 #define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
699 #define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
700 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
701 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
702     const Py_UNICODE *u_end = u;
703     while (*u_end++) ;
704     return (size_t)(u_end - u - 1);
705 }
706 #define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
707 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
708 #define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
709 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
710 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
711 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
712 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
713 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
714 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
715 #define __Pyx_PySequence_Tuple(obj)\
716     (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
717 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
718 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
719 #if CYTHON_ASSUME_SAFE_MACROS
720 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
721 #else
722 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
723 #endif
724 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
725 #if PY_MAJOR_VERSION >= 3
726 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
727 #else
728 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
729 #endif
730 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
731 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
732 static int __Pyx_sys_getdefaultencoding_not_ascii;
733 static int __Pyx_init_sys_getdefaultencoding_params(void) {
734     PyObject* sys;
735     PyObject* default_encoding = NULL;
736     PyObject* ascii_chars_u = NULL;
737     PyObject* ascii_chars_b = NULL;
738     const char* default_encoding_c;
739     sys = PyImport_ImportModule("sys");
740     if (!sys) goto bad;
741     default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
742     Py_DECREF(sys);
743     if (!default_encoding) goto bad;
744     default_encoding_c = PyBytes_AsString(default_encoding);
745     if (!default_encoding_c) goto bad;
746     if (strcmp(default_encoding_c, "ascii") == 0) {
747         __Pyx_sys_getdefaultencoding_not_ascii = 0;
748     } else {
749         char ascii_chars[128];
750         int c;
751         for (c = 0; c < 128; c++) {
752             ascii_chars[c] = c;
753         }
754         __Pyx_sys_getdefaultencoding_not_ascii = 1;
755         ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
756         if (!ascii_chars_u) goto bad;
757         ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
758         if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
759             PyErr_Format(
760                 PyExc_ValueError,
761                 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
762                 default_encoding_c);
763             goto bad;
764         }
765         Py_DECREF(ascii_chars_u);
766         Py_DECREF(ascii_chars_b);
767     }
768     Py_DECREF(default_encoding);
769     return 0;
770 bad:
771     Py_XDECREF(default_encoding);
772     Py_XDECREF(ascii_chars_u);
773     Py_XDECREF(ascii_chars_b);
774     return -1;
775 }
776 #endif
777 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
778 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
779 #else
780 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
781 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
782 static char* __PYX_DEFAULT_STRING_ENCODING;
783 static int __Pyx_init_sys_getdefaultencoding_params(void) {
784     PyObject* sys;
785     PyObject* default_encoding = NULL;
786     char* default_encoding_c;
787     sys = PyImport_ImportModule("sys");
788     if (!sys) goto bad;
789     default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
790     Py_DECREF(sys);
791     if (!default_encoding) goto bad;
792     default_encoding_c = PyBytes_AsString(default_encoding);
793     if (!default_encoding_c) goto bad;
794     __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
795     if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
796     strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
797     Py_DECREF(default_encoding);
798     return 0;
799 bad:
800     Py_XDECREF(default_encoding);
801     return -1;
802 }
803 #endif
804 #endif
805
806
807 /* Test for GCC > 2.95 */
808 #if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
809   #define likely(x)   __builtin_expect(!!(x), 1)
810   #define unlikely(x) __builtin_expect(!!(x), 0)
811 #else /* !__GNUC__ or GCC < 2.95 */
812   #define likely(x)   (x)
813   #define unlikely(x) (x)
814 #endif /* __GNUC__ */
815 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
816
817 static PyObject *__pyx_m = NULL;
818 static PyObject *__pyx_d;
819 static PyObject *__pyx_b;
820 static PyObject *__pyx_cython_runtime = NULL;
821 static PyObject *__pyx_empty_tuple;
822 static PyObject *__pyx_empty_bytes;
823 static PyObject *__pyx_empty_unicode;
824 static int __pyx_lineno;
825 static int __pyx_clineno = 0;
826 static const char * __pyx_cfilenm= __FILE__;
827 static const char *__pyx_filename;
828
829
830 static const char *__pyx_f[] = {
831   "src/lxml/sax.py",
832   "stringsource",
833 };
834
835 /*--- Type declarations ---*/
836 struct __pyx_obj_4lxml_3sax_ElementTreeProducer;
837
838 /* "lxml/sax.pxd":7
839  * cdef tuple _getNsTag(tag)
840  * 
841  * cdef class ElementTreeProducer:             # <<<<<<<<<<<<<<
842  *     cdef _element
843  *     cdef _content_handler
844  */
845 struct __pyx_obj_4lxml_3sax_ElementTreeProducer {
846   PyObject_HEAD
847   struct __pyx_vtabstruct_4lxml_3sax_ElementTreeProducer *__pyx_vtab;
848   PyObject *_element;
849   PyObject *_content_handler;
850   PyObject *_attr_class;
851   PyObject *_empty_attributes;
852 };
853
854
855
856 /* "lxml/sax.py":159
857  * 
858  * 
859  * class ElementTreeProducer(object):             # <<<<<<<<<<<<<<
860  *     """Produces SAX events for an element and children.
861  *     """
862  */
863
864 struct __pyx_vtabstruct_4lxml_3sax_ElementTreeProducer {
865   PyObject *(*_recursive_saxify)(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *, PyObject *, PyObject *);
866   PyObject *(*_build_qname)(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *, PyObject *, PyObject *, PyObject *, PyObject *, int);
867 };
868 static struct __pyx_vtabstruct_4lxml_3sax_ElementTreeProducer *__pyx_vtabptr_4lxml_3sax_ElementTreeProducer;
869 static CYTHON_INLINE PyObject *__pyx_f_4lxml_3sax_19ElementTreeProducer__recursive_saxify(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *, PyObject *, PyObject *);
870 static CYTHON_INLINE PyObject *__pyx_f_4lxml_3sax_19ElementTreeProducer__build_qname(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *, PyObject *, PyObject *, PyObject *, PyObject *, int);
871
872 /* --- Runtime support code (head) --- */
873 /* Refnanny.proto */
874 #ifndef CYTHON_REFNANNY
875   #define CYTHON_REFNANNY 0
876 #endif
877 #if CYTHON_REFNANNY
878   typedef struct {
879     void (*INCREF)(void*, PyObject*, int);
880     void (*DECREF)(void*, PyObject*, int);
881     void (*GOTREF)(void*, PyObject*, int);
882     void (*GIVEREF)(void*, PyObject*, int);
883     void* (*SetupContext)(const char*, int, const char*);
884     void (*FinishContext)(void**);
885   } __Pyx_RefNannyAPIStruct;
886   static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
887   static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
888   #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
889 #ifdef WITH_THREAD
890   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
891           if (acquire_gil) {\
892               PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
893               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
894               PyGILState_Release(__pyx_gilstate_save);\
895           } else {\
896               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
897           }
898 #else
899   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
900           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
901 #endif
902   #define __Pyx_RefNannyFinishContext()\
903           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
904   #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
905   #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
906   #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
907   #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
908   #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
909   #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
910   #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
911   #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
912 #else
913   #define __Pyx_RefNannyDeclarations
914   #define __Pyx_RefNannySetupContext(name, acquire_gil)
915   #define __Pyx_RefNannyFinishContext()
916   #define __Pyx_INCREF(r) Py_INCREF(r)
917   #define __Pyx_DECREF(r) Py_DECREF(r)
918   #define __Pyx_GOTREF(r)
919   #define __Pyx_GIVEREF(r)
920   #define __Pyx_XINCREF(r) Py_XINCREF(r)
921   #define __Pyx_XDECREF(r) Py_XDECREF(r)
922   #define __Pyx_XGOTREF(r)
923   #define __Pyx_XGIVEREF(r)
924 #endif
925 #define __Pyx_XDECREF_SET(r, v) do {\
926         PyObject *tmp = (PyObject *) r;\
927         r = v; __Pyx_XDECREF(tmp);\
928     } while (0)
929 #define __Pyx_DECREF_SET(r, v) do {\
930         PyObject *tmp = (PyObject *) r;\
931         r = v; __Pyx_DECREF(tmp);\
932     } while (0)
933 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
934 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
935
936 /* PyObjectGetAttrStr.proto */
937 #if CYTHON_USE_TYPE_SLOTS
938 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
939 #else
940 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
941 #endif
942
943 /* GetBuiltinName.proto */
944 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
945
946 /* GetItemInt.proto */
947 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
948     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
949     __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
950     (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
951                __Pyx_GetItemInt_Generic(o, to_py_func(i))))
952 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
953     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
954     __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
955     (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
956 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
957                                                               int wraparound, int boundscheck);
958 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
959     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
960     __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
961     (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
962 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
963                                                               int wraparound, int boundscheck);
964 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
965 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
966                                                      int is_list, int wraparound, int boundscheck);
967
968 /* IncludeStringH.proto */
969 #include <string.h>
970
971 /* BytesEquals.proto */
972 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
973
974 /* UnicodeEquals.proto */
975 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
976
977 /* StrEquals.proto */
978 #if PY_MAJOR_VERSION >= 3
979 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
980 #else
981 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
982 #endif
983
984 /* SliceObject.proto */
985 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
986         PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
987         PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
988         int has_cstart, int has_cstop, int wraparound);
989
990 /* PyObjectCall.proto */
991 #if CYTHON_COMPILING_IN_CPYTHON
992 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
993 #else
994 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
995 #endif
996
997 /* RaiseDoubleKeywords.proto */
998 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
999
1000 /* ParseKeywords.proto */
1001 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1002     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1003     const char* function_name);
1004
1005 /* RaiseArgTupleInvalid.proto */
1006 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1007     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1008
1009 /* PyDictVersioning.proto */
1010 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1011 #define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
1012 #define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
1013 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1014     (version_var) = __PYX_GET_DICT_VERSION(dict);\
1015     (cache_var) = (value);
1016 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1017     static PY_UINT64_T __pyx_dict_version = 0;\
1018     static PyObject *__pyx_dict_cached_value = NULL;\
1019     if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1020         (VAR) = __pyx_dict_cached_value;\
1021     } else {\
1022         (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1023         __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1024     }\
1025 }
1026 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1027 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1028 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1029 #else
1030 #define __PYX_GET_DICT_VERSION(dict)  (0)
1031 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1032 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
1033 #endif
1034
1035 /* GetModuleGlobalName.proto */
1036 #if CYTHON_USE_DICT_VERSIONS
1037 #define __Pyx_GetModuleGlobalName(var, name)  {\
1038     static PY_UINT64_T __pyx_dict_version = 0;\
1039     static PyObject *__pyx_dict_cached_value = NULL;\
1040     (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1041         (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1042         __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1043 }
1044 #define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
1045     PY_UINT64_T __pyx_dict_version;\
1046     PyObject *__pyx_dict_cached_value;\
1047     (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1048 }
1049 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1050 #else
1051 #define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1052 #define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1053 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1054 #endif
1055
1056 /* PyCFunctionFastCall.proto */
1057 #if CYTHON_FAST_PYCCALL
1058 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1059 #else
1060 #define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
1061 #endif
1062
1063 /* PyFunctionFastCall.proto */
1064 #if CYTHON_FAST_PYCALL
1065 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1066     __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1067 #if 1 || PY_VERSION_HEX < 0x030600B1
1068 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1069 #else
1070 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1071 #endif
1072 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1073     (sizeof(char [1 - 2*!(cond)]) - 1)
1074 #ifndef Py_MEMBER_SIZE
1075 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1076 #endif
1077   static size_t __pyx_pyframe_localsplus_offset = 0;
1078   #include "frameobject.h"
1079   #define __Pxy_PyFrame_Initialize_Offsets()\
1080     ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1081      (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1082   #define __Pyx_PyFrame_GetLocalsplus(frame)\
1083     (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1084 #endif
1085
1086 /* PyObjectCall2Args.proto */
1087 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1088
1089 /* PyObjectCallMethO.proto */
1090 #if CYTHON_COMPILING_IN_CPYTHON
1091 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1092 #endif
1093
1094 /* PyObjectCallOneArg.proto */
1095 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1096
1097 /* PyObjectSetAttrStr.proto */
1098 #if CYTHON_USE_TYPE_SLOTS
1099 #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
1100 static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
1101 #else
1102 #define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
1103 #define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
1104 #endif
1105
1106 /* ListAppend.proto */
1107 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1108 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1109     PyListObject* L = (PyListObject*) list;
1110     Py_ssize_t len = Py_SIZE(list);
1111     if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
1112         Py_INCREF(x);
1113         PyList_SET_ITEM(list, len, x);
1114         Py_SIZE(list) = len+1;
1115         return 0;
1116     }
1117     return PyList_Append(list, x);
1118 }
1119 #else
1120 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1121 #endif
1122
1123 /* PyObjectGetMethod.proto */
1124 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
1125
1126 /* PyObjectCallMethod1.proto */
1127 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
1128
1129 /* append.proto */
1130 static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x);
1131
1132 /* ObjectGetItem.proto */
1133 #if CYTHON_USE_TYPE_SLOTS
1134 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1135 #else
1136 #define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
1137 #endif
1138
1139 /* GetTopmostException.proto */
1140 #if CYTHON_USE_EXC_INFO_STACK
1141 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1142 #endif
1143
1144 /* PyThreadStateGet.proto */
1145 #if CYTHON_FAST_THREAD_STATE
1146 #define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
1147 #define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
1148 #define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
1149 #else
1150 #define __Pyx_PyThreadState_declare
1151 #define __Pyx_PyThreadState_assign
1152 #define __Pyx_PyErr_Occurred()  PyErr_Occurred()
1153 #endif
1154
1155 /* SaveResetException.proto */
1156 #if CYTHON_FAST_THREAD_STATE
1157 #define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1158 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1159 #define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1160 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1161 #else
1162 #define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
1163 #define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
1164 #endif
1165
1166 /* PyErrExceptionMatches.proto */
1167 #if CYTHON_FAST_THREAD_STATE
1168 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1169 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1170 #else
1171 #define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
1172 #endif
1173
1174 /* GetException.proto */
1175 #if CYTHON_FAST_THREAD_STATE
1176 #define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
1177 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1178 #else
1179 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1180 #endif
1181
1182 /* PyObjectCallNoArg.proto */
1183 #if CYTHON_COMPILING_IN_CPYTHON
1184 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1185 #else
1186 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1187 #endif
1188
1189 /* PyObjectCallMethod0.proto */
1190 static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);
1191
1192 /* pop.proto */
1193 static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L);
1194 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1195 static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L);
1196 #define __Pyx_PyObject_Pop(L) (likely(PyList_CheckExact(L)) ?\
1197     __Pyx_PyList_Pop(L) : __Pyx__PyObject_Pop(L))
1198 #else
1199 #define __Pyx_PyList_Pop(L)  __Pyx__PyObject_Pop(L)
1200 #define __Pyx_PyObject_Pop(L)  __Pyx__PyObject_Pop(L)
1201 #endif
1202
1203 /* UnpackUnboundCMethod.proto */
1204 typedef struct {
1205     PyObject *type;
1206     PyObject **method_name;
1207     PyCFunction func;
1208     PyObject *method;
1209     int flag;
1210 } __Pyx_CachedCFunction;
1211
1212 /* CallUnboundCMethod0.proto */
1213 static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
1214 #if CYTHON_COMPILING_IN_CPYTHON
1215 #define __Pyx_CallUnboundCMethod0(cfunc, self)\
1216     (likely((cfunc)->func) ?\
1217         (likely((cfunc)->flag == METH_NOARGS) ?  (*((cfunc)->func))(self, NULL) :\
1218          (PY_VERSION_HEX >= 0x030600B1 && likely((cfunc)->flag == METH_FASTCALL) ?\
1219             (PY_VERSION_HEX >= 0x030700A0 ?\
1220                 (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0) :\
1221                 (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL)) :\
1222           (PY_VERSION_HEX >= 0x030700A0 && (cfunc)->flag == (METH_FASTCALL | METH_KEYWORDS) ?\
1223             (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL) :\
1224             (likely((cfunc)->flag == (METH_VARARGS | METH_KEYWORDS)) ?  ((*(PyCFunctionWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, __pyx_empty_tuple, NULL)) :\
1225                ((cfunc)->flag == METH_VARARGS ?  (*((cfunc)->func))(self, __pyx_empty_tuple) :\
1226                __Pyx__CallUnboundCMethod0(cfunc, self)))))) :\
1227         __Pyx__CallUnboundCMethod0(cfunc, self))
1228 #else
1229 #define __Pyx_CallUnboundCMethod0(cfunc, self)  __Pyx__CallUnboundCMethod0(cfunc, self)
1230 #endif
1231
1232 /* RaiseTooManyValuesToUnpack.proto */
1233 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1234
1235 /* RaiseNeedMoreValuesToUnpack.proto */
1236 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1237
1238 /* IterFinish.proto */
1239 static CYTHON_INLINE int __Pyx_IterFinish(void);
1240
1241 /* UnpackItemEndCheck.proto */
1242 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
1243
1244 /* GetAttr.proto */
1245 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1246
1247 /* HasAttr.proto */
1248 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
1249
1250 /* SliceObject.proto */
1251 #define __Pyx_PyObject_DelSlice(obj, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)\
1252     __Pyx_PyObject_SetSlice(obj, (PyObject*)NULL, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)
1253 static CYTHON_INLINE int __Pyx_PyObject_SetSlice(
1254         PyObject* obj, PyObject* value, Py_ssize_t cstart, Py_ssize_t cstop,
1255         PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
1256         int has_cstart, int has_cstop, int wraparound);
1257
1258 /* PyErrFetchRestore.proto */
1259 #if CYTHON_FAST_THREAD_STATE
1260 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1261 #define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1262 #define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1263 #define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1264 #define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1265 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1266 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1267 #if CYTHON_COMPILING_IN_CPYTHON
1268 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1269 #else
1270 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1271 #endif
1272 #else
1273 #define __Pyx_PyErr_Clear() PyErr_Clear()
1274 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1275 #define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
1276 #define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
1277 #define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
1278 #define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
1279 #define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
1280 #define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
1281 #endif
1282
1283 /* RaiseException.proto */
1284 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1285
1286 /* ListCompAppend.proto */
1287 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1288 static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
1289     PyListObject* L = (PyListObject*) list;
1290     Py_ssize_t len = Py_SIZE(list);
1291     if (likely(L->allocated > len)) {
1292         Py_INCREF(x);
1293         PyList_SET_ITEM(list, len, x);
1294         Py_SIZE(list) = len+1;
1295         return 0;
1296     }
1297     return PyList_Append(list, x);
1298 }
1299 #else
1300 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
1301 #endif
1302
1303 /* Import.proto */
1304 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1305
1306 /* ImportFrom.proto */
1307 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1308
1309 /* GetAttr3.proto */
1310 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
1311
1312 /* py_dict_items.proto */
1313 static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d);
1314
1315 /* dict_getitem_default.proto */
1316 static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value);
1317
1318 /* CallUnboundCMethod1.proto */
1319 static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
1320 #if CYTHON_COMPILING_IN_CPYTHON
1321 static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
1322 #else
1323 #define __Pyx_CallUnboundCMethod1(cfunc, self, arg)  __Pyx__CallUnboundCMethod1(cfunc, self, arg)
1324 #endif
1325
1326 /* CallUnboundCMethod2.proto */
1327 static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2);
1328 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1
1329 static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2);
1330 #else
1331 #define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2)  __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2)
1332 #endif
1333
1334 /* RaiseNoneIterError.proto */
1335 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1336
1337 /* PyObject_GenericGetAttrNoDict.proto */
1338 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1339 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1340 #else
1341 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1342 #endif
1343
1344 /* PyObject_GenericGetAttr.proto */
1345 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1346 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1347 #else
1348 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1349 #endif
1350
1351 /* SetVTable.proto */
1352 static int __Pyx_SetVtable(PyObject *dict, void *vtable);
1353
1354 /* PyObjectGetAttrStrNoError.proto */
1355 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1356
1357 /* SetupReduce.proto */
1358 static int __Pyx_setup_reduce(PyObject* type_obj);
1359
1360 /* CalculateMetaclass.proto */
1361 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);
1362
1363 /* Py3ClassCreate.proto */
1364 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
1365                                            PyObject *mkw, PyObject *modname, PyObject *doc);
1366 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
1367                                       PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);
1368
1369 /* FetchCommonType.proto */
1370 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
1371
1372 /* CythonFunctionShared.proto */
1373 #define __Pyx_CyFunction_USED 1
1374 #define __Pyx_CYFUNCTION_STATICMETHOD  0x01
1375 #define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
1376 #define __Pyx_CYFUNCTION_CCLASS        0x04
1377 #define __Pyx_CyFunction_GetClosure(f)\
1378     (((__pyx_CyFunctionObject *) (f))->func_closure)
1379 #define __Pyx_CyFunction_GetClassObj(f)\
1380     (((__pyx_CyFunctionObject *) (f))->func_classobj)
1381 #define __Pyx_CyFunction_Defaults(type, f)\
1382     ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
1383 #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
1384     ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
1385 typedef struct {
1386     PyCFunctionObject func;
1387 #if PY_VERSION_HEX < 0x030500A0
1388     PyObject *func_weakreflist;
1389 #endif
1390     PyObject *func_dict;
1391     PyObject *func_name;
1392     PyObject *func_qualname;
1393     PyObject *func_doc;
1394     PyObject *func_globals;
1395     PyObject *func_code;
1396     PyObject *func_closure;
1397     PyObject *func_classobj;
1398     void *defaults;
1399     int defaults_pyobjects;
1400     size_t defaults_size;  // used by FusedFunction for copying defaults
1401     int flags;
1402     PyObject *defaults_tuple;
1403     PyObject *defaults_kwdict;
1404     PyObject *(*defaults_getter)(PyObject *);
1405     PyObject *func_annotations;
1406 } __pyx_CyFunctionObject;
1407 static PyTypeObject *__pyx_CyFunctionType = 0;
1408 #define __Pyx_CyFunction_Check(obj)  (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
1409 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
1410                                       int flags, PyObject* qualname,
1411                                       PyObject *self,
1412                                       PyObject *module, PyObject *globals,
1413                                       PyObject* code);
1414 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
1415                                                          size_t size,
1416                                                          int pyobjects);
1417 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
1418                                                             PyObject *tuple);
1419 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
1420                                                              PyObject *dict);
1421 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
1422                                                               PyObject *dict);
1423 static int __pyx_CyFunction_init(void);
1424
1425 /* CythonFunction.proto */
1426 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
1427                                       int flags, PyObject* qualname,
1428                                       PyObject *closure,
1429                                       PyObject *module, PyObject *globals,
1430                                       PyObject* code);
1431
1432 /* SetNameInClass.proto */
1433 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
1434 #define __Pyx_SetNameInClass(ns, name, value)\
1435     (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
1436 #elif CYTHON_COMPILING_IN_CPYTHON
1437 #define __Pyx_SetNameInClass(ns, name, value)\
1438     (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value))
1439 #else
1440 #define __Pyx_SetNameInClass(ns, name, value)  PyObject_SetItem(ns, name, value)
1441 #endif
1442
1443 /* RegisterModuleCleanup.proto */
1444 static void __pyx_module_cleanup(PyObject *self);
1445 #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
1446 static int __Pyx_RegisterCleanup(void);
1447 #else
1448 #define __Pyx_RegisterCleanup() (0)
1449 #endif
1450
1451 /* CLineInTraceback.proto */
1452 #ifdef CYTHON_CLINE_IN_TRACEBACK
1453 #define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1454 #else
1455 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1456 #endif
1457
1458 /* CodeObjectCache.proto */
1459 typedef struct {
1460     PyCodeObject* code_object;
1461     int code_line;
1462 } __Pyx_CodeObjectCacheEntry;
1463 struct __Pyx_CodeObjectCache {
1464     int count;
1465     int max_count;
1466     __Pyx_CodeObjectCacheEntry* entries;
1467 };
1468 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1469 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1470 static PyCodeObject *__pyx_find_code_object(int code_line);
1471 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1472
1473 /* AddTraceback.proto */
1474 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1475                                int py_line, const char *filename);
1476
1477 /* CIntToPy.proto */
1478 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1479
1480 /* CIntFromPy.proto */
1481 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1482
1483 /* CIntFromPy.proto */
1484 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1485
1486 /* FastTypeChecks.proto */
1487 #if CYTHON_COMPILING_IN_CPYTHON
1488 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1489 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1490 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1491 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1492 #else
1493 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1494 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1495 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1496 #endif
1497 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1498
1499 /* CheckBinaryVersion.proto */
1500 static int __Pyx_check_binary_version(void);
1501
1502 /* FunctionExport.proto */
1503 static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);
1504
1505 /* InitStrings.proto */
1506 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1507
1508 static CYTHON_INLINE PyObject *__pyx_f_4lxml_3sax_19ElementTreeProducer__recursive_saxify(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *__pyx_v_self, PyObject *__pyx_v_element, PyObject *__pyx_v_parent_nsmap); /* proto*/
1509 static CYTHON_INLINE PyObject *__pyx_f_4lxml_3sax_19ElementTreeProducer__build_qname(CYTHON_UNUSED struct __pyx_obj_4lxml_3sax_ElementTreeProducer *__pyx_v_self, PyObject *__pyx_v_ns_uri, PyObject *__pyx_v_local_name, PyObject *__pyx_v_nsmap, PyObject *__pyx_v_preferred_prefix, int __pyx_v_is_attribute); /* proto*/
1510
1511 /* Module declarations from 'cython' */
1512
1513 /* Module declarations from 'lxml.sax' */
1514 static PyTypeObject *__pyx_ptype_4lxml_3sax_ElementTreeProducer = 0;
1515 static PyObject *__pyx_f_4lxml_3sax__getNsTag(PyObject *); /*proto*/
1516 static PyObject *__pyx_f_4lxml_3sax___pyx_unpickle_ElementTreeProducer__set_state(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *, PyObject *); /*proto*/
1517 #define __Pyx_MODULE_NAME "lxml.sax"
1518 extern int __pyx_module_is_main_lxml__sax;
1519 int __pyx_module_is_main_lxml__sax = 0;
1520
1521 /* Implementation of 'lxml.sax' */
1522 static PyObject *__pyx_builtin_property;
1523 static PyObject *__pyx_builtin_KeyError;
1524 static PyObject *__pyx_builtin_AttributeError;
1525 static PyObject *__pyx_builtin_IndexError;
1526 static PyObject *__pyx_builtin_min;
1527 static const char __pyx_k_[] = "{";
1528   static const char __pyx_k_k[] = "k";
1529   static const char __pyx_k_v[] = "v";
1530 static const char __pyx_k__3[] = "}";
1531 static const char __pyx_k__6[] = "";
1532 static const char __pyx_k__8[] = ":";
1533 static const char __pyx_k_pi[] = "pi";
1534 static const char __pyx_k_doc[] = "__doc__";
1535 static const char __pyx_k_get[] = "get";
1536 static const char __pyx_k_min[] = "min";
1537 static const char __pyx_k_new[] = "__new__";
1538 static const char __pyx_k_pop[] = "pop";
1539 static const char __pyx_k_s_s[] = "{%s}%s";
1540 static const char __pyx_k_tag[] = "tag";
1541 static const char __pyx_k_uri[] = "uri";
1542 static const char __pyx_k_data[] = "data";
1543 static const char __pyx_k_dict[] = "__dict__";
1544 static const char __pyx_k_init[] = "__init__";
1545 static const char __pyx_k_lxml[] = "lxml";
1546 static const char __pyx_k_main[] = "__main__";
1547 static const char __pyx_k_name[] = "name";
1548 static const char __pyx_k_root[] = "_root";
1549 static const char __pyx_k_self[] = "self";
1550 static const char __pyx_k_tail[] = "tail";
1551 static const char __pyx_k_test[] = "__test__";
1552 static const char __pyx_k_text[] = "text";
1553 static const char __pyx_k_attrs[] = "attrs";
1554 static const char __pyx_k_clear[] = "clear";
1555 static const char __pyx_k_doc_2[] = "doc";
1556 static const char __pyx_k_etree[] = "etree";
1557 static const char __pyx_k_items[] = "items";
1558 static const char __pyx_k_nsmap[] = "nsmap";
1559 static const char __pyx_k_qname[] = "qname";
1560 static const char __pyx_k_split[] = "split";
1561 static const char __pyx_k_state[] = "state";
1562 static const char __pyx_k_value[] = "value";
1563 static const char __pyx_k_append[] = "append";
1564 static const char __pyx_k_dict_2[] = "_dict";
1565 static const char __pyx_k_el_tag[] = "el_tag";
1566 static const char __pyx_k_import[] = "__import__";
1567 static const char __pyx_k_module[] = "__module__";
1568 static const char __pyx_k_name_2[] = "__name__";
1569 static const char __pyx_k_ns_uri[] = "ns_uri";
1570 static const char __pyx_k_pickle[] = "pickle";
1571 static const char __pyx_k_prefix[] = "prefix";
1572 static const char __pyx_k_reduce[] = "__reduce__";
1573 static const char __pyx_k_saxify[] = "saxify";
1574 static const char __pyx_k_target[] = "target";
1575 static const char __pyx_k_update[] = "update";
1576 static const char __pyx_k_Comment[] = "Comment";
1577 static const char __pyx_k_Element[] = "Element";
1578 static const char __pyx_k_el_name[] = "el_name";
1579 static const char __pyx_k_element[] = "element";
1580 static const char __pyx_k_getnext[] = "getnext";
1581 static const char __pyx_k_getroot[] = "getroot";
1582 static const char __pyx_k_locator[] = "locator";
1583 static const char __pyx_k_ns_name[] = "ns_name";
1584 static const char __pyx_k_prepare[] = "__prepare__";
1585 static const char __pyx_k_sibling[] = "sibling";
1586 static const char __pyx_k_KeyError[] = "KeyError";
1587 static const char __pyx_k_SaxError[] = "SaxError";
1588 static const char __pyx_k_buildTag[] = "_buildTag";
1589 static const char __pyx_k_getstate[] = "__getstate__";
1590 static const char __pyx_k_lxml_sax[] = "lxml.sax";
1591 static const char __pyx_k_property[] = "property";
1592 static const char __pyx_k_pyx_type[] = "__pyx_type";
1593 static const char __pyx_k_qualname[] = "__qualname__";
1594 static const char __pyx_k_setstate[] = "__setstate__";
1595 static const char __pyx_k_siblings[] = "siblings";
1596 static const char __pyx_k_LxmlError[] = "LxmlError";
1597 static const char __pyx_k_attr_name[] = "attr_name";
1598 static const char __pyx_k_get_etree[] = "_get_etree";
1599 static const char __pyx_k_iteritems[] = "iteritems";
1600 static const char __pyx_k_metaclass[] = "__metaclass__";
1601 static const char __pyx_k_pyx_state[] = "__pyx_state";
1602 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
1603 static const char __pyx_k_IndexError[] = "IndexError";
1604 static const char __pyx_k_SubElement[] = "SubElement";
1605 static const char __pyx_k_attributes[] = "attributes";
1606 static const char __pyx_k_characters[] = "characters";
1607 static const char __pyx_k_default_ns[] = "_default_ns";
1608 static const char __pyx_k_endElement[] = "endElement";
1609 static const char __pyx_k_local_name[] = "local_name";
1610 static const char __pyx_k_lxml_etree[] = "lxml.etree";
1611 static const char __pyx_k_name_tuple[] = "name_tuple";
1612 static const char __pyx_k_ns_mapping[] = "_ns_mapping";
1613 static const char __pyx_k_pyx_result[] = "__pyx_result";
1614 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
1615 static const char __pyx_k_ElementTree[] = "ElementTree";
1616 static const char __pyx_k_PickleError[] = "PickleError";
1617 static const char __pyx_k_addprevious[] = "addprevious";
1618 static const char __pyx_k_endDocument[] = "endDocument";
1619 static const char __pyx_k_getprevious[] = "getprevious";
1620 static const char __pyx_k_makeelement[] = "makeelement";
1621 static const char __pyx_k_ns_uri_list[] = "ns_uri_list";
1622 static const char __pyx_k_endElementNS[] = "endElementNS";
1623 static const char __pyx_k_last_element[] = "last_element";
1624 static const char __pyx_k_new_mappings[] = "_new_mappings";
1625 static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
1626 static const char __pyx_k_startElement[] = "startElement";
1627 static const char __pyx_k_stringsource[] = "stringsource";
1628 static const char __pyx_k_use_setstate[] = "use_setstate";
1629 static const char __pyx_k_element_stack[] = "_element_stack";
1630 static const char __pyx_k_makeelement_2[] = "_makeelement";
1631 static const char __pyx_k_ns_name_tuple[] = "ns_name_tuple";
1632 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
1633 static const char __pyx_k_root_siblings[] = "_root_siblings";
1634 static const char __pyx_k_startDocument[] = "startDocument";
1635 static const char __pyx_k_AttributeError[] = "AttributeError";
1636 static const char __pyx_k_ContentHandler[] = "ContentHandler";
1637 static const char __pyx_k_startElementNS[] = "startElementNS";
1638 static const char __pyx_k_content_handler[] = "content_handler";
1639 static const char __pyx_k_element_or_tree[] = "element_or_tree";
1640 static const char __pyx_k_element_stack_2[] = "element_stack";
1641 static const char __pyx_k_iter_attributes[] = "iter_attributes";
1642 static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
1643 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
1644 static const char __pyx_k_src_lxml_sax_py[] = "src/lxml/sax.py";
1645 static const char __pyx_k_xml_sax_handler[] = "xml.sax.handler";
1646 static const char __pyx_k_AttributesNSImpl[] = "AttributesNSImpl";
1647 static const char __pyx_k_endPrefixMapping[] = "endPrefixMapping";
1648 static const char __pyx_k_General_SAX_error[] = "General SAX error.\n    ";
1649 static const char __pyx_k_xml_sax_xmlreader[] = "xml.sax.xmlreader";
1650 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1651 static const char __pyx_k_setDocumentLocator[] = "setDocumentLocator";
1652 static const char __pyx_k_startPrefixMapping[] = "startPrefixMapping";
1653 static const char __pyx_k_ElementTreeProducer[] = "ElementTreeProducer";
1654 static const char __pyx_k_ignorableWhitespace[] = "ignorableWhitespace";
1655 static const char __pyx_k_ProcessingInstruction[] = "ProcessingInstruction";
1656 static const char __pyx_k_processingInstruction[] = "processingInstruction";
1657 static const char __pyx_k_ElementTreeContentHandler[] = "ElementTreeContentHandler";
1658 static const char __pyx_k_Unexpected_element_closed[] = "Unexpected element closed: ";
1659 static const char __pyx_k_ElementTreeProducer_saxify[] = "ElementTreeProducer.saxify";
1660 static const char __pyx_k_pyx_unpickle_ElementTreeProduc[] = "__pyx_unpickle_ElementTreeProducer";
1661 static const char __pyx_k_SAX_based_adapter_to_copy_trees[] = "\nSAX-based adapter to copy trees from/to the Python standard library.\n\nUse the `ElementTreeContentHandler` class to build an ElementTree from\nSAX events.\n\nUse the `ElementTreeProducer` class or the `saxify()` function to fire\nthe SAX events of an ElementTree against a SAX ContentHandler.\n\nSee http://codespeak.net/lxml/sax.html\n";
1662 static const char __pyx_k_Build_an_lxml_ElementTree_from_S[] = "Build an lxml ElementTree from SAX events.\n    ";
1663 static const char __pyx_k_ElementTreeContentHandler___init[] = "ElementTreeContentHandler.__init__";
1664 static const char __pyx_k_ElementTreeContentHandler__build[] = "ElementTreeContentHandler._buildTag";
1665 static const char __pyx_k_ElementTreeContentHandler__get_e[] = "ElementTreeContentHandler._get_etree";
1666 static const char __pyx_k_ElementTreeContentHandler_charac[] = "ElementTreeContentHandler.characters";
1667 static const char __pyx_k_ElementTreeContentHandler_endDoc[] = "ElementTreeContentHandler.endDocument";
1668 static const char __pyx_k_ElementTreeContentHandler_endEle[] = "ElementTreeContentHandler.endElementNS";
1669 static const char __pyx_k_ElementTreeContentHandler_endPre[] = "ElementTreeContentHandler.endPrefixMapping";
1670 static const char __pyx_k_ElementTreeContentHandler_proces[] = "ElementTreeContentHandler.processingInstruction";
1671 static const char __pyx_k_ElementTreeContentHandler_setDoc[] = "ElementTreeContentHandler.setDocumentLocator";
1672 static const char __pyx_k_ElementTreeContentHandler_startD[] = "ElementTreeContentHandler.startDocument";
1673 static const char __pyx_k_ElementTreeContentHandler_startE[] = "ElementTreeContentHandler.startElementNS";
1674 static const char __pyx_k_ElementTreeContentHandler_startP[] = "ElementTreeContentHandler.startPrefixMapping";
1675 static const char __pyx_k_ElementTreeProducer___reduce_cyt[] = "ElementTreeProducer.__reduce_cython__";
1676 static const char __pyx_k_ElementTreeProducer___setstate_c[] = "ElementTreeProducer.__setstate_cython__";
1677 static const char __pyx_k_Incompatible_checksums_s_vs_0x1d[] = "Incompatible checksums (%s vs 0x1d4a0fa = (_attr_class, _content_handler, _element, _empty_attributes))";
1678 static const char __pyx_k_ElementTreeContentHandler_endEle_2[] = "ElementTreeContentHandler.endElement";
1679 static const char __pyx_k_ElementTreeContentHandler_startE_2[] = "ElementTreeContentHandler.startElement";
1680 static PyObject *__pyx_kp_s_;
1681 static PyObject *__pyx_n_s_AttributeError;
1682 static PyObject *__pyx_n_s_AttributesNSImpl;
1683 static PyObject *__pyx_kp_s_Build_an_lxml_ElementTree_from_S;
1684 static PyObject *__pyx_n_s_Comment;
1685 static PyObject *__pyx_n_s_ContentHandler;
1686 static PyObject *__pyx_n_s_Element;
1687 static PyObject *__pyx_n_s_ElementTree;
1688 static PyObject *__pyx_n_s_ElementTreeContentHandler;
1689 static PyObject *__pyx_n_s_ElementTreeContentHandler___init;
1690 static PyObject *__pyx_n_s_ElementTreeContentHandler__build;
1691 static PyObject *__pyx_n_s_ElementTreeContentHandler__get_e;
1692 static PyObject *__pyx_n_s_ElementTreeContentHandler_charac;
1693 static PyObject *__pyx_n_s_ElementTreeContentHandler_endDoc;
1694 static PyObject *__pyx_n_s_ElementTreeContentHandler_endEle;
1695 static PyObject *__pyx_n_s_ElementTreeContentHandler_endEle_2;
1696 static PyObject *__pyx_n_s_ElementTreeContentHandler_endPre;
1697 static PyObject *__pyx_n_s_ElementTreeContentHandler_proces;
1698 static PyObject *__pyx_n_s_ElementTreeContentHandler_setDoc;
1699 static PyObject *__pyx_n_s_ElementTreeContentHandler_startD;
1700 static PyObject *__pyx_n_s_ElementTreeContentHandler_startE;
1701 static PyObject *__pyx_n_s_ElementTreeContentHandler_startE_2;
1702 static PyObject *__pyx_n_s_ElementTreeContentHandler_startP;
1703 static PyObject *__pyx_n_s_ElementTreeProducer;
1704 static PyObject *__pyx_n_s_ElementTreeProducer___reduce_cyt;
1705 static PyObject *__pyx_n_s_ElementTreeProducer___setstate_c;
1706 static PyObject *__pyx_n_s_ElementTreeProducer_saxify;
1707 static PyObject *__pyx_kp_s_General_SAX_error;
1708 static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x1d;
1709 static PyObject *__pyx_n_s_IndexError;
1710 static PyObject *__pyx_n_s_KeyError;
1711 static PyObject *__pyx_n_s_LxmlError;
1712 static PyObject *__pyx_n_s_PickleError;
1713 static PyObject *__pyx_n_s_ProcessingInstruction;
1714 static PyObject *__pyx_n_s_SaxError;
1715 static PyObject *__pyx_n_s_SubElement;
1716 static PyObject *__pyx_kp_s_Unexpected_element_closed;
1717 static PyObject *__pyx_kp_s__3;
1718 static PyObject *__pyx_kp_s__6;
1719 static PyObject *__pyx_kp_s__8;
1720 static PyObject *__pyx_n_s_addprevious;
1721 static PyObject *__pyx_n_s_append;
1722 static PyObject *__pyx_n_s_attr_name;
1723 static PyObject *__pyx_n_s_attributes;
1724 static PyObject *__pyx_n_s_attrs;
1725 static PyObject *__pyx_n_s_buildTag;
1726 static PyObject *__pyx_n_s_characters;
1727 static PyObject *__pyx_n_s_clear;
1728 static PyObject *__pyx_n_s_cline_in_traceback;
1729 static PyObject *__pyx_n_s_content_handler;
1730 static PyObject *__pyx_n_s_data;
1731 static PyObject *__pyx_n_s_default_ns;
1732 static PyObject *__pyx_n_s_dict;
1733 static PyObject *__pyx_n_s_dict_2;
1734 static PyObject *__pyx_n_s_doc;
1735 static PyObject *__pyx_n_s_doc_2;
1736 static PyObject *__pyx_n_s_el_name;
1737 static PyObject *__pyx_n_s_el_tag;
1738 static PyObject *__pyx_n_s_element;
1739 static PyObject *__pyx_n_s_element_or_tree;
1740 static PyObject *__pyx_n_s_element_stack;
1741 static PyObject *__pyx_n_s_element_stack_2;
1742 static PyObject *__pyx_n_s_endDocument;
1743 static PyObject *__pyx_n_s_endElement;
1744 static PyObject *__pyx_n_s_endElementNS;
1745 static PyObject *__pyx_n_s_endPrefixMapping;
1746 static PyObject *__pyx_n_s_etree;
1747 static PyObject *__pyx_n_s_get;
1748 static PyObject *__pyx_n_s_get_etree;
1749 static PyObject *__pyx_n_s_getnext;
1750 static PyObject *__pyx_n_s_getprevious;
1751 static PyObject *__pyx_n_s_getroot;
1752 static PyObject *__pyx_n_s_getstate;
1753 static PyObject *__pyx_n_s_ignorableWhitespace;
1754 static PyObject *__pyx_n_s_import;
1755 static PyObject *__pyx_n_s_init;
1756 static PyObject *__pyx_n_s_items;
1757 static PyObject *__pyx_n_s_iter_attributes;
1758 static PyObject *__pyx_n_s_iteritems;
1759 static PyObject *__pyx_n_s_k;
1760 static PyObject *__pyx_n_s_last_element;
1761 static PyObject *__pyx_n_s_local_name;
1762 static PyObject *__pyx_n_s_locator;
1763 static PyObject *__pyx_n_s_lxml;
1764 static PyObject *__pyx_n_s_lxml_etree;
1765 static PyObject *__pyx_n_s_lxml_sax;
1766 static PyObject *__pyx_n_s_main;
1767 static PyObject *__pyx_n_s_makeelement;
1768 static PyObject *__pyx_n_s_makeelement_2;
1769 static PyObject *__pyx_n_s_metaclass;
1770 static PyObject *__pyx_n_s_min;
1771 static PyObject *__pyx_n_s_module;
1772 static PyObject *__pyx_n_s_name;
1773 static PyObject *__pyx_n_s_name_2;
1774 static PyObject *__pyx_n_s_name_tuple;
1775 static PyObject *__pyx_n_s_new;
1776 static PyObject *__pyx_n_s_new_mappings;
1777 static PyObject *__pyx_n_s_ns_mapping;
1778 static PyObject *__pyx_n_s_ns_name;
1779 static PyObject *__pyx_n_s_ns_name_tuple;
1780 static PyObject *__pyx_n_s_ns_uri;
1781 static PyObject *__pyx_n_s_ns_uri_list;
1782 static PyObject *__pyx_n_s_nsmap;
1783 static PyObject *__pyx_n_s_pi;
1784 static PyObject *__pyx_n_s_pickle;
1785 static PyObject *__pyx_n_s_pop;
1786 static PyObject *__pyx_n_s_prefix;
1787 static PyObject *__pyx_n_s_prepare;
1788 static PyObject *__pyx_n_s_processingInstruction;
1789 static PyObject *__pyx_n_s_property;
1790 static PyObject *__pyx_n_s_pyx_PickleError;
1791 static PyObject *__pyx_n_s_pyx_checksum;
1792 static PyObject *__pyx_n_s_pyx_result;
1793 static PyObject *__pyx_n_s_pyx_state;
1794 static PyObject *__pyx_n_s_pyx_type;
1795 static PyObject *__pyx_n_s_pyx_unpickle_ElementTreeProduc;
1796 static PyObject *__pyx_n_s_pyx_vtable;
1797 static PyObject *__pyx_n_s_qname;
1798 static PyObject *__pyx_n_s_qualname;
1799 static PyObject *__pyx_n_s_reduce;
1800 static PyObject *__pyx_n_s_reduce_cython;
1801 static PyObject *__pyx_n_s_reduce_ex;
1802 static PyObject *__pyx_n_s_root;
1803 static PyObject *__pyx_n_s_root_siblings;
1804 static PyObject *__pyx_kp_s_s_s;
1805 static PyObject *__pyx_n_s_saxify;
1806 static PyObject *__pyx_n_s_self;
1807 static PyObject *__pyx_n_s_setDocumentLocator;
1808 static PyObject *__pyx_n_s_setstate;
1809 static PyObject *__pyx_n_s_setstate_cython;
1810 static PyObject *__pyx_n_s_sibling;
1811 static PyObject *__pyx_n_s_siblings;
1812 static PyObject *__pyx_n_s_split;
1813 static PyObject *__pyx_kp_s_src_lxml_sax_py;
1814 static PyObject *__pyx_n_s_startDocument;
1815 static PyObject *__pyx_n_s_startElement;
1816 static PyObject *__pyx_n_s_startElementNS;
1817 static PyObject *__pyx_n_s_startPrefixMapping;
1818 static PyObject *__pyx_n_s_state;
1819 static PyObject *__pyx_kp_s_stringsource;
1820 static PyObject *__pyx_n_s_tag;
1821 static PyObject *__pyx_n_s_tail;
1822 static PyObject *__pyx_n_s_target;
1823 static PyObject *__pyx_n_s_test;
1824 static PyObject *__pyx_n_s_text;
1825 static PyObject *__pyx_n_s_update;
1826 static PyObject *__pyx_n_s_uri;
1827 static PyObject *__pyx_n_s_use_setstate;
1828 static PyObject *__pyx_n_s_v;
1829 static PyObject *__pyx_n_s_value;
1830 static PyObject *__pyx_n_s_xml_sax_handler;
1831 static PyObject *__pyx_n_s_xml_sax_xmlreader;
1832 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_makeelement); /* proto */
1833 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_2_get_etree(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
1834 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_4setDocumentLocator(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_locator); /* proto */
1835 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_6startDocument(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
1836 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_8endDocument(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
1837 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_10startPrefixMapping(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_prefix, PyObject *__pyx_v_uri); /* proto */
1838 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_12endPrefixMapping(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_prefix); /* proto */
1839 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_14_buildTag(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_ns_name_tuple); /* proto */
1840 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_16startElementNS(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_ns_name, CYTHON_UNUSED PyObject *__pyx_v_qname, PyObject *__pyx_v_attributes); /* proto */
1841 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_18processingInstruction(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_target, PyObject *__pyx_v_data); /* proto */
1842 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_20endElementNS(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_ns_name, CYTHON_UNUSED PyObject *__pyx_v_qname); /* proto */
1843 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_22startElement(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_attributes); /* proto */
1844 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_24endElement(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
1845 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_26characters(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
1846 static int __pyx_pf_4lxml_3sax_19ElementTreeProducer___init__(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *__pyx_v_self, PyObject *__pyx_v_element_or_tree, PyObject *__pyx_v_content_handler); /* proto */
1847 static PyObject *__pyx_pf_4lxml_3sax_19ElementTreeProducer_2saxify(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *__pyx_v_self); /* proto */
1848 static PyObject *__pyx_pf_4lxml_3sax_19ElementTreeProducer_4__reduce_cython__(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *__pyx_v_self); /* proto */
1849 static PyObject *__pyx_pf_4lxml_3sax_19ElementTreeProducer_6__setstate_cython__(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
1850 static PyObject *__pyx_pf_4lxml_3sax_saxify(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_element_or_tree, PyObject *__pyx_v_content_handler); /* proto */
1851 static PyObject *__pyx_pf_4lxml_3sax_2__pyx_unpickle_ElementTreeProducer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
1852 static PyObject *__pyx_tp_new_4lxml_3sax_ElementTreeProducer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1853 static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get = {0, &__pyx_n_s_get, 0, 0, 0};
1854 static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items = {0, &__pyx_n_s_items, 0, 0, 0};
1855 static __Pyx_CachedCFunction __pyx_umethod_PyList_Type_pop = {0, &__pyx_n_s_pop, 0, 0, 0};
1856 static PyObject *__pyx_int_1;
1857 static PyObject *__pyx_int_30712058;
1858 static PyObject *__pyx_int_neg_1;
1859 static PyObject *__pyx_slice__2;
1860 static PyObject *__pyx_slice__5;
1861 static PyObject *__pyx_slice__7;
1862 static PyObject *__pyx_tuple__4;
1863 static PyObject *__pyx_tuple__9;
1864 static PyObject *__pyx_tuple__11;
1865 static PyObject *__pyx_tuple__12;
1866 static PyObject *__pyx_tuple__14;
1867 static PyObject *__pyx_tuple__16;
1868 static PyObject *__pyx_tuple__18;
1869 static PyObject *__pyx_tuple__20;
1870 static PyObject *__pyx_tuple__22;
1871 static PyObject *__pyx_tuple__24;
1872 static PyObject *__pyx_tuple__26;
1873 static PyObject *__pyx_tuple__28;
1874 static PyObject *__pyx_tuple__29;
1875 static PyObject *__pyx_tuple__31;
1876 static PyObject *__pyx_tuple__33;
1877 static PyObject *__pyx_tuple__35;
1878 static PyObject *__pyx_tuple__36;
1879 static PyObject *__pyx_tuple__38;
1880 static PyObject *__pyx_tuple__40;
1881 static PyObject *__pyx_tuple__42;
1882 static PyObject *__pyx_tuple__44;
1883 static PyObject *__pyx_tuple__46;
1884 static PyObject *__pyx_tuple__48;
1885 static PyObject *__pyx_codeobj__10;
1886 static PyObject *__pyx_codeobj__13;
1887 static PyObject *__pyx_codeobj__15;
1888 static PyObject *__pyx_codeobj__17;
1889 static PyObject *__pyx_codeobj__19;
1890 static PyObject *__pyx_codeobj__21;
1891 static PyObject *__pyx_codeobj__23;
1892 static PyObject *__pyx_codeobj__25;
1893 static PyObject *__pyx_codeobj__27;
1894 static PyObject *__pyx_codeobj__30;
1895 static PyObject *__pyx_codeobj__32;
1896 static PyObject *__pyx_codeobj__34;
1897 static PyObject *__pyx_codeobj__37;
1898 static PyObject *__pyx_codeobj__39;
1899 static PyObject *__pyx_codeobj__41;
1900 static PyObject *__pyx_codeobj__43;
1901 static PyObject *__pyx_codeobj__45;
1902 static PyObject *__pyx_codeobj__47;
1903 static PyObject *__pyx_codeobj__49;
1904 /* Late includes */
1905
1906 /* "lxml/sax.py":28
1907  * 
1908  * 
1909  * def _getNsTag(tag):             # <<<<<<<<<<<<<<
1910  *     if tag[0] == '{':
1911  *         return tuple(tag[1:].split('}', 1))
1912  */
1913
1914 static PyObject *__pyx_f_4lxml_3sax__getNsTag(PyObject *__pyx_v_tag) {
1915   PyObject *__pyx_r = NULL;
1916   __Pyx_RefNannyDeclarations
1917   PyObject *__pyx_t_1 = NULL;
1918   int __pyx_t_2;
1919   PyObject *__pyx_t_3 = NULL;
1920   int __pyx_lineno = 0;
1921   const char *__pyx_filename = NULL;
1922   int __pyx_clineno = 0;
1923   __Pyx_RefNannySetupContext("_getNsTag", 0);
1924
1925   /* "lxml/sax.py":29
1926  * 
1927  * def _getNsTag(tag):
1928  *     if tag[0] == '{':             # <<<<<<<<<<<<<<
1929  *         return tuple(tag[1:].split('}', 1))
1930  *     else:
1931  */
1932   __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_tag, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
1933   __Pyx_GOTREF(__pyx_t_1);
1934   __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_kp_s_, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 29, __pyx_L1_error)
1935   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1936   if (__pyx_t_2) {
1937
1938     /* "lxml/sax.py":30
1939  * def _getNsTag(tag):
1940  *     if tag[0] == '{':
1941  *         return tuple(tag[1:].split('}', 1))             # <<<<<<<<<<<<<<
1942  *     else:
1943  *         return None, tag
1944  */
1945     __Pyx_XDECREF(__pyx_r);
1946     __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_tag, 1, 0, NULL, NULL, &__pyx_slice__2, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error)
1947     __Pyx_GOTREF(__pyx_t_1);
1948     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_split); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 30, __pyx_L1_error)
1949     __Pyx_GOTREF(__pyx_t_3);
1950     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1951     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error)
1952     __Pyx_GOTREF(__pyx_t_1);
1953     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1954     __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 30, __pyx_L1_error)
1955     __Pyx_GOTREF(__pyx_t_3);
1956     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1957     __pyx_r = ((PyObject*)__pyx_t_3);
1958     __pyx_t_3 = 0;
1959     goto __pyx_L0;
1960
1961     /* "lxml/sax.py":29
1962  * 
1963  * def _getNsTag(tag):
1964  *     if tag[0] == '{':             # <<<<<<<<<<<<<<
1965  *         return tuple(tag[1:].split('}', 1))
1966  *     else:
1967  */
1968   }
1969
1970   /* "lxml/sax.py":32
1971  *         return tuple(tag[1:].split('}', 1))
1972  *     else:
1973  *         return None, tag             # <<<<<<<<<<<<<<
1974  * 
1975  * 
1976  */
1977   /*else*/ {
1978     __Pyx_XDECREF(__pyx_r);
1979     __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error)
1980     __Pyx_GOTREF(__pyx_t_3);
1981     __Pyx_INCREF(Py_None);
1982     __Pyx_GIVEREF(Py_None);
1983     PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
1984     __Pyx_INCREF(__pyx_v_tag);
1985     __Pyx_GIVEREF(__pyx_v_tag);
1986     PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_tag);
1987     __pyx_r = ((PyObject*)__pyx_t_3);
1988     __pyx_t_3 = 0;
1989     goto __pyx_L0;
1990   }
1991
1992   /* "lxml/sax.py":28
1993  * 
1994  * 
1995  * def _getNsTag(tag):             # <<<<<<<<<<<<<<
1996  *     if tag[0] == '{':
1997  *         return tuple(tag[1:].split('}', 1))
1998  */
1999
2000   /* function exit code */
2001   __pyx_L1_error:;
2002   __Pyx_XDECREF(__pyx_t_1);
2003   __Pyx_XDECREF(__pyx_t_3);
2004   __Pyx_AddTraceback("lxml.sax._getNsTag", __pyx_clineno, __pyx_lineno, __pyx_filename);
2005   __pyx_r = 0;
2006   __pyx_L0:;
2007   __Pyx_XGIVEREF(__pyx_r);
2008   __Pyx_RefNannyFinishContext();
2009   return __pyx_r;
2010 }
2011
2012 /* "lxml/sax.py":38
2013  *     """Build an lxml ElementTree from SAX events.
2014  *     """
2015  *     def __init__(self, makeelement=None):             # <<<<<<<<<<<<<<
2016  *         ContentHandler.__init__(self)
2017  *         self._root = None
2018  */
2019
2020 /* Python wrapper */
2021 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2022 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
2023 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2024   PyObject *__pyx_v_self = 0;
2025   PyObject *__pyx_v_makeelement = 0;
2026   int __pyx_lineno = 0;
2027   const char *__pyx_filename = NULL;
2028   int __pyx_clineno = 0;
2029   PyObject *__pyx_r = 0;
2030   __Pyx_RefNannyDeclarations
2031   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
2032   {
2033     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_makeelement,0};
2034     PyObject* values[2] = {0,0};
2035     values[1] = ((PyObject *)((PyObject *)Py_None));
2036     if (unlikely(__pyx_kwds)) {
2037       Py_ssize_t kw_args;
2038       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2039       switch (pos_args) {
2040         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2041         CYTHON_FALLTHROUGH;
2042         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2043         CYTHON_FALLTHROUGH;
2044         case  0: break;
2045         default: goto __pyx_L5_argtuple_error;
2046       }
2047       kw_args = PyDict_Size(__pyx_kwds);
2048       switch (pos_args) {
2049         case  0:
2050         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
2051         else goto __pyx_L5_argtuple_error;
2052         CYTHON_FALLTHROUGH;
2053         case  1:
2054         if (kw_args > 0) {
2055           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_makeelement);
2056           if (value) { values[1] = value; kw_args--; }
2057         }
2058       }
2059       if (unlikely(kw_args > 0)) {
2060         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 38, __pyx_L3_error)
2061       }
2062     } else {
2063       switch (PyTuple_GET_SIZE(__pyx_args)) {
2064         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2065         CYTHON_FALLTHROUGH;
2066         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2067         break;
2068         default: goto __pyx_L5_argtuple_error;
2069       }
2070     }
2071     __pyx_v_self = values[0];
2072     __pyx_v_makeelement = values[1];
2073   }
2074   goto __pyx_L4_argument_unpacking_done;
2075   __pyx_L5_argtuple_error:;
2076   __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 38, __pyx_L3_error)
2077   __pyx_L3_error:;
2078   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2079   __Pyx_RefNannyFinishContext();
2080   return NULL;
2081   __pyx_L4_argument_unpacking_done:;
2082   __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler___init__(__pyx_self, __pyx_v_self, __pyx_v_makeelement);
2083
2084   /* function exit code */
2085   __Pyx_RefNannyFinishContext();
2086   return __pyx_r;
2087 }
2088
2089 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_makeelement) {
2090   PyObject *__pyx_r = NULL;
2091   __Pyx_RefNannyDeclarations
2092   PyObject *__pyx_t_1 = NULL;
2093   PyObject *__pyx_t_2 = NULL;
2094   PyObject *__pyx_t_3 = NULL;
2095   int __pyx_t_4;
2096   int __pyx_t_5;
2097   int __pyx_lineno = 0;
2098   const char *__pyx_filename = NULL;
2099   int __pyx_clineno = 0;
2100   __Pyx_RefNannySetupContext("__init__", 0);
2101   __Pyx_INCREF(__pyx_v_makeelement);
2102
2103   /* "lxml/sax.py":39
2104  *     """
2105  *     def __init__(self, makeelement=None):
2106  *         ContentHandler.__init__(self)             # <<<<<<<<<<<<<<
2107  *         self._root = None
2108  *         self._root_siblings = []
2109  */
2110   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ContentHandler); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error)
2111   __Pyx_GOTREF(__pyx_t_2);
2112   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 39, __pyx_L1_error)
2113   __Pyx_GOTREF(__pyx_t_3);
2114   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2115   __pyx_t_2 = NULL;
2116   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
2117     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
2118     if (likely(__pyx_t_2)) {
2119       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
2120       __Pyx_INCREF(__pyx_t_2);
2121       __Pyx_INCREF(function);
2122       __Pyx_DECREF_SET(__pyx_t_3, function);
2123     }
2124   }
2125   __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_self) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_self);
2126   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
2127   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error)
2128   __Pyx_GOTREF(__pyx_t_1);
2129   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2130   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2131
2132   /* "lxml/sax.py":40
2133  *     def __init__(self, makeelement=None):
2134  *         ContentHandler.__init__(self)
2135  *         self._root = None             # <<<<<<<<<<<<<<
2136  *         self._root_siblings = []
2137  *         self._element_stack = []
2138  */
2139   if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_root, Py_None) < 0) __PYX_ERR(0, 40, __pyx_L1_error)
2140
2141   /* "lxml/sax.py":41
2142  *         ContentHandler.__init__(self)
2143  *         self._root = None
2144  *         self._root_siblings = []             # <<<<<<<<<<<<<<
2145  *         self._element_stack = []
2146  *         self._default_ns = None
2147  */
2148   __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error)
2149   __Pyx_GOTREF(__pyx_t_1);
2150   if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_root_siblings, __pyx_t_1) < 0) __PYX_ERR(0, 41, __pyx_L1_error)
2151   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2152
2153   /* "lxml/sax.py":42
2154  *         self._root = None
2155  *         self._root_siblings = []
2156  *         self._element_stack = []             # <<<<<<<<<<<<<<
2157  *         self._default_ns = None
2158  *         self._ns_mapping = { None : [None] }
2159  */
2160   __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error)
2161   __Pyx_GOTREF(__pyx_t_1);
2162   if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_element_stack, __pyx_t_1) < 0) __PYX_ERR(0, 42, __pyx_L1_error)
2163   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2164
2165   /* "lxml/sax.py":43
2166  *         self._root_siblings = []
2167  *         self._element_stack = []
2168  *         self._default_ns = None             # <<<<<<<<<<<<<<
2169  *         self._ns_mapping = { None : [None] }
2170  *         self._new_mappings = {}
2171  */
2172   if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_default_ns, Py_None) < 0) __PYX_ERR(0, 43, __pyx_L1_error)
2173
2174   /* "lxml/sax.py":44
2175  *         self._element_stack = []
2176  *         self._default_ns = None
2177  *         self._ns_mapping = { None : [None] }             # <<<<<<<<<<<<<<
2178  *         self._new_mappings = {}
2179  *         if makeelement is None:
2180  */
2181   __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error)
2182   __Pyx_GOTREF(__pyx_t_1);
2183   __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error)
2184   __Pyx_GOTREF(__pyx_t_3);
2185   __Pyx_INCREF(Py_None);
2186   __Pyx_GIVEREF(Py_None);
2187   PyList_SET_ITEM(__pyx_t_3, 0, Py_None);
2188   if (PyDict_SetItem(__pyx_t_1, Py_None, __pyx_t_3) < 0) __PYX_ERR(0, 44, __pyx_L1_error)
2189   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2190   if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_ns_mapping, __pyx_t_1) < 0) __PYX_ERR(0, 44, __pyx_L1_error)
2191   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2192
2193   /* "lxml/sax.py":45
2194  *         self._default_ns = None
2195  *         self._ns_mapping = { None : [None] }
2196  *         self._new_mappings = {}             # <<<<<<<<<<<<<<
2197  *         if makeelement is None:
2198  *             makeelement = etree.Element
2199  */
2200   __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
2201   __Pyx_GOTREF(__pyx_t_1);
2202   if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_new_mappings, __pyx_t_1) < 0) __PYX_ERR(0, 45, __pyx_L1_error)
2203   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2204
2205   /* "lxml/sax.py":46
2206  *         self._ns_mapping = { None : [None] }
2207  *         self._new_mappings = {}
2208  *         if makeelement is None:             # <<<<<<<<<<<<<<
2209  *             makeelement = etree.Element
2210  *         self._makeelement = makeelement
2211  */
2212   __pyx_t_4 = (__pyx_v_makeelement == Py_None);
2213   __pyx_t_5 = (__pyx_t_4 != 0);
2214   if (__pyx_t_5) {
2215
2216     /* "lxml/sax.py":47
2217  *         self._new_mappings = {}
2218  *         if makeelement is None:
2219  *             makeelement = etree.Element             # <<<<<<<<<<<<<<
2220  *         self._makeelement = makeelement
2221  * 
2222  */
2223     __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_etree); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error)
2224     __Pyx_GOTREF(__pyx_t_1);
2225     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Element); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 47, __pyx_L1_error)
2226     __Pyx_GOTREF(__pyx_t_3);
2227     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2228     __Pyx_DECREF_SET(__pyx_v_makeelement, __pyx_t_3);
2229     __pyx_t_3 = 0;
2230
2231     /* "lxml/sax.py":46
2232  *         self._ns_mapping = { None : [None] }
2233  *         self._new_mappings = {}
2234  *         if makeelement is None:             # <<<<<<<<<<<<<<
2235  *             makeelement = etree.Element
2236  *         self._makeelement = makeelement
2237  */
2238   }
2239
2240   /* "lxml/sax.py":48
2241  *         if makeelement is None:
2242  *             makeelement = etree.Element
2243  *         self._makeelement = makeelement             # <<<<<<<<<<<<<<
2244  * 
2245  *     def _get_etree(self):
2246  */
2247   if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_makeelement_2, __pyx_v_makeelement) < 0) __PYX_ERR(0, 48, __pyx_L1_error)
2248
2249   /* "lxml/sax.py":38
2250  *     """Build an lxml ElementTree from SAX events.
2251  *     """
2252  *     def __init__(self, makeelement=None):             # <<<<<<<<<<<<<<
2253  *         ContentHandler.__init__(self)
2254  *         self._root = None
2255  */
2256
2257   /* function exit code */
2258   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2259   goto __pyx_L0;
2260   __pyx_L1_error:;
2261   __Pyx_XDECREF(__pyx_t_1);
2262   __Pyx_XDECREF(__pyx_t_2);
2263   __Pyx_XDECREF(__pyx_t_3);
2264   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2265   __pyx_r = NULL;
2266   __pyx_L0:;
2267   __Pyx_XDECREF(__pyx_v_makeelement);
2268   __Pyx_XGIVEREF(__pyx_r);
2269   __Pyx_RefNannyFinishContext();
2270   return __pyx_r;
2271 }
2272
2273 /* "lxml/sax.py":50
2274  *         self._makeelement = makeelement
2275  * 
2276  *     def _get_etree(self):             # <<<<<<<<<<<<<<
2277  *         "Contains the generated ElementTree after parsing is finished."
2278  *         return ElementTree(self._root)
2279  */
2280
2281 /* Python wrapper */
2282 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_3_get_etree(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
2283 static char __pyx_doc_4lxml_3sax_25ElementTreeContentHandler_2_get_etree[] = "Contains the generated ElementTree after parsing is finished.";
2284 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_3_get_etree = {"_get_etree", (PyCFunction)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_3_get_etree, METH_O, __pyx_doc_4lxml_3sax_25ElementTreeContentHandler_2_get_etree};
2285 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_3_get_etree(PyObject *__pyx_self, PyObject *__pyx_v_self) {
2286   PyObject *__pyx_r = 0;
2287   __Pyx_RefNannyDeclarations
2288   __Pyx_RefNannySetupContext("_get_etree (wrapper)", 0);
2289   __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_2_get_etree(__pyx_self, ((PyObject *)__pyx_v_self));
2290
2291   /* function exit code */
2292   __Pyx_RefNannyFinishContext();
2293   return __pyx_r;
2294 }
2295
2296 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_2_get_etree(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
2297   PyObject *__pyx_r = NULL;
2298   __Pyx_RefNannyDeclarations
2299   PyObject *__pyx_t_1 = NULL;
2300   PyObject *__pyx_t_2 = NULL;
2301   PyObject *__pyx_t_3 = NULL;
2302   PyObject *__pyx_t_4 = NULL;
2303   int __pyx_lineno = 0;
2304   const char *__pyx_filename = NULL;
2305   int __pyx_clineno = 0;
2306   __Pyx_RefNannySetupContext("_get_etree", 0);
2307
2308   /* "lxml/sax.py":52
2309  *     def _get_etree(self):
2310  *         "Contains the generated ElementTree after parsing is finished."
2311  *         return ElementTree(self._root)             # <<<<<<<<<<<<<<
2312  * 
2313  *     etree = property(_get_etree, doc=_get_etree.__doc__)
2314  */
2315   __Pyx_XDECREF(__pyx_r);
2316   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ElementTree); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error)
2317   __Pyx_GOTREF(__pyx_t_2);
2318   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_root); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error)
2319   __Pyx_GOTREF(__pyx_t_3);
2320   __pyx_t_4 = NULL;
2321   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
2322     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
2323     if (likely(__pyx_t_4)) {
2324       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
2325       __Pyx_INCREF(__pyx_t_4);
2326       __Pyx_INCREF(function);
2327       __Pyx_DECREF_SET(__pyx_t_2, function);
2328     }
2329   }
2330   __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
2331   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
2332   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2333   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error)
2334   __Pyx_GOTREF(__pyx_t_1);
2335   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2336   __pyx_r = __pyx_t_1;
2337   __pyx_t_1 = 0;
2338   goto __pyx_L0;
2339
2340   /* "lxml/sax.py":50
2341  *         self._makeelement = makeelement
2342  * 
2343  *     def _get_etree(self):             # <<<<<<<<<<<<<<
2344  *         "Contains the generated ElementTree after parsing is finished."
2345  *         return ElementTree(self._root)
2346  */
2347
2348   /* function exit code */
2349   __pyx_L1_error:;
2350   __Pyx_XDECREF(__pyx_t_1);
2351   __Pyx_XDECREF(__pyx_t_2);
2352   __Pyx_XDECREF(__pyx_t_3);
2353   __Pyx_XDECREF(__pyx_t_4);
2354   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler._get_etree", __pyx_clineno, __pyx_lineno, __pyx_filename);
2355   __pyx_r = NULL;
2356   __pyx_L0:;
2357   __Pyx_XGIVEREF(__pyx_r);
2358   __Pyx_RefNannyFinishContext();
2359   return __pyx_r;
2360 }
2361
2362 /* "lxml/sax.py":56
2363  *     etree = property(_get_etree, doc=_get_etree.__doc__)
2364  * 
2365  *     def setDocumentLocator(self, locator):             # <<<<<<<<<<<<<<
2366  *         pass
2367  * 
2368  */
2369
2370 /* Python wrapper */
2371 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_5setDocumentLocator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2372 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_5setDocumentLocator = {"setDocumentLocator", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_5setDocumentLocator, METH_VARARGS|METH_KEYWORDS, 0};
2373 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_5setDocumentLocator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2374   CYTHON_UNUSED PyObject *__pyx_v_self = 0;
2375   CYTHON_UNUSED PyObject *__pyx_v_locator = 0;
2376   int __pyx_lineno = 0;
2377   const char *__pyx_filename = NULL;
2378   int __pyx_clineno = 0;
2379   PyObject *__pyx_r = 0;
2380   __Pyx_RefNannyDeclarations
2381   __Pyx_RefNannySetupContext("setDocumentLocator (wrapper)", 0);
2382   {
2383     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_locator,0};
2384     PyObject* values[2] = {0,0};
2385     if (unlikely(__pyx_kwds)) {
2386       Py_ssize_t kw_args;
2387       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2388       switch (pos_args) {
2389         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2390         CYTHON_FALLTHROUGH;
2391         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2392         CYTHON_FALLTHROUGH;
2393         case  0: break;
2394         default: goto __pyx_L5_argtuple_error;
2395       }
2396       kw_args = PyDict_Size(__pyx_kwds);
2397       switch (pos_args) {
2398         case  0:
2399         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
2400         else goto __pyx_L5_argtuple_error;
2401         CYTHON_FALLTHROUGH;
2402         case  1:
2403         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_locator)) != 0)) kw_args--;
2404         else {
2405           __Pyx_RaiseArgtupleInvalid("setDocumentLocator", 1, 2, 2, 1); __PYX_ERR(0, 56, __pyx_L3_error)
2406         }
2407       }
2408       if (unlikely(kw_args > 0)) {
2409         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setDocumentLocator") < 0)) __PYX_ERR(0, 56, __pyx_L3_error)
2410       }
2411     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
2412       goto __pyx_L5_argtuple_error;
2413     } else {
2414       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2415       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2416     }
2417     __pyx_v_self = values[0];
2418     __pyx_v_locator = values[1];
2419   }
2420   goto __pyx_L4_argument_unpacking_done;
2421   __pyx_L5_argtuple_error:;
2422   __Pyx_RaiseArgtupleInvalid("setDocumentLocator", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 56, __pyx_L3_error)
2423   __pyx_L3_error:;
2424   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.setDocumentLocator", __pyx_clineno, __pyx_lineno, __pyx_filename);
2425   __Pyx_RefNannyFinishContext();
2426   return NULL;
2427   __pyx_L4_argument_unpacking_done:;
2428   __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_4setDocumentLocator(__pyx_self, __pyx_v_self, __pyx_v_locator);
2429
2430   /* function exit code */
2431   __Pyx_RefNannyFinishContext();
2432   return __pyx_r;
2433 }
2434
2435 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_4setDocumentLocator(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_locator) {
2436   PyObject *__pyx_r = NULL;
2437   __Pyx_RefNannyDeclarations
2438   __Pyx_RefNannySetupContext("setDocumentLocator", 0);
2439
2440   /* function exit code */
2441   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2442   __Pyx_XGIVEREF(__pyx_r);
2443   __Pyx_RefNannyFinishContext();
2444   return __pyx_r;
2445 }
2446
2447 /* "lxml/sax.py":59
2448  *         pass
2449  * 
2450  *     def startDocument(self):             # <<<<<<<<<<<<<<
2451  *         pass
2452  * 
2453  */
2454
2455 /* Python wrapper */
2456 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_7startDocument(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
2457 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_7startDocument = {"startDocument", (PyCFunction)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_7startDocument, METH_O, 0};
2458 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_7startDocument(PyObject *__pyx_self, PyObject *__pyx_v_self) {
2459   PyObject *__pyx_r = 0;
2460   __Pyx_RefNannyDeclarations
2461   __Pyx_RefNannySetupContext("startDocument (wrapper)", 0);
2462   __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_6startDocument(__pyx_self, ((PyObject *)__pyx_v_self));
2463
2464   /* function exit code */
2465   __Pyx_RefNannyFinishContext();
2466   return __pyx_r;
2467 }
2468
2469 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_6startDocument(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
2470   PyObject *__pyx_r = NULL;
2471   __Pyx_RefNannyDeclarations
2472   __Pyx_RefNannySetupContext("startDocument", 0);
2473
2474   /* function exit code */
2475   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2476   __Pyx_XGIVEREF(__pyx_r);
2477   __Pyx_RefNannyFinishContext();
2478   return __pyx_r;
2479 }
2480
2481 /* "lxml/sax.py":62
2482  *         pass
2483  * 
2484  *     def endDocument(self):             # <<<<<<<<<<<<<<
2485  *         pass
2486  * 
2487  */
2488
2489 /* Python wrapper */
2490 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_9endDocument(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
2491 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_9endDocument = {"endDocument", (PyCFunction)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_9endDocument, METH_O, 0};
2492 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_9endDocument(PyObject *__pyx_self, PyObject *__pyx_v_self) {
2493   PyObject *__pyx_r = 0;
2494   __Pyx_RefNannyDeclarations
2495   __Pyx_RefNannySetupContext("endDocument (wrapper)", 0);
2496   __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_8endDocument(__pyx_self, ((PyObject *)__pyx_v_self));
2497
2498   /* function exit code */
2499   __Pyx_RefNannyFinishContext();
2500   return __pyx_r;
2501 }
2502
2503 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_8endDocument(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
2504   PyObject *__pyx_r = NULL;
2505   __Pyx_RefNannyDeclarations
2506   __Pyx_RefNannySetupContext("endDocument", 0);
2507
2508   /* function exit code */
2509   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2510   __Pyx_XGIVEREF(__pyx_r);
2511   __Pyx_RefNannyFinishContext();
2512   return __pyx_r;
2513 }
2514
2515 /* "lxml/sax.py":65
2516  *         pass
2517  * 
2518  *     def startPrefixMapping(self, prefix, uri):             # <<<<<<<<<<<<<<
2519  *         self._new_mappings[prefix] = uri
2520  *         try:
2521  */
2522
2523 /* Python wrapper */
2524 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_11startPrefixMapping(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2525 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_11startPrefixMapping = {"startPrefixMapping", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_11startPrefixMapping, METH_VARARGS|METH_KEYWORDS, 0};
2526 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_11startPrefixMapping(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2527   PyObject *__pyx_v_self = 0;
2528   PyObject *__pyx_v_prefix = 0;
2529   PyObject *__pyx_v_uri = 0;
2530   int __pyx_lineno = 0;
2531   const char *__pyx_filename = NULL;
2532   int __pyx_clineno = 0;
2533   PyObject *__pyx_r = 0;
2534   __Pyx_RefNannyDeclarations
2535   __Pyx_RefNannySetupContext("startPrefixMapping (wrapper)", 0);
2536   {
2537     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_prefix,&__pyx_n_s_uri,0};
2538     PyObject* values[3] = {0,0,0};
2539     if (unlikely(__pyx_kwds)) {
2540       Py_ssize_t kw_args;
2541       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2542       switch (pos_args) {
2543         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2544         CYTHON_FALLTHROUGH;
2545         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2546         CYTHON_FALLTHROUGH;
2547         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2548         CYTHON_FALLTHROUGH;
2549         case  0: break;
2550         default: goto __pyx_L5_argtuple_error;
2551       }
2552       kw_args = PyDict_Size(__pyx_kwds);
2553       switch (pos_args) {
2554         case  0:
2555         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
2556         else goto __pyx_L5_argtuple_error;
2557         CYTHON_FALLTHROUGH;
2558         case  1:
2559         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prefix)) != 0)) kw_args--;
2560         else {
2561           __Pyx_RaiseArgtupleInvalid("startPrefixMapping", 1, 3, 3, 1); __PYX_ERR(0, 65, __pyx_L3_error)
2562         }
2563         CYTHON_FALLTHROUGH;
2564         case  2:
2565         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_uri)) != 0)) kw_args--;
2566         else {
2567           __Pyx_RaiseArgtupleInvalid("startPrefixMapping", 1, 3, 3, 2); __PYX_ERR(0, 65, __pyx_L3_error)
2568         }
2569       }
2570       if (unlikely(kw_args > 0)) {
2571         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "startPrefixMapping") < 0)) __PYX_ERR(0, 65, __pyx_L3_error)
2572       }
2573     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
2574       goto __pyx_L5_argtuple_error;
2575     } else {
2576       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2577       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2578       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2579     }
2580     __pyx_v_self = values[0];
2581     __pyx_v_prefix = values[1];
2582     __pyx_v_uri = values[2];
2583   }
2584   goto __pyx_L4_argument_unpacking_done;
2585   __pyx_L5_argtuple_error:;
2586   __Pyx_RaiseArgtupleInvalid("startPrefixMapping", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 65, __pyx_L3_error)
2587   __pyx_L3_error:;
2588   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.startPrefixMapping", __pyx_clineno, __pyx_lineno, __pyx_filename);
2589   __Pyx_RefNannyFinishContext();
2590   return NULL;
2591   __pyx_L4_argument_unpacking_done:;
2592   __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_10startPrefixMapping(__pyx_self, __pyx_v_self, __pyx_v_prefix, __pyx_v_uri);
2593
2594   /* function exit code */
2595   __Pyx_RefNannyFinishContext();
2596   return __pyx_r;
2597 }
2598
2599 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_10startPrefixMapping(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_prefix, PyObject *__pyx_v_uri) {
2600   PyObject *__pyx_r = NULL;
2601   __Pyx_RefNannyDeclarations
2602   PyObject *__pyx_t_1 = NULL;
2603   PyObject *__pyx_t_2 = NULL;
2604   PyObject *__pyx_t_3 = NULL;
2605   PyObject *__pyx_t_4 = NULL;
2606   PyObject *__pyx_t_5 = NULL;
2607   int __pyx_t_6;
2608   int __pyx_t_7;
2609   PyObject *__pyx_t_8 = NULL;
2610   PyObject *__pyx_t_9 = NULL;
2611   PyObject *__pyx_t_10 = NULL;
2612   int __pyx_t_11;
2613   int __pyx_t_12;
2614   int __pyx_lineno = 0;
2615   const char *__pyx_filename = NULL;
2616   int __pyx_clineno = 0;
2617   __Pyx_RefNannySetupContext("startPrefixMapping", 0);
2618
2619   /* "lxml/sax.py":66
2620  * 
2621  *     def startPrefixMapping(self, prefix, uri):
2622  *         self._new_mappings[prefix] = uri             # <<<<<<<<<<<<<<
2623  *         try:
2624  *             self._ns_mapping[prefix].append(uri)
2625  */
2626   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_new_mappings); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error)
2627   __Pyx_GOTREF(__pyx_t_1);
2628   if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_prefix, __pyx_v_uri) < 0)) __PYX_ERR(0, 66, __pyx_L1_error)
2629   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2630
2631   /* "lxml/sax.py":67
2632  *     def startPrefixMapping(self, prefix, uri):
2633  *         self._new_mappings[prefix] = uri
2634  *         try:             # <<<<<<<<<<<<<<
2635  *             self._ns_mapping[prefix].append(uri)
2636  *         except KeyError:
2637  */
2638   {
2639     __Pyx_PyThreadState_declare
2640     __Pyx_PyThreadState_assign
2641     __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
2642     __Pyx_XGOTREF(__pyx_t_2);
2643     __Pyx_XGOTREF(__pyx_t_3);
2644     __Pyx_XGOTREF(__pyx_t_4);
2645     /*try:*/ {
2646
2647       /* "lxml/sax.py":68
2648  *         self._new_mappings[prefix] = uri
2649  *         try:
2650  *             self._ns_mapping[prefix].append(uri)             # <<<<<<<<<<<<<<
2651  *         except KeyError:
2652  *             self._ns_mapping[prefix] = [uri]
2653  */
2654       __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ns_mapping); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L3_error)
2655       __Pyx_GOTREF(__pyx_t_1);
2656       __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_prefix); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 68, __pyx_L3_error)
2657       __Pyx_GOTREF(__pyx_t_5);
2658       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2659       __pyx_t_6 = __Pyx_PyObject_Append(__pyx_t_5, __pyx_v_uri); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 68, __pyx_L3_error)
2660       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2661
2662       /* "lxml/sax.py":67
2663  *     def startPrefixMapping(self, prefix, uri):
2664  *         self._new_mappings[prefix] = uri
2665  *         try:             # <<<<<<<<<<<<<<
2666  *             self._ns_mapping[prefix].append(uri)
2667  *         except KeyError:
2668  */
2669     }
2670     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
2671     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2672     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
2673     goto __pyx_L8_try_end;
2674     __pyx_L3_error:;
2675     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
2676     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
2677
2678     /* "lxml/sax.py":69
2679  *         try:
2680  *             self._ns_mapping[prefix].append(uri)
2681  *         except KeyError:             # <<<<<<<<<<<<<<
2682  *             self._ns_mapping[prefix] = [uri]
2683  *         if prefix is None:
2684  */
2685     __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
2686     if (__pyx_t_7) {
2687       __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.startPrefixMapping", __pyx_clineno, __pyx_lineno, __pyx_filename);
2688       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_1, &__pyx_t_8) < 0) __PYX_ERR(0, 69, __pyx_L5_except_error)
2689       __Pyx_GOTREF(__pyx_t_5);
2690       __Pyx_GOTREF(__pyx_t_1);
2691       __Pyx_GOTREF(__pyx_t_8);
2692
2693       /* "lxml/sax.py":70
2694  *             self._ns_mapping[prefix].append(uri)
2695  *         except KeyError:
2696  *             self._ns_mapping[prefix] = [uri]             # <<<<<<<<<<<<<<
2697  *         if prefix is None:
2698  *             self._default_ns = uri
2699  */
2700       __pyx_t_9 = PyList_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 70, __pyx_L5_except_error)
2701       __Pyx_GOTREF(__pyx_t_9);
2702       __Pyx_INCREF(__pyx_v_uri);
2703       __Pyx_GIVEREF(__pyx_v_uri);
2704       PyList_SET_ITEM(__pyx_t_9, 0, __pyx_v_uri);
2705       __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ns_mapping); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 70, __pyx_L5_except_error)
2706       __Pyx_GOTREF(__pyx_t_10);
2707       if (unlikely(PyObject_SetItem(__pyx_t_10, __pyx_v_prefix, __pyx_t_9) < 0)) __PYX_ERR(0, 70, __pyx_L5_except_error)
2708       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
2709       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
2710       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
2711       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
2712       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
2713       goto __pyx_L4_exception_handled;
2714     }
2715     goto __pyx_L5_except_error;
2716     __pyx_L5_except_error:;
2717
2718     /* "lxml/sax.py":67
2719  *     def startPrefixMapping(self, prefix, uri):
2720  *         self._new_mappings[prefix] = uri
2721  *         try:             # <<<<<<<<<<<<<<
2722  *             self._ns_mapping[prefix].append(uri)
2723  *         except KeyError:
2724  */
2725     __Pyx_XGIVEREF(__pyx_t_2);
2726     __Pyx_XGIVEREF(__pyx_t_3);
2727     __Pyx_XGIVEREF(__pyx_t_4);
2728     __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
2729     goto __pyx_L1_error;
2730     __pyx_L4_exception_handled:;
2731     __Pyx_XGIVEREF(__pyx_t_2);
2732     __Pyx_XGIVEREF(__pyx_t_3);
2733     __Pyx_XGIVEREF(__pyx_t_4);
2734     __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
2735     __pyx_L8_try_end:;
2736   }
2737
2738   /* "lxml/sax.py":71
2739  *         except KeyError:
2740  *             self._ns_mapping[prefix] = [uri]
2741  *         if prefix is None:             # <<<<<<<<<<<<<<
2742  *             self._default_ns = uri
2743  * 
2744  */
2745   __pyx_t_11 = (__pyx_v_prefix == Py_None);
2746   __pyx_t_12 = (__pyx_t_11 != 0);
2747   if (__pyx_t_12) {
2748
2749     /* "lxml/sax.py":72
2750  *             self._ns_mapping[prefix] = [uri]
2751  *         if prefix is None:
2752  *             self._default_ns = uri             # <<<<<<<<<<<<<<
2753  * 
2754  *     def endPrefixMapping(self, prefix):
2755  */
2756     if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_default_ns, __pyx_v_uri) < 0) __PYX_ERR(0, 72, __pyx_L1_error)
2757
2758     /* "lxml/sax.py":71
2759  *         except KeyError:
2760  *             self._ns_mapping[prefix] = [uri]
2761  *         if prefix is None:             # <<<<<<<<<<<<<<
2762  *             self._default_ns = uri
2763  * 
2764  */
2765   }
2766
2767   /* "lxml/sax.py":65
2768  *         pass
2769  * 
2770  *     def startPrefixMapping(self, prefix, uri):             # <<<<<<<<<<<<<<
2771  *         self._new_mappings[prefix] = uri
2772  *         try:
2773  */
2774
2775   /* function exit code */
2776   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2777   goto __pyx_L0;
2778   __pyx_L1_error:;
2779   __Pyx_XDECREF(__pyx_t_1);
2780   __Pyx_XDECREF(__pyx_t_5);
2781   __Pyx_XDECREF(__pyx_t_8);
2782   __Pyx_XDECREF(__pyx_t_9);
2783   __Pyx_XDECREF(__pyx_t_10);
2784   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.startPrefixMapping", __pyx_clineno, __pyx_lineno, __pyx_filename);
2785   __pyx_r = NULL;
2786   __pyx_L0:;
2787   __Pyx_XGIVEREF(__pyx_r);
2788   __Pyx_RefNannyFinishContext();
2789   return __pyx_r;
2790 }
2791
2792 /* "lxml/sax.py":74
2793  *             self._default_ns = uri
2794  * 
2795  *     def endPrefixMapping(self, prefix):             # <<<<<<<<<<<<<<
2796  *         ns_uri_list = self._ns_mapping[prefix]
2797  *         ns_uri_list.pop()
2798  */
2799
2800 /* Python wrapper */
2801 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_13endPrefixMapping(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2802 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_13endPrefixMapping = {"endPrefixMapping", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_13endPrefixMapping, METH_VARARGS|METH_KEYWORDS, 0};
2803 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_13endPrefixMapping(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2804   PyObject *__pyx_v_self = 0;
2805   PyObject *__pyx_v_prefix = 0;
2806   int __pyx_lineno = 0;
2807   const char *__pyx_filename = NULL;
2808   int __pyx_clineno = 0;
2809   PyObject *__pyx_r = 0;
2810   __Pyx_RefNannyDeclarations
2811   __Pyx_RefNannySetupContext("endPrefixMapping (wrapper)", 0);
2812   {
2813     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_prefix,0};
2814     PyObject* values[2] = {0,0};
2815     if (unlikely(__pyx_kwds)) {
2816       Py_ssize_t kw_args;
2817       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2818       switch (pos_args) {
2819         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2820         CYTHON_FALLTHROUGH;
2821         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2822         CYTHON_FALLTHROUGH;
2823         case  0: break;
2824         default: goto __pyx_L5_argtuple_error;
2825       }
2826       kw_args = PyDict_Size(__pyx_kwds);
2827       switch (pos_args) {
2828         case  0:
2829         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
2830         else goto __pyx_L5_argtuple_error;
2831         CYTHON_FALLTHROUGH;
2832         case  1:
2833         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prefix)) != 0)) kw_args--;
2834         else {
2835           __Pyx_RaiseArgtupleInvalid("endPrefixMapping", 1, 2, 2, 1); __PYX_ERR(0, 74, __pyx_L3_error)
2836         }
2837       }
2838       if (unlikely(kw_args > 0)) {
2839         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "endPrefixMapping") < 0)) __PYX_ERR(0, 74, __pyx_L3_error)
2840       }
2841     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
2842       goto __pyx_L5_argtuple_error;
2843     } else {
2844       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2845       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2846     }
2847     __pyx_v_self = values[0];
2848     __pyx_v_prefix = values[1];
2849   }
2850   goto __pyx_L4_argument_unpacking_done;
2851   __pyx_L5_argtuple_error:;
2852   __Pyx_RaiseArgtupleInvalid("endPrefixMapping", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 74, __pyx_L3_error)
2853   __pyx_L3_error:;
2854   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.endPrefixMapping", __pyx_clineno, __pyx_lineno, __pyx_filename);
2855   __Pyx_RefNannyFinishContext();
2856   return NULL;
2857   __pyx_L4_argument_unpacking_done:;
2858   __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_12endPrefixMapping(__pyx_self, __pyx_v_self, __pyx_v_prefix);
2859
2860   /* function exit code */
2861   __Pyx_RefNannyFinishContext();
2862   return __pyx_r;
2863 }
2864
2865 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_12endPrefixMapping(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_prefix) {
2866   PyObject *__pyx_v_ns_uri_list = NULL;
2867   PyObject *__pyx_r = NULL;
2868   __Pyx_RefNannyDeclarations
2869   PyObject *__pyx_t_1 = NULL;
2870   PyObject *__pyx_t_2 = NULL;
2871   int __pyx_t_3;
2872   int __pyx_t_4;
2873   int __pyx_lineno = 0;
2874   const char *__pyx_filename = NULL;
2875   int __pyx_clineno = 0;
2876   __Pyx_RefNannySetupContext("endPrefixMapping", 0);
2877
2878   /* "lxml/sax.py":75
2879  * 
2880  *     def endPrefixMapping(self, prefix):
2881  *         ns_uri_list = self._ns_mapping[prefix]             # <<<<<<<<<<<<<<
2882  *         ns_uri_list.pop()
2883  *         if prefix is None:
2884  */
2885   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ns_mapping); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error)
2886   __Pyx_GOTREF(__pyx_t_1);
2887   __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_prefix); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __pyx_L1_error)
2888   __Pyx_GOTREF(__pyx_t_2);
2889   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2890   __pyx_v_ns_uri_list = __pyx_t_2;
2891   __pyx_t_2 = 0;
2892
2893   /* "lxml/sax.py":76
2894  *     def endPrefixMapping(self, prefix):
2895  *         ns_uri_list = self._ns_mapping[prefix]
2896  *         ns_uri_list.pop()             # <<<<<<<<<<<<<<
2897  *         if prefix is None:
2898  *             self._default_ns = ns_uri_list[-1]
2899  */
2900   __pyx_t_2 = __Pyx_PyObject_Pop(__pyx_v_ns_uri_list); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error)
2901   __Pyx_GOTREF(__pyx_t_2);
2902   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2903
2904   /* "lxml/sax.py":77
2905  *         ns_uri_list = self._ns_mapping[prefix]
2906  *         ns_uri_list.pop()
2907  *         if prefix is None:             # <<<<<<<<<<<<<<
2908  *             self._default_ns = ns_uri_list[-1]
2909  * 
2910  */
2911   __pyx_t_3 = (__pyx_v_prefix == Py_None);
2912   __pyx_t_4 = (__pyx_t_3 != 0);
2913   if (__pyx_t_4) {
2914
2915     /* "lxml/sax.py":78
2916  *         ns_uri_list.pop()
2917  *         if prefix is None:
2918  *             self._default_ns = ns_uri_list[-1]             # <<<<<<<<<<<<<<
2919  * 
2920  *     def _buildTag(self, ns_name_tuple):
2921  */
2922     __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_ns_uri_list, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error)
2923     __Pyx_GOTREF(__pyx_t_2);
2924     if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_default_ns, __pyx_t_2) < 0) __PYX_ERR(0, 78, __pyx_L1_error)
2925     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2926
2927     /* "lxml/sax.py":77
2928  *         ns_uri_list = self._ns_mapping[prefix]
2929  *         ns_uri_list.pop()
2930  *         if prefix is None:             # <<<<<<<<<<<<<<
2931  *             self._default_ns = ns_uri_list[-1]
2932  * 
2933  */
2934   }
2935
2936   /* "lxml/sax.py":74
2937  *             self._default_ns = uri
2938  * 
2939  *     def endPrefixMapping(self, prefix):             # <<<<<<<<<<<<<<
2940  *         ns_uri_list = self._ns_mapping[prefix]
2941  *         ns_uri_list.pop()
2942  */
2943
2944   /* function exit code */
2945   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2946   goto __pyx_L0;
2947   __pyx_L1_error:;
2948   __Pyx_XDECREF(__pyx_t_1);
2949   __Pyx_XDECREF(__pyx_t_2);
2950   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.endPrefixMapping", __pyx_clineno, __pyx_lineno, __pyx_filename);
2951   __pyx_r = NULL;
2952   __pyx_L0:;
2953   __Pyx_XDECREF(__pyx_v_ns_uri_list);
2954   __Pyx_XGIVEREF(__pyx_r);
2955   __Pyx_RefNannyFinishContext();
2956   return __pyx_r;
2957 }
2958
2959 /* "lxml/sax.py":80
2960  *             self._default_ns = ns_uri_list[-1]
2961  * 
2962  *     def _buildTag(self, ns_name_tuple):             # <<<<<<<<<<<<<<
2963  *         ns_uri, local_name = ns_name_tuple
2964  *         if ns_uri:
2965  */
2966
2967 /* Python wrapper */
2968 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_15_buildTag(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2969 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_15_buildTag = {"_buildTag", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_15_buildTag, METH_VARARGS|METH_KEYWORDS, 0};
2970 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_15_buildTag(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2971   PyObject *__pyx_v_self = 0;
2972   PyObject *__pyx_v_ns_name_tuple = 0;
2973   int __pyx_lineno = 0;
2974   const char *__pyx_filename = NULL;
2975   int __pyx_clineno = 0;
2976   PyObject *__pyx_r = 0;
2977   __Pyx_RefNannyDeclarations
2978   __Pyx_RefNannySetupContext("_buildTag (wrapper)", 0);
2979   {
2980     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_ns_name_tuple,0};
2981     PyObject* values[2] = {0,0};
2982     if (unlikely(__pyx_kwds)) {
2983       Py_ssize_t kw_args;
2984       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2985       switch (pos_args) {
2986         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2987         CYTHON_FALLTHROUGH;
2988         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2989         CYTHON_FALLTHROUGH;
2990         case  0: break;
2991         default: goto __pyx_L5_argtuple_error;
2992       }
2993       kw_args = PyDict_Size(__pyx_kwds);
2994       switch (pos_args) {
2995         case  0:
2996         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
2997         else goto __pyx_L5_argtuple_error;
2998         CYTHON_FALLTHROUGH;
2999         case  1:
3000         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ns_name_tuple)) != 0)) kw_args--;
3001         else {
3002           __Pyx_RaiseArgtupleInvalid("_buildTag", 1, 2, 2, 1); __PYX_ERR(0, 80, __pyx_L3_error)
3003         }
3004       }
3005       if (unlikely(kw_args > 0)) {
3006         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_buildTag") < 0)) __PYX_ERR(0, 80, __pyx_L3_error)
3007       }
3008     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
3009       goto __pyx_L5_argtuple_error;
3010     } else {
3011       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3012       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3013     }
3014     __pyx_v_self = values[0];
3015     __pyx_v_ns_name_tuple = values[1];
3016   }
3017   goto __pyx_L4_argument_unpacking_done;
3018   __pyx_L5_argtuple_error:;
3019   __Pyx_RaiseArgtupleInvalid("_buildTag", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 80, __pyx_L3_error)
3020   __pyx_L3_error:;
3021   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler._buildTag", __pyx_clineno, __pyx_lineno, __pyx_filename);
3022   __Pyx_RefNannyFinishContext();
3023   return NULL;
3024   __pyx_L4_argument_unpacking_done:;
3025   __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_14_buildTag(__pyx_self, __pyx_v_self, __pyx_v_ns_name_tuple);
3026
3027   /* function exit code */
3028   __Pyx_RefNannyFinishContext();
3029   return __pyx_r;
3030 }
3031
3032 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_14_buildTag(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_ns_name_tuple) {
3033   PyObject *__pyx_v_ns_uri = NULL;
3034   PyObject *__pyx_v_local_name = NULL;
3035   PyObject *__pyx_v_el_tag = NULL;
3036   PyObject *__pyx_r = NULL;
3037   __Pyx_RefNannyDeclarations
3038   PyObject *__pyx_t_1 = NULL;
3039   PyObject *__pyx_t_2 = NULL;
3040   PyObject *__pyx_t_3 = NULL;
3041   PyObject *(*__pyx_t_4)(PyObject *);
3042   int __pyx_t_5;
3043   int __pyx_lineno = 0;
3044   const char *__pyx_filename = NULL;
3045   int __pyx_clineno = 0;
3046   __Pyx_RefNannySetupContext("_buildTag", 0);
3047
3048   /* "lxml/sax.py":81
3049  * 
3050  *     def _buildTag(self, ns_name_tuple):
3051  *         ns_uri, local_name = ns_name_tuple             # <<<<<<<<<<<<<<
3052  *         if ns_uri:
3053  *             el_tag = "{%s}%s" % ns_name_tuple
3054  */
3055   if ((likely(PyTuple_CheckExact(__pyx_v_ns_name_tuple))) || (PyList_CheckExact(__pyx_v_ns_name_tuple))) {
3056     PyObject* sequence = __pyx_v_ns_name_tuple;
3057     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
3058     if (unlikely(size != 2)) {
3059       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
3060       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
3061       __PYX_ERR(0, 81, __pyx_L1_error)
3062     }
3063     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3064     if (likely(PyTuple_CheckExact(sequence))) {
3065       __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
3066       __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
3067     } else {
3068       __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
3069       __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
3070     }
3071     __Pyx_INCREF(__pyx_t_1);
3072     __Pyx_INCREF(__pyx_t_2);
3073     #else
3074     __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error)
3075     __Pyx_GOTREF(__pyx_t_1);
3076     __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error)
3077     __Pyx_GOTREF(__pyx_t_2);
3078     #endif
3079   } else {
3080     Py_ssize_t index = -1;
3081     __pyx_t_3 = PyObject_GetIter(__pyx_v_ns_name_tuple); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 81, __pyx_L1_error)
3082     __Pyx_GOTREF(__pyx_t_3);
3083     __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext;
3084     index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
3085     __Pyx_GOTREF(__pyx_t_1);
3086     index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
3087     __Pyx_GOTREF(__pyx_t_2);
3088     if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < 0) __PYX_ERR(0, 81, __pyx_L1_error)
3089     __pyx_t_4 = NULL;
3090     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3091     goto __pyx_L4_unpacking_done;
3092     __pyx_L3_unpacking_failed:;
3093     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3094     __pyx_t_4 = NULL;
3095     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
3096     __PYX_ERR(0, 81, __pyx_L1_error)
3097     __pyx_L4_unpacking_done:;
3098   }
3099   __pyx_v_ns_uri = __pyx_t_1;
3100   __pyx_t_1 = 0;
3101   __pyx_v_local_name = __pyx_t_2;
3102   __pyx_t_2 = 0;
3103
3104   /* "lxml/sax.py":82
3105  *     def _buildTag(self, ns_name_tuple):
3106  *         ns_uri, local_name = ns_name_tuple
3107  *         if ns_uri:             # <<<<<<<<<<<<<<
3108  *             el_tag = "{%s}%s" % ns_name_tuple
3109  *         elif self._default_ns:
3110  */
3111   __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_ns_uri); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 82, __pyx_L1_error)
3112   if (__pyx_t_5) {
3113
3114     /* "lxml/sax.py":83
3115  *         ns_uri, local_name = ns_name_tuple
3116  *         if ns_uri:
3117  *             el_tag = "{%s}%s" % ns_name_tuple             # <<<<<<<<<<<<<<
3118  *         elif self._default_ns:
3119  *             el_tag = "{%s}%s" % (self._default_ns, local_name)
3120  */
3121     __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_s_s, __pyx_v_ns_name_tuple); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error)
3122     __Pyx_GOTREF(__pyx_t_2);
3123     __pyx_v_el_tag = __pyx_t_2;
3124     __pyx_t_2 = 0;
3125
3126     /* "lxml/sax.py":82
3127  *     def _buildTag(self, ns_name_tuple):
3128  *         ns_uri, local_name = ns_name_tuple
3129  *         if ns_uri:             # <<<<<<<<<<<<<<
3130  *             el_tag = "{%s}%s" % ns_name_tuple
3131  *         elif self._default_ns:
3132  */
3133     goto __pyx_L5;
3134   }
3135
3136   /* "lxml/sax.py":84
3137  *         if ns_uri:
3138  *             el_tag = "{%s}%s" % ns_name_tuple
3139  *         elif self._default_ns:             # <<<<<<<<<<<<<<
3140  *             el_tag = "{%s}%s" % (self._default_ns, local_name)
3141  *         else:
3142  */
3143   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_default_ns); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error)
3144   __Pyx_GOTREF(__pyx_t_2);
3145   __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 84, __pyx_L1_error)
3146   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3147   if (__pyx_t_5) {
3148
3149     /* "lxml/sax.py":85
3150  *             el_tag = "{%s}%s" % ns_name_tuple
3151  *         elif self._default_ns:
3152  *             el_tag = "{%s}%s" % (self._default_ns, local_name)             # <<<<<<<<<<<<<<
3153  *         else:
3154  *             el_tag = local_name
3155  */
3156     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_default_ns); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error)
3157     __Pyx_GOTREF(__pyx_t_2);
3158     __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error)
3159     __Pyx_GOTREF(__pyx_t_1);
3160     __Pyx_GIVEREF(__pyx_t_2);
3161     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
3162     __Pyx_INCREF(__pyx_v_local_name);
3163     __Pyx_GIVEREF(__pyx_v_local_name);
3164     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_local_name);
3165     __pyx_t_2 = 0;
3166     __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_s_s, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error)
3167     __Pyx_GOTREF(__pyx_t_2);
3168     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3169     __pyx_v_el_tag = __pyx_t_2;
3170     __pyx_t_2 = 0;
3171
3172     /* "lxml/sax.py":84
3173  *         if ns_uri:
3174  *             el_tag = "{%s}%s" % ns_name_tuple
3175  *         elif self._default_ns:             # <<<<<<<<<<<<<<
3176  *             el_tag = "{%s}%s" % (self._default_ns, local_name)
3177  *         else:
3178  */
3179     goto __pyx_L5;
3180   }
3181
3182   /* "lxml/sax.py":87
3183  *             el_tag = "{%s}%s" % (self._default_ns, local_name)
3184  *         else:
3185  *             el_tag = local_name             # <<<<<<<<<<<<<<
3186  *         return el_tag
3187  * 
3188  */
3189   /*else*/ {
3190     __Pyx_INCREF(__pyx_v_local_name);
3191     __pyx_v_el_tag = __pyx_v_local_name;
3192   }
3193   __pyx_L5:;
3194
3195   /* "lxml/sax.py":88
3196  *         else:
3197  *             el_tag = local_name
3198  *         return el_tag             # <<<<<<<<<<<<<<
3199  * 
3200  *     def startElementNS(self, ns_name, qname, attributes=None):
3201  */
3202   __Pyx_XDECREF(__pyx_r);
3203   __Pyx_INCREF(__pyx_v_el_tag);
3204   __pyx_r = __pyx_v_el_tag;
3205   goto __pyx_L0;
3206
3207   /* "lxml/sax.py":80
3208  *             self._default_ns = ns_uri_list[-1]
3209  * 
3210  *     def _buildTag(self, ns_name_tuple):             # <<<<<<<<<<<<<<
3211  *         ns_uri, local_name = ns_name_tuple
3212  *         if ns_uri:
3213  */
3214
3215   /* function exit code */
3216   __pyx_L1_error:;
3217   __Pyx_XDECREF(__pyx_t_1);
3218   __Pyx_XDECREF(__pyx_t_2);
3219   __Pyx_XDECREF(__pyx_t_3);
3220   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler._buildTag", __pyx_clineno, __pyx_lineno, __pyx_filename);
3221   __pyx_r = NULL;
3222   __pyx_L0:;
3223   __Pyx_XDECREF(__pyx_v_ns_uri);
3224   __Pyx_XDECREF(__pyx_v_local_name);
3225   __Pyx_XDECREF(__pyx_v_el_tag);
3226   __Pyx_XGIVEREF(__pyx_r);
3227   __Pyx_RefNannyFinishContext();
3228   return __pyx_r;
3229 }
3230
3231 /* "lxml/sax.py":90
3232  *         return el_tag
3233  * 
3234  *     def startElementNS(self, ns_name, qname, attributes=None):             # <<<<<<<<<<<<<<
3235  *         el_name = self._buildTag(ns_name)
3236  *         if attributes:
3237  */
3238
3239 /* Python wrapper */
3240 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_17startElementNS(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3241 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_17startElementNS = {"startElementNS", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_17startElementNS, METH_VARARGS|METH_KEYWORDS, 0};
3242 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_17startElementNS(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3243   PyObject *__pyx_v_self = 0;
3244   PyObject *__pyx_v_ns_name = 0;
3245   CYTHON_UNUSED PyObject *__pyx_v_qname = 0;
3246   PyObject *__pyx_v_attributes = 0;
3247   int __pyx_lineno = 0;
3248   const char *__pyx_filename = NULL;
3249   int __pyx_clineno = 0;
3250   PyObject *__pyx_r = 0;
3251   __Pyx_RefNannyDeclarations
3252   __Pyx_RefNannySetupContext("startElementNS (wrapper)", 0);
3253   {
3254     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_ns_name,&__pyx_n_s_qname,&__pyx_n_s_attributes,0};
3255     PyObject* values[4] = {0,0,0,0};
3256     values[3] = ((PyObject *)((PyObject *)Py_None));
3257     if (unlikely(__pyx_kwds)) {
3258       Py_ssize_t kw_args;
3259       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3260       switch (pos_args) {
3261         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3262         CYTHON_FALLTHROUGH;
3263         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3264         CYTHON_FALLTHROUGH;
3265         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3266         CYTHON_FALLTHROUGH;
3267         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3268         CYTHON_FALLTHROUGH;
3269         case  0: break;
3270         default: goto __pyx_L5_argtuple_error;
3271       }
3272       kw_args = PyDict_Size(__pyx_kwds);
3273       switch (pos_args) {
3274         case  0:
3275         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
3276         else goto __pyx_L5_argtuple_error;
3277         CYTHON_FALLTHROUGH;
3278         case  1:
3279         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ns_name)) != 0)) kw_args--;
3280         else {
3281           __Pyx_RaiseArgtupleInvalid("startElementNS", 0, 3, 4, 1); __PYX_ERR(0, 90, __pyx_L3_error)
3282         }
3283         CYTHON_FALLTHROUGH;
3284         case  2:
3285         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_qname)) != 0)) kw_args--;
3286         else {
3287           __Pyx_RaiseArgtupleInvalid("startElementNS", 0, 3, 4, 2); __PYX_ERR(0, 90, __pyx_L3_error)
3288         }
3289         CYTHON_FALLTHROUGH;
3290         case  3:
3291         if (kw_args > 0) {
3292           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_attributes);
3293           if (value) { values[3] = value; kw_args--; }
3294         }
3295       }
3296       if (unlikely(kw_args > 0)) {
3297         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "startElementNS") < 0)) __PYX_ERR(0, 90, __pyx_L3_error)
3298       }
3299     } else {
3300       switch (PyTuple_GET_SIZE(__pyx_args)) {
3301         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3302         CYTHON_FALLTHROUGH;
3303         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3304         values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3305         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3306         break;
3307         default: goto __pyx_L5_argtuple_error;
3308       }
3309     }
3310     __pyx_v_self = values[0];
3311     __pyx_v_ns_name = values[1];
3312     __pyx_v_qname = values[2];
3313     __pyx_v_attributes = values[3];
3314   }
3315   goto __pyx_L4_argument_unpacking_done;
3316   __pyx_L5_argtuple_error:;
3317   __Pyx_RaiseArgtupleInvalid("startElementNS", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 90, __pyx_L3_error)
3318   __pyx_L3_error:;
3319   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.startElementNS", __pyx_clineno, __pyx_lineno, __pyx_filename);
3320   __Pyx_RefNannyFinishContext();
3321   return NULL;
3322   __pyx_L4_argument_unpacking_done:;
3323   __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_16startElementNS(__pyx_self, __pyx_v_self, __pyx_v_ns_name, __pyx_v_qname, __pyx_v_attributes);
3324
3325   /* function exit code */
3326   __Pyx_RefNannyFinishContext();
3327   return __pyx_r;
3328 }
3329
3330 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_16startElementNS(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_ns_name, CYTHON_UNUSED PyObject *__pyx_v_qname, PyObject *__pyx_v_attributes) {
3331   PyObject *__pyx_v_el_name = NULL;
3332   PyObject *__pyx_v_attrs = NULL;
3333   PyObject *__pyx_v_iter_attributes = NULL;
3334   PyObject *__pyx_v_name_tuple = NULL;
3335   PyObject *__pyx_v_value = NULL;
3336   PyObject *__pyx_v_attr_name = NULL;
3337   PyObject *__pyx_v_element_stack = NULL;
3338   PyObject *__pyx_v_element = NULL;
3339   PyObject *__pyx_v_sibling = NULL;
3340   PyObject *__pyx_r = NULL;
3341   __Pyx_RefNannyDeclarations
3342   PyObject *__pyx_t_1 = NULL;
3343   PyObject *__pyx_t_2 = NULL;
3344   PyObject *__pyx_t_3 = NULL;
3345   int __pyx_t_4;
3346   PyObject *__pyx_t_5 = NULL;
3347   PyObject *__pyx_t_6 = NULL;
3348   PyObject *__pyx_t_7 = NULL;
3349   int __pyx_t_8;
3350   PyObject *__pyx_t_9 = NULL;
3351   PyObject *__pyx_t_10 = NULL;
3352   PyObject *__pyx_t_11 = NULL;
3353   Py_ssize_t __pyx_t_12;
3354   PyObject *(*__pyx_t_13)(PyObject *);
3355   PyObject *(*__pyx_t_14)(PyObject *);
3356   int __pyx_t_15;
3357   int __pyx_t_16;
3358   int __pyx_t_17;
3359   int __pyx_lineno = 0;
3360   const char *__pyx_filename = NULL;
3361   int __pyx_clineno = 0;
3362   __Pyx_RefNannySetupContext("startElementNS", 0);
3363
3364   /* "lxml/sax.py":91
3365  * 
3366  *     def startElementNS(self, ns_name, qname, attributes=None):
3367  *         el_name = self._buildTag(ns_name)             # <<<<<<<<<<<<<<
3368  *         if attributes:
3369  *             attrs = {}
3370  */
3371   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_buildTag); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error)
3372   __Pyx_GOTREF(__pyx_t_2);
3373   __pyx_t_3 = NULL;
3374   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
3375     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
3376     if (likely(__pyx_t_3)) {
3377       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3378       __Pyx_INCREF(__pyx_t_3);
3379       __Pyx_INCREF(function);
3380       __Pyx_DECREF_SET(__pyx_t_2, function);
3381     }
3382   }
3383   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_ns_name) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_ns_name);
3384   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3385   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error)
3386   __Pyx_GOTREF(__pyx_t_1);
3387   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3388   __pyx_v_el_name = __pyx_t_1;
3389   __pyx_t_1 = 0;
3390
3391   /* "lxml/sax.py":92
3392  *     def startElementNS(self, ns_name, qname, attributes=None):
3393  *         el_name = self._buildTag(ns_name)
3394  *         if attributes:             # <<<<<<<<<<<<<<
3395  *             attrs = {}
3396  *             try:
3397  */
3398   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_attributes); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 92, __pyx_L1_error)
3399   if (__pyx_t_4) {
3400
3401     /* "lxml/sax.py":93
3402  *         el_name = self._buildTag(ns_name)
3403  *         if attributes:
3404  *             attrs = {}             # <<<<<<<<<<<<<<
3405  *             try:
3406  *                 iter_attributes = attributes.iteritems()
3407  */
3408     __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error)
3409     __Pyx_GOTREF(__pyx_t_1);
3410     __pyx_v_attrs = ((PyObject*)__pyx_t_1);
3411     __pyx_t_1 = 0;
3412
3413     /* "lxml/sax.py":94
3414  *         if attributes:
3415  *             attrs = {}
3416  *             try:             # <<<<<<<<<<<<<<
3417  *                 iter_attributes = attributes.iteritems()
3418  *             except AttributeError:
3419  */
3420     {
3421       __Pyx_PyThreadState_declare
3422       __Pyx_PyThreadState_assign
3423       __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
3424       __Pyx_XGOTREF(__pyx_t_5);
3425       __Pyx_XGOTREF(__pyx_t_6);
3426       __Pyx_XGOTREF(__pyx_t_7);
3427       /*try:*/ {
3428
3429         /* "lxml/sax.py":95
3430  *             attrs = {}
3431  *             try:
3432  *                 iter_attributes = attributes.iteritems()             # <<<<<<<<<<<<<<
3433  *             except AttributeError:
3434  *                 iter_attributes = attributes.items()
3435  */
3436         __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_attributes, __pyx_n_s_iteritems); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L4_error)
3437         __Pyx_GOTREF(__pyx_t_2);
3438         __pyx_t_3 = NULL;
3439         if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
3440           __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
3441           if (likely(__pyx_t_3)) {
3442             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3443             __Pyx_INCREF(__pyx_t_3);
3444             __Pyx_INCREF(function);
3445             __Pyx_DECREF_SET(__pyx_t_2, function);
3446           }
3447         }
3448         __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
3449         __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3450         if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 95, __pyx_L4_error)
3451         __Pyx_GOTREF(__pyx_t_1);
3452         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3453         __pyx_v_iter_attributes = __pyx_t_1;
3454         __pyx_t_1 = 0;
3455
3456         /* "lxml/sax.py":94
3457  *         if attributes:
3458  *             attrs = {}
3459  *             try:             # <<<<<<<<<<<<<<
3460  *                 iter_attributes = attributes.iteritems()
3461  *             except AttributeError:
3462  */
3463       }
3464       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3465       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
3466       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
3467       goto __pyx_L9_try_end;
3468       __pyx_L4_error:;
3469       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3470       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
3471       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3472
3473       /* "lxml/sax.py":96
3474  *             try:
3475  *                 iter_attributes = attributes.iteritems()
3476  *             except AttributeError:             # <<<<<<<<<<<<<<
3477  *                 iter_attributes = attributes.items()
3478  * 
3479  */
3480       __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
3481       if (__pyx_t_8) {
3482         __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.startElementNS", __pyx_clineno, __pyx_lineno, __pyx_filename);
3483         if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 96, __pyx_L6_except_error)
3484         __Pyx_GOTREF(__pyx_t_1);
3485         __Pyx_GOTREF(__pyx_t_2);
3486         __Pyx_GOTREF(__pyx_t_3);
3487
3488         /* "lxml/sax.py":97
3489  *                 iter_attributes = attributes.iteritems()
3490  *             except AttributeError:
3491  *                 iter_attributes = attributes.items()             # <<<<<<<<<<<<<<
3492  * 
3493  *             for name_tuple, value in iter_attributes:
3494  */
3495         __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_attributes, __pyx_n_s_items); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 97, __pyx_L6_except_error)
3496         __Pyx_GOTREF(__pyx_t_10);
3497         __pyx_t_11 = NULL;
3498         if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
3499           __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
3500           if (likely(__pyx_t_11)) {
3501             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
3502             __Pyx_INCREF(__pyx_t_11);
3503             __Pyx_INCREF(function);
3504             __Pyx_DECREF_SET(__pyx_t_10, function);
3505           }
3506         }
3507         __pyx_t_9 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_10);
3508         __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
3509         if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 97, __pyx_L6_except_error)
3510         __Pyx_GOTREF(__pyx_t_9);
3511         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3512         __Pyx_XDECREF_SET(__pyx_v_iter_attributes, __pyx_t_9);
3513         __pyx_t_9 = 0;
3514         __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3515         __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
3516         __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3517         goto __pyx_L5_exception_handled;
3518       }
3519       goto __pyx_L6_except_error;
3520       __pyx_L6_except_error:;
3521
3522       /* "lxml/sax.py":94
3523  *         if attributes:
3524  *             attrs = {}
3525  *             try:             # <<<<<<<<<<<<<<
3526  *                 iter_attributes = attributes.iteritems()
3527  *             except AttributeError:
3528  */
3529       __Pyx_XGIVEREF(__pyx_t_5);
3530       __Pyx_XGIVEREF(__pyx_t_6);
3531       __Pyx_XGIVEREF(__pyx_t_7);
3532       __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
3533       goto __pyx_L1_error;
3534       __pyx_L5_exception_handled:;
3535       __Pyx_XGIVEREF(__pyx_t_5);
3536       __Pyx_XGIVEREF(__pyx_t_6);
3537       __Pyx_XGIVEREF(__pyx_t_7);
3538       __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
3539       __pyx_L9_try_end:;
3540     }
3541
3542     /* "lxml/sax.py":99
3543  *                 iter_attributes = attributes.items()
3544  * 
3545  *             for name_tuple, value in iter_attributes:             # <<<<<<<<<<<<<<
3546  *                 if name_tuple[0]:
3547  *                     attr_name = "{%s}%s" % name_tuple
3548  */
3549     if (likely(PyList_CheckExact(__pyx_v_iter_attributes)) || PyTuple_CheckExact(__pyx_v_iter_attributes)) {
3550       __pyx_t_3 = __pyx_v_iter_attributes; __Pyx_INCREF(__pyx_t_3); __pyx_t_12 = 0;
3551       __pyx_t_13 = NULL;
3552     } else {
3553       __pyx_t_12 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_iter_attributes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 99, __pyx_L1_error)
3554       __Pyx_GOTREF(__pyx_t_3);
3555       __pyx_t_13 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 99, __pyx_L1_error)
3556     }
3557     for (;;) {
3558       if (likely(!__pyx_t_13)) {
3559         if (likely(PyList_CheckExact(__pyx_t_3))) {
3560           if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_3)) break;
3561           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3562           __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 99, __pyx_L1_error)
3563           #else
3564           __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error)
3565           __Pyx_GOTREF(__pyx_t_2);
3566           #endif
3567         } else {
3568           if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
3569           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3570           __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 99, __pyx_L1_error)
3571           #else
3572           __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error)
3573           __Pyx_GOTREF(__pyx_t_2);
3574           #endif
3575         }
3576       } else {
3577         __pyx_t_2 = __pyx_t_13(__pyx_t_3);
3578         if (unlikely(!__pyx_t_2)) {
3579           PyObject* exc_type = PyErr_Occurred();
3580           if (exc_type) {
3581             if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3582             else __PYX_ERR(0, 99, __pyx_L1_error)
3583           }
3584           break;
3585         }
3586         __Pyx_GOTREF(__pyx_t_2);
3587       }
3588       if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
3589         PyObject* sequence = __pyx_t_2;
3590         Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
3591         if (unlikely(size != 2)) {
3592           if (size > 2) __Pyx_RaiseTooManyValuesError(2);
3593           else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
3594           __PYX_ERR(0, 99, __pyx_L1_error)
3595         }
3596         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3597         if (likely(PyTuple_CheckExact(sequence))) {
3598           __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
3599           __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
3600         } else {
3601           __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
3602           __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
3603         }
3604         __Pyx_INCREF(__pyx_t_1);
3605         __Pyx_INCREF(__pyx_t_9);
3606         #else
3607         __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error)
3608         __Pyx_GOTREF(__pyx_t_1);
3609         __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 99, __pyx_L1_error)
3610         __Pyx_GOTREF(__pyx_t_9);
3611         #endif
3612         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3613       } else {
3614         Py_ssize_t index = -1;
3615         __pyx_t_10 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 99, __pyx_L1_error)
3616         __Pyx_GOTREF(__pyx_t_10);
3617         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3618         __pyx_t_14 = Py_TYPE(__pyx_t_10)->tp_iternext;
3619         index = 0; __pyx_t_1 = __pyx_t_14(__pyx_t_10); if (unlikely(!__pyx_t_1)) goto __pyx_L14_unpacking_failed;
3620         __Pyx_GOTREF(__pyx_t_1);
3621         index = 1; __pyx_t_9 = __pyx_t_14(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L14_unpacking_failed;
3622         __Pyx_GOTREF(__pyx_t_9);
3623         if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_10), 2) < 0) __PYX_ERR(0, 99, __pyx_L1_error)
3624         __pyx_t_14 = NULL;
3625         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3626         goto __pyx_L15_unpacking_done;
3627         __pyx_L14_unpacking_failed:;
3628         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3629         __pyx_t_14 = NULL;
3630         if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
3631         __PYX_ERR(0, 99, __pyx_L1_error)
3632         __pyx_L15_unpacking_done:;
3633       }
3634       __Pyx_XDECREF_SET(__pyx_v_name_tuple, __pyx_t_1);
3635       __pyx_t_1 = 0;
3636       __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_9);
3637       __pyx_t_9 = 0;
3638
3639       /* "lxml/sax.py":100
3640  * 
3641  *             for name_tuple, value in iter_attributes:
3642  *                 if name_tuple[0]:             # <<<<<<<<<<<<<<
3643  *                     attr_name = "{%s}%s" % name_tuple
3644  *                 else:
3645  */
3646       __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_name_tuple, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 100, __pyx_L1_error)
3647       __Pyx_GOTREF(__pyx_t_2);
3648       __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 100, __pyx_L1_error)
3649       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3650       if (__pyx_t_4) {
3651
3652         /* "lxml/sax.py":101
3653  *             for name_tuple, value in iter_attributes:
3654  *                 if name_tuple[0]:
3655  *                     attr_name = "{%s}%s" % name_tuple             # <<<<<<<<<<<<<<
3656  *                 else:
3657  *                     attr_name = name_tuple[1]
3658  */
3659         __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_s_s, __pyx_v_name_tuple); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 101, __pyx_L1_error)
3660         __Pyx_GOTREF(__pyx_t_2);
3661         __Pyx_XDECREF_SET(__pyx_v_attr_name, __pyx_t_2);
3662         __pyx_t_2 = 0;
3663
3664         /* "lxml/sax.py":100
3665  * 
3666  *             for name_tuple, value in iter_attributes:
3667  *                 if name_tuple[0]:             # <<<<<<<<<<<<<<
3668  *                     attr_name = "{%s}%s" % name_tuple
3669  *                 else:
3670  */
3671         goto __pyx_L16;
3672       }
3673
3674       /* "lxml/sax.py":103
3675  *                     attr_name = "{%s}%s" % name_tuple
3676  *                 else:
3677  *                     attr_name = name_tuple[1]             # <<<<<<<<<<<<<<
3678  *                 attrs[attr_name] = value
3679  *         else:
3680  */
3681       /*else*/ {
3682         __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_name_tuple, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 103, __pyx_L1_error)
3683         __Pyx_GOTREF(__pyx_t_2);
3684         __Pyx_XDECREF_SET(__pyx_v_attr_name, __pyx_t_2);
3685         __pyx_t_2 = 0;
3686       }
3687       __pyx_L16:;
3688
3689       /* "lxml/sax.py":104
3690  *                 else:
3691  *                     attr_name = name_tuple[1]
3692  *                 attrs[attr_name] = value             # <<<<<<<<<<<<<<
3693  *         else:
3694  *             attrs = None
3695  */
3696       if (unlikely(PyDict_SetItem(__pyx_v_attrs, __pyx_v_attr_name, __pyx_v_value) < 0)) __PYX_ERR(0, 104, __pyx_L1_error)
3697
3698       /* "lxml/sax.py":99
3699  *                 iter_attributes = attributes.items()
3700  * 
3701  *             for name_tuple, value in iter_attributes:             # <<<<<<<<<<<<<<
3702  *                 if name_tuple[0]:
3703  *                     attr_name = "{%s}%s" % name_tuple
3704  */
3705     }
3706     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3707
3708     /* "lxml/sax.py":92
3709  *     def startElementNS(self, ns_name, qname, attributes=None):
3710  *         el_name = self._buildTag(ns_name)
3711  *         if attributes:             # <<<<<<<<<<<<<<
3712  *             attrs = {}
3713  *             try:
3714  */
3715     goto __pyx_L3;
3716   }
3717
3718   /* "lxml/sax.py":106
3719  *                 attrs[attr_name] = value
3720  *         else:
3721  *             attrs = None             # <<<<<<<<<<<<<<
3722  * 
3723  *         element_stack = self._element_stack
3724  */
3725   /*else*/ {
3726     __Pyx_INCREF(Py_None);
3727     __pyx_v_attrs = ((PyObject*)Py_None);
3728   }
3729   __pyx_L3:;
3730
3731   /* "lxml/sax.py":108
3732  *             attrs = None
3733  * 
3734  *         element_stack = self._element_stack             # <<<<<<<<<<<<<<
3735  *         if self._root is None:
3736  *             element = self._root = \
3737  */
3738   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_element_stack); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 108, __pyx_L1_error)
3739   __Pyx_GOTREF(__pyx_t_3);
3740   __pyx_v_element_stack = __pyx_t_3;
3741   __pyx_t_3 = 0;
3742
3743   /* "lxml/sax.py":109
3744  * 
3745  *         element_stack = self._element_stack
3746  *         if self._root is None:             # <<<<<<<<<<<<<<
3747  *             element = self._root = \
3748  *                       self._makeelement(el_name, attrs, self._new_mappings)
3749  */
3750   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_root); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 109, __pyx_L1_error)
3751   __Pyx_GOTREF(__pyx_t_3);
3752   __pyx_t_4 = (__pyx_t_3 == Py_None);
3753   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3754   __pyx_t_15 = (__pyx_t_4 != 0);
3755   if (__pyx_t_15) {
3756
3757     /* "lxml/sax.py":111
3758  *         if self._root is None:
3759  *             element = self._root = \
3760  *                       self._makeelement(el_name, attrs, self._new_mappings)             # <<<<<<<<<<<<<<
3761  *             if self._root_siblings and hasattr(element, 'addprevious'):
3762  *                 for sibling in self._root_siblings:
3763  */
3764     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_makeelement_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 111, __pyx_L1_error)
3765     __Pyx_GOTREF(__pyx_t_2);
3766     __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_new_mappings); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 111, __pyx_L1_error)
3767     __Pyx_GOTREF(__pyx_t_9);
3768     __pyx_t_1 = NULL;
3769     __pyx_t_8 = 0;
3770     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
3771       __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
3772       if (likely(__pyx_t_1)) {
3773         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3774         __Pyx_INCREF(__pyx_t_1);
3775         __Pyx_INCREF(function);
3776         __Pyx_DECREF_SET(__pyx_t_2, function);
3777         __pyx_t_8 = 1;
3778       }
3779     }
3780     #if CYTHON_FAST_PYCALL
3781     if (PyFunction_Check(__pyx_t_2)) {
3782       PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_v_el_name, __pyx_v_attrs, __pyx_t_9};
3783       __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 111, __pyx_L1_error)
3784       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3785       __Pyx_GOTREF(__pyx_t_3);
3786       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3787     } else
3788     #endif
3789     #if CYTHON_FAST_PYCCALL
3790     if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
3791       PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_v_el_name, __pyx_v_attrs, __pyx_t_9};
3792       __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 111, __pyx_L1_error)
3793       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3794       __Pyx_GOTREF(__pyx_t_3);
3795       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3796     } else
3797     #endif
3798     {
3799       __pyx_t_10 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 111, __pyx_L1_error)
3800       __Pyx_GOTREF(__pyx_t_10);
3801       if (__pyx_t_1) {
3802         __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); __pyx_t_1 = NULL;
3803       }
3804       __Pyx_INCREF(__pyx_v_el_name);
3805       __Pyx_GIVEREF(__pyx_v_el_name);
3806       PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_8, __pyx_v_el_name);
3807       __Pyx_INCREF(__pyx_v_attrs);
3808       __Pyx_GIVEREF(__pyx_v_attrs);
3809       PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_8, __pyx_v_attrs);
3810       __Pyx_GIVEREF(__pyx_t_9);
3811       PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_8, __pyx_t_9);
3812       __pyx_t_9 = 0;
3813       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 111, __pyx_L1_error)
3814       __Pyx_GOTREF(__pyx_t_3);
3815       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3816     }
3817     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3818     __Pyx_INCREF(__pyx_t_3);
3819     __pyx_v_element = __pyx_t_3;
3820
3821     /* "lxml/sax.py":110
3822  *         element_stack = self._element_stack
3823  *         if self._root is None:
3824  *             element = self._root = \             # <<<<<<<<<<<<<<
3825  *                       self._makeelement(el_name, attrs, self._new_mappings)
3826  *             if self._root_siblings and hasattr(element, 'addprevious'):
3827  */
3828     if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_root, __pyx_t_3) < 0) __PYX_ERR(0, 110, __pyx_L1_error)
3829     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3830
3831     /* "lxml/sax.py":112
3832  *             element = self._root = \
3833  *                       self._makeelement(el_name, attrs, self._new_mappings)
3834  *             if self._root_siblings and hasattr(element, 'addprevious'):             # <<<<<<<<<<<<<<
3835  *                 for sibling in self._root_siblings:
3836  *                     element.addprevious(sibling)
3837  */
3838     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_root_siblings); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 112, __pyx_L1_error)
3839     __Pyx_GOTREF(__pyx_t_3);
3840     __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 112, __pyx_L1_error)
3841     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3842     if (__pyx_t_4) {
3843     } else {
3844       __pyx_t_15 = __pyx_t_4;
3845       goto __pyx_L19_bool_binop_done;
3846     }
3847     __pyx_t_4 = __Pyx_HasAttr(__pyx_v_element, __pyx_n_s_addprevious); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 112, __pyx_L1_error)
3848     __pyx_t_16 = (__pyx_t_4 != 0);
3849     __pyx_t_15 = __pyx_t_16;
3850     __pyx_L19_bool_binop_done:;
3851     if (__pyx_t_15) {
3852
3853       /* "lxml/sax.py":113
3854  *                       self._makeelement(el_name, attrs, self._new_mappings)
3855  *             if self._root_siblings and hasattr(element, 'addprevious'):
3856  *                 for sibling in self._root_siblings:             # <<<<<<<<<<<<<<
3857  *                     element.addprevious(sibling)
3858  *             del self._root_siblings[:]
3859  */
3860       __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_root_siblings); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 113, __pyx_L1_error)
3861       __Pyx_GOTREF(__pyx_t_3);
3862       if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
3863         __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_12 = 0;
3864         __pyx_t_13 = NULL;
3865       } else {
3866         __pyx_t_12 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 113, __pyx_L1_error)
3867         __Pyx_GOTREF(__pyx_t_2);
3868         __pyx_t_13 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 113, __pyx_L1_error)
3869       }
3870       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3871       for (;;) {
3872         if (likely(!__pyx_t_13)) {
3873           if (likely(PyList_CheckExact(__pyx_t_2))) {
3874             if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_2)) break;
3875             #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3876             __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_12); __Pyx_INCREF(__pyx_t_3); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 113, __pyx_L1_error)
3877             #else
3878             __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 113, __pyx_L1_error)
3879             __Pyx_GOTREF(__pyx_t_3);
3880             #endif
3881           } else {
3882             if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
3883             #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3884             __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_12); __Pyx_INCREF(__pyx_t_3); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 113, __pyx_L1_error)
3885             #else
3886             __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 113, __pyx_L1_error)
3887             __Pyx_GOTREF(__pyx_t_3);
3888             #endif
3889           }
3890         } else {
3891           __pyx_t_3 = __pyx_t_13(__pyx_t_2);
3892           if (unlikely(!__pyx_t_3)) {
3893             PyObject* exc_type = PyErr_Occurred();
3894             if (exc_type) {
3895               if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3896               else __PYX_ERR(0, 113, __pyx_L1_error)
3897             }
3898             break;
3899           }
3900           __Pyx_GOTREF(__pyx_t_3);
3901         }
3902         __Pyx_XDECREF_SET(__pyx_v_sibling, __pyx_t_3);
3903         __pyx_t_3 = 0;
3904
3905         /* "lxml/sax.py":114
3906  *             if self._root_siblings and hasattr(element, 'addprevious'):
3907  *                 for sibling in self._root_siblings:
3908  *                     element.addprevious(sibling)             # <<<<<<<<<<<<<<
3909  *             del self._root_siblings[:]
3910  *         else:
3911  */
3912         __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_element, __pyx_n_s_addprevious); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 114, __pyx_L1_error)
3913         __Pyx_GOTREF(__pyx_t_10);
3914         __pyx_t_9 = NULL;
3915         if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
3916           __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
3917           if (likely(__pyx_t_9)) {
3918             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
3919             __Pyx_INCREF(__pyx_t_9);
3920             __Pyx_INCREF(function);
3921             __Pyx_DECREF_SET(__pyx_t_10, function);
3922           }
3923         }
3924         __pyx_t_3 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_9, __pyx_v_sibling) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_sibling);
3925         __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
3926         if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 114, __pyx_L1_error)
3927         __Pyx_GOTREF(__pyx_t_3);
3928         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3929         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3930
3931         /* "lxml/sax.py":113
3932  *                       self._makeelement(el_name, attrs, self._new_mappings)
3933  *             if self._root_siblings and hasattr(element, 'addprevious'):
3934  *                 for sibling in self._root_siblings:             # <<<<<<<<<<<<<<
3935  *                     element.addprevious(sibling)
3936  *             del self._root_siblings[:]
3937  */
3938       }
3939       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3940
3941       /* "lxml/sax.py":112
3942  *             element = self._root = \
3943  *                       self._makeelement(el_name, attrs, self._new_mappings)
3944  *             if self._root_siblings and hasattr(element, 'addprevious'):             # <<<<<<<<<<<<<<
3945  *                 for sibling in self._root_siblings:
3946  *                     element.addprevious(sibling)
3947  */
3948     }
3949
3950     /* "lxml/sax.py":115
3951  *                 for sibling in self._root_siblings:
3952  *                     element.addprevious(sibling)
3953  *             del self._root_siblings[:]             # <<<<<<<<<<<<<<
3954  *         else:
3955  *             element = SubElement(element_stack[-1], el_name,
3956  */
3957     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_root_siblings); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 115, __pyx_L1_error)
3958     __Pyx_GOTREF(__pyx_t_2);
3959     if (__Pyx_PyObject_DelSlice(__pyx_t_2, 0, 0, NULL, NULL, &__pyx_slice__5, 0, 0, 1) < 0) __PYX_ERR(0, 115, __pyx_L1_error)
3960     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3961
3962     /* "lxml/sax.py":109
3963  * 
3964  *         element_stack = self._element_stack
3965  *         if self._root is None:             # <<<<<<<<<<<<<<
3966  *             element = self._root = \
3967  *                       self._makeelement(el_name, attrs, self._new_mappings)
3968  */
3969     goto __pyx_L17;
3970   }
3971
3972   /* "lxml/sax.py":117
3973  *             del self._root_siblings[:]
3974  *         else:
3975  *             element = SubElement(element_stack[-1], el_name,             # <<<<<<<<<<<<<<
3976  *                                  attrs, self._new_mappings)
3977  *         element_stack.append(element)
3978  */
3979   /*else*/ {
3980     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_SubElement); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 117, __pyx_L1_error)
3981     __Pyx_GOTREF(__pyx_t_3);
3982     __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_element_stack, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 117, __pyx_L1_error)
3983     __Pyx_GOTREF(__pyx_t_10);
3984
3985     /* "lxml/sax.py":118
3986  *         else:
3987  *             element = SubElement(element_stack[-1], el_name,
3988  *                                  attrs, self._new_mappings)             # <<<<<<<<<<<<<<
3989  *         element_stack.append(element)
3990  * 
3991  */
3992     __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_new_mappings); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 118, __pyx_L1_error)
3993     __Pyx_GOTREF(__pyx_t_9);
3994     __pyx_t_1 = NULL;
3995     __pyx_t_8 = 0;
3996     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
3997       __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
3998       if (likely(__pyx_t_1)) {
3999         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
4000         __Pyx_INCREF(__pyx_t_1);
4001         __Pyx_INCREF(function);
4002         __Pyx_DECREF_SET(__pyx_t_3, function);
4003         __pyx_t_8 = 1;
4004       }
4005     }
4006     #if CYTHON_FAST_PYCALL
4007     if (PyFunction_Check(__pyx_t_3)) {
4008       PyObject *__pyx_temp[5] = {__pyx_t_1, __pyx_t_10, __pyx_v_el_name, __pyx_v_attrs, __pyx_t_9};
4009       __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __pyx_L1_error)
4010       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
4011       __Pyx_GOTREF(__pyx_t_2);
4012       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4013       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
4014     } else
4015     #endif
4016     #if CYTHON_FAST_PYCCALL
4017     if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
4018       PyObject *__pyx_temp[5] = {__pyx_t_1, __pyx_t_10, __pyx_v_el_name, __pyx_v_attrs, __pyx_t_9};
4019       __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __pyx_L1_error)
4020       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
4021       __Pyx_GOTREF(__pyx_t_2);
4022       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4023       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
4024     } else
4025     #endif
4026     {
4027       __pyx_t_11 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 117, __pyx_L1_error)
4028       __Pyx_GOTREF(__pyx_t_11);
4029       if (__pyx_t_1) {
4030         __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1); __pyx_t_1 = NULL;
4031       }
4032       __Pyx_GIVEREF(__pyx_t_10);
4033       PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_8, __pyx_t_10);
4034       __Pyx_INCREF(__pyx_v_el_name);
4035       __Pyx_GIVEREF(__pyx_v_el_name);
4036       PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_8, __pyx_v_el_name);
4037       __Pyx_INCREF(__pyx_v_attrs);
4038       __Pyx_GIVEREF(__pyx_v_attrs);
4039       PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_8, __pyx_v_attrs);
4040       __Pyx_GIVEREF(__pyx_t_9);
4041       PyTuple_SET_ITEM(__pyx_t_11, 3+__pyx_t_8, __pyx_t_9);
4042       __pyx_t_10 = 0;
4043       __pyx_t_9 = 0;
4044       __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __pyx_L1_error)
4045       __Pyx_GOTREF(__pyx_t_2);
4046       __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
4047     }
4048     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4049     __pyx_v_element = __pyx_t_2;
4050     __pyx_t_2 = 0;
4051   }
4052   __pyx_L17:;
4053
4054   /* "lxml/sax.py":119
4055  *             element = SubElement(element_stack[-1], el_name,
4056  *                                  attrs, self._new_mappings)
4057  *         element_stack.append(element)             # <<<<<<<<<<<<<<
4058  * 
4059  *         self._new_mappings.clear()
4060  */
4061   __pyx_t_17 = __Pyx_PyObject_Append(__pyx_v_element_stack, __pyx_v_element); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 119, __pyx_L1_error)
4062
4063   /* "lxml/sax.py":121
4064  *         element_stack.append(element)
4065  * 
4066  *         self._new_mappings.clear()             # <<<<<<<<<<<<<<
4067  * 
4068  *     def processingInstruction(self, target, data):
4069  */
4070   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_new_mappings); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 121, __pyx_L1_error)
4071   __Pyx_GOTREF(__pyx_t_3);
4072   __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_clear); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 121, __pyx_L1_error)
4073   __Pyx_GOTREF(__pyx_t_11);
4074   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4075   __pyx_t_3 = NULL;
4076   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
4077     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_11);
4078     if (likely(__pyx_t_3)) {
4079       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
4080       __Pyx_INCREF(__pyx_t_3);
4081       __Pyx_INCREF(function);
4082       __Pyx_DECREF_SET(__pyx_t_11, function);
4083     }
4084   }
4085   __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_11);
4086   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4087   if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error)
4088   __Pyx_GOTREF(__pyx_t_2);
4089   __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
4090   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4091
4092   /* "lxml/sax.py":90
4093  *         return el_tag
4094  * 
4095  *     def startElementNS(self, ns_name, qname, attributes=None):             # <<<<<<<<<<<<<<
4096  *         el_name = self._buildTag(ns_name)
4097  *         if attributes:
4098  */
4099
4100   /* function exit code */
4101   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4102   goto __pyx_L0;
4103   __pyx_L1_error:;
4104   __Pyx_XDECREF(__pyx_t_1);
4105   __Pyx_XDECREF(__pyx_t_2);
4106   __Pyx_XDECREF(__pyx_t_3);
4107   __Pyx_XDECREF(__pyx_t_9);
4108   __Pyx_XDECREF(__pyx_t_10);
4109   __Pyx_XDECREF(__pyx_t_11);
4110   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.startElementNS", __pyx_clineno, __pyx_lineno, __pyx_filename);
4111   __pyx_r = NULL;
4112   __pyx_L0:;
4113   __Pyx_XDECREF(__pyx_v_el_name);
4114   __Pyx_XDECREF(__pyx_v_attrs);
4115   __Pyx_XDECREF(__pyx_v_iter_attributes);
4116   __Pyx_XDECREF(__pyx_v_name_tuple);
4117   __Pyx_XDECREF(__pyx_v_value);
4118   __Pyx_XDECREF(__pyx_v_attr_name);
4119   __Pyx_XDECREF(__pyx_v_element_stack);
4120   __Pyx_XDECREF(__pyx_v_element);
4121   __Pyx_XDECREF(__pyx_v_sibling);
4122   __Pyx_XGIVEREF(__pyx_r);
4123   __Pyx_RefNannyFinishContext();
4124   return __pyx_r;
4125 }
4126
4127 /* "lxml/sax.py":123
4128  *         self._new_mappings.clear()
4129  * 
4130  *     def processingInstruction(self, target, data):             # <<<<<<<<<<<<<<
4131  *         pi = ProcessingInstruction(target, data)
4132  *         if self._root is None:
4133  */
4134
4135 /* Python wrapper */
4136 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_19processingInstruction(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4137 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_19processingInstruction = {"processingInstruction", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_19processingInstruction, METH_VARARGS|METH_KEYWORDS, 0};
4138 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_19processingInstruction(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4139   PyObject *__pyx_v_self = 0;
4140   PyObject *__pyx_v_target = 0;
4141   PyObject *__pyx_v_data = 0;
4142   int __pyx_lineno = 0;
4143   const char *__pyx_filename = NULL;
4144   int __pyx_clineno = 0;
4145   PyObject *__pyx_r = 0;
4146   __Pyx_RefNannyDeclarations
4147   __Pyx_RefNannySetupContext("processingInstruction (wrapper)", 0);
4148   {
4149     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_target,&__pyx_n_s_data,0};
4150     PyObject* values[3] = {0,0,0};
4151     if (unlikely(__pyx_kwds)) {
4152       Py_ssize_t kw_args;
4153       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4154       switch (pos_args) {
4155         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4156         CYTHON_FALLTHROUGH;
4157         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4158         CYTHON_FALLTHROUGH;
4159         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4160         CYTHON_FALLTHROUGH;
4161         case  0: break;
4162         default: goto __pyx_L5_argtuple_error;
4163       }
4164       kw_args = PyDict_Size(__pyx_kwds);
4165       switch (pos_args) {
4166         case  0:
4167         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
4168         else goto __pyx_L5_argtuple_error;
4169         CYTHON_FALLTHROUGH;
4170         case  1:
4171         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_target)) != 0)) kw_args--;
4172         else {
4173           __Pyx_RaiseArgtupleInvalid("processingInstruction", 1, 3, 3, 1); __PYX_ERR(0, 123, __pyx_L3_error)
4174         }
4175         CYTHON_FALLTHROUGH;
4176         case  2:
4177         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
4178         else {
4179           __Pyx_RaiseArgtupleInvalid("processingInstruction", 1, 3, 3, 2); __PYX_ERR(0, 123, __pyx_L3_error)
4180         }
4181       }
4182       if (unlikely(kw_args > 0)) {
4183         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "processingInstruction") < 0)) __PYX_ERR(0, 123, __pyx_L3_error)
4184       }
4185     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
4186       goto __pyx_L5_argtuple_error;
4187     } else {
4188       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4189       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4190       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4191     }
4192     __pyx_v_self = values[0];
4193     __pyx_v_target = values[1];
4194     __pyx_v_data = values[2];
4195   }
4196   goto __pyx_L4_argument_unpacking_done;
4197   __pyx_L5_argtuple_error:;
4198   __Pyx_RaiseArgtupleInvalid("processingInstruction", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 123, __pyx_L3_error)
4199   __pyx_L3_error:;
4200   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.processingInstruction", __pyx_clineno, __pyx_lineno, __pyx_filename);
4201   __Pyx_RefNannyFinishContext();
4202   return NULL;
4203   __pyx_L4_argument_unpacking_done:;
4204   __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_18processingInstruction(__pyx_self, __pyx_v_self, __pyx_v_target, __pyx_v_data);
4205
4206   /* function exit code */
4207   __Pyx_RefNannyFinishContext();
4208   return __pyx_r;
4209 }
4210
4211 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_18processingInstruction(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_target, PyObject *__pyx_v_data) {
4212   PyObject *__pyx_v_pi = NULL;
4213   PyObject *__pyx_r = NULL;
4214   __Pyx_RefNannyDeclarations
4215   PyObject *__pyx_t_1 = NULL;
4216   PyObject *__pyx_t_2 = NULL;
4217   PyObject *__pyx_t_3 = NULL;
4218   int __pyx_t_4;
4219   PyObject *__pyx_t_5 = NULL;
4220   int __pyx_t_6;
4221   int __pyx_t_7;
4222   int __pyx_t_8;
4223   int __pyx_lineno = 0;
4224   const char *__pyx_filename = NULL;
4225   int __pyx_clineno = 0;
4226   __Pyx_RefNannySetupContext("processingInstruction", 0);
4227
4228   /* "lxml/sax.py":124
4229  * 
4230  *     def processingInstruction(self, target, data):
4231  *         pi = ProcessingInstruction(target, data)             # <<<<<<<<<<<<<<
4232  *         if self._root is None:
4233  *             self._root_siblings.append(pi)
4234  */
4235   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ProcessingInstruction); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 124, __pyx_L1_error)
4236   __Pyx_GOTREF(__pyx_t_2);
4237   __pyx_t_3 = NULL;
4238   __pyx_t_4 = 0;
4239   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
4240     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
4241     if (likely(__pyx_t_3)) {
4242       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
4243       __Pyx_INCREF(__pyx_t_3);
4244       __Pyx_INCREF(function);
4245       __Pyx_DECREF_SET(__pyx_t_2, function);
4246       __pyx_t_4 = 1;
4247     }
4248   }
4249   #if CYTHON_FAST_PYCALL
4250   if (PyFunction_Check(__pyx_t_2)) {
4251     PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_target, __pyx_v_data};
4252     __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error)
4253     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4254     __Pyx_GOTREF(__pyx_t_1);
4255   } else
4256   #endif
4257   #if CYTHON_FAST_PYCCALL
4258   if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
4259     PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_target, __pyx_v_data};
4260     __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error)
4261     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4262     __Pyx_GOTREF(__pyx_t_1);
4263   } else
4264   #endif
4265   {
4266     __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 124, __pyx_L1_error)
4267     __Pyx_GOTREF(__pyx_t_5);
4268     if (__pyx_t_3) {
4269       __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
4270     }
4271     __Pyx_INCREF(__pyx_v_target);
4272     __Pyx_GIVEREF(__pyx_v_target);
4273     PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_target);
4274     __Pyx_INCREF(__pyx_v_data);
4275     __Pyx_GIVEREF(__pyx_v_data);
4276     PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_data);
4277     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error)
4278     __Pyx_GOTREF(__pyx_t_1);
4279     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4280   }
4281   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4282   __pyx_v_pi = __pyx_t_1;
4283   __pyx_t_1 = 0;
4284
4285   /* "lxml/sax.py":125
4286  *     def processingInstruction(self, target, data):
4287  *         pi = ProcessingInstruction(target, data)
4288  *         if self._root is None:             # <<<<<<<<<<<<<<
4289  *             self._root_siblings.append(pi)
4290  *         else:
4291  */
4292   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_root); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 125, __pyx_L1_error)
4293   __Pyx_GOTREF(__pyx_t_1);
4294   __pyx_t_6 = (__pyx_t_1 == Py_None);
4295   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4296   __pyx_t_7 = (__pyx_t_6 != 0);
4297   if (__pyx_t_7) {
4298
4299     /* "lxml/sax.py":126
4300  *         pi = ProcessingInstruction(target, data)
4301  *         if self._root is None:
4302  *             self._root_siblings.append(pi)             # <<<<<<<<<<<<<<
4303  *         else:
4304  *             self._element_stack[-1].append(pi)
4305  */
4306     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_root_siblings); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error)
4307     __Pyx_GOTREF(__pyx_t_1);
4308     __pyx_t_8 = __Pyx_PyObject_Append(__pyx_t_1, __pyx_v_pi); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 126, __pyx_L1_error)
4309     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4310
4311     /* "lxml/sax.py":125
4312  *     def processingInstruction(self, target, data):
4313  *         pi = ProcessingInstruction(target, data)
4314  *         if self._root is None:             # <<<<<<<<<<<<<<
4315  *             self._root_siblings.append(pi)
4316  *         else:
4317  */
4318     goto __pyx_L3;
4319   }
4320
4321   /* "lxml/sax.py":128
4322  *             self._root_siblings.append(pi)
4323  *         else:
4324  *             self._element_stack[-1].append(pi)             # <<<<<<<<<<<<<<
4325  * 
4326  *     def endElementNS(self, ns_name, qname):
4327  */
4328   /*else*/ {
4329     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_element_stack); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error)
4330     __Pyx_GOTREF(__pyx_t_1);
4331     __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 128, __pyx_L1_error)
4332     __Pyx_GOTREF(__pyx_t_2);
4333     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4334     __pyx_t_8 = __Pyx_PyObject_Append(__pyx_t_2, __pyx_v_pi); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 128, __pyx_L1_error)
4335     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4336   }
4337   __pyx_L3:;
4338
4339   /* "lxml/sax.py":123
4340  *         self._new_mappings.clear()
4341  * 
4342  *     def processingInstruction(self, target, data):             # <<<<<<<<<<<<<<
4343  *         pi = ProcessingInstruction(target, data)
4344  *         if self._root is None:
4345  */
4346
4347   /* function exit code */
4348   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4349   goto __pyx_L0;
4350   __pyx_L1_error:;
4351   __Pyx_XDECREF(__pyx_t_1);
4352   __Pyx_XDECREF(__pyx_t_2);
4353   __Pyx_XDECREF(__pyx_t_3);
4354   __Pyx_XDECREF(__pyx_t_5);
4355   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.processingInstruction", __pyx_clineno, __pyx_lineno, __pyx_filename);
4356   __pyx_r = NULL;
4357   __pyx_L0:;
4358   __Pyx_XDECREF(__pyx_v_pi);
4359   __Pyx_XGIVEREF(__pyx_r);
4360   __Pyx_RefNannyFinishContext();
4361   return __pyx_r;
4362 }
4363
4364 /* "lxml/sax.py":130
4365  *             self._element_stack[-1].append(pi)
4366  * 
4367  *     def endElementNS(self, ns_name, qname):             # <<<<<<<<<<<<<<
4368  *         element = self._element_stack.pop()
4369  *         el_tag = self._buildTag(ns_name)
4370  */
4371
4372 /* Python wrapper */
4373 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_21endElementNS(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4374 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_21endElementNS = {"endElementNS", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_21endElementNS, METH_VARARGS|METH_KEYWORDS, 0};
4375 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_21endElementNS(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4376   PyObject *__pyx_v_self = 0;
4377   PyObject *__pyx_v_ns_name = 0;
4378   CYTHON_UNUSED PyObject *__pyx_v_qname = 0;
4379   int __pyx_lineno = 0;
4380   const char *__pyx_filename = NULL;
4381   int __pyx_clineno = 0;
4382   PyObject *__pyx_r = 0;
4383   __Pyx_RefNannyDeclarations
4384   __Pyx_RefNannySetupContext("endElementNS (wrapper)", 0);
4385   {
4386     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_ns_name,&__pyx_n_s_qname,0};
4387     PyObject* values[3] = {0,0,0};
4388     if (unlikely(__pyx_kwds)) {
4389       Py_ssize_t kw_args;
4390       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4391       switch (pos_args) {
4392         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4393         CYTHON_FALLTHROUGH;
4394         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4395         CYTHON_FALLTHROUGH;
4396         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4397         CYTHON_FALLTHROUGH;
4398         case  0: break;
4399         default: goto __pyx_L5_argtuple_error;
4400       }
4401       kw_args = PyDict_Size(__pyx_kwds);
4402       switch (pos_args) {
4403         case  0:
4404         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
4405         else goto __pyx_L5_argtuple_error;
4406         CYTHON_FALLTHROUGH;
4407         case  1:
4408         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ns_name)) != 0)) kw_args--;
4409         else {
4410           __Pyx_RaiseArgtupleInvalid("endElementNS", 1, 3, 3, 1); __PYX_ERR(0, 130, __pyx_L3_error)
4411         }
4412         CYTHON_FALLTHROUGH;
4413         case  2:
4414         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_qname)) != 0)) kw_args--;
4415         else {
4416           __Pyx_RaiseArgtupleInvalid("endElementNS", 1, 3, 3, 2); __PYX_ERR(0, 130, __pyx_L3_error)
4417         }
4418       }
4419       if (unlikely(kw_args > 0)) {
4420         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "endElementNS") < 0)) __PYX_ERR(0, 130, __pyx_L3_error)
4421       }
4422     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
4423       goto __pyx_L5_argtuple_error;
4424     } else {
4425       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4426       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4427       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4428     }
4429     __pyx_v_self = values[0];
4430     __pyx_v_ns_name = values[1];
4431     __pyx_v_qname = values[2];
4432   }
4433   goto __pyx_L4_argument_unpacking_done;
4434   __pyx_L5_argtuple_error:;
4435   __Pyx_RaiseArgtupleInvalid("endElementNS", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 130, __pyx_L3_error)
4436   __pyx_L3_error:;
4437   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.endElementNS", __pyx_clineno, __pyx_lineno, __pyx_filename);
4438   __Pyx_RefNannyFinishContext();
4439   return NULL;
4440   __pyx_L4_argument_unpacking_done:;
4441   __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_20endElementNS(__pyx_self, __pyx_v_self, __pyx_v_ns_name, __pyx_v_qname);
4442
4443   /* function exit code */
4444   __Pyx_RefNannyFinishContext();
4445   return __pyx_r;
4446 }
4447
4448 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_20endElementNS(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_ns_name, CYTHON_UNUSED PyObject *__pyx_v_qname) {
4449   PyObject *__pyx_v_element = NULL;
4450   PyObject *__pyx_v_el_tag = NULL;
4451   PyObject *__pyx_r = NULL;
4452   __Pyx_RefNannyDeclarations
4453   PyObject *__pyx_t_1 = NULL;
4454   PyObject *__pyx_t_2 = NULL;
4455   PyObject *__pyx_t_3 = NULL;
4456   int __pyx_t_4;
4457   PyObject *__pyx_t_5 = NULL;
4458   int __pyx_lineno = 0;
4459   const char *__pyx_filename = NULL;
4460   int __pyx_clineno = 0;
4461   __Pyx_RefNannySetupContext("endElementNS", 0);
4462
4463   /* "lxml/sax.py":131
4464  * 
4465  *     def endElementNS(self, ns_name, qname):
4466  *         element = self._element_stack.pop()             # <<<<<<<<<<<<<<
4467  *         el_tag = self._buildTag(ns_name)
4468  *         if el_tag != element.tag:
4469  */
4470   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_element_stack); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 131, __pyx_L1_error)
4471   __Pyx_GOTREF(__pyx_t_1);
4472   __pyx_t_2 = __Pyx_PyObject_Pop(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 131, __pyx_L1_error)
4473   __Pyx_GOTREF(__pyx_t_2);
4474   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4475   __pyx_v_element = __pyx_t_2;
4476   __pyx_t_2 = 0;
4477
4478   /* "lxml/sax.py":132
4479  *     def endElementNS(self, ns_name, qname):
4480  *         element = self._element_stack.pop()
4481  *         el_tag = self._buildTag(ns_name)             # <<<<<<<<<<<<<<
4482  *         if el_tag != element.tag:
4483  *             raise SaxError("Unexpected element closed: " + el_tag)
4484  */
4485   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_buildTag); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error)
4486   __Pyx_GOTREF(__pyx_t_1);
4487   __pyx_t_3 = NULL;
4488   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
4489     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
4490     if (likely(__pyx_t_3)) {
4491       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
4492       __Pyx_INCREF(__pyx_t_3);
4493       __Pyx_INCREF(function);
4494       __Pyx_DECREF_SET(__pyx_t_1, function);
4495     }
4496   }
4497   __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_3, __pyx_v_ns_name) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_ns_name);
4498   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4499   if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 132, __pyx_L1_error)
4500   __Pyx_GOTREF(__pyx_t_2);
4501   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4502   __pyx_v_el_tag = __pyx_t_2;
4503   __pyx_t_2 = 0;
4504
4505   /* "lxml/sax.py":133
4506  *         element = self._element_stack.pop()
4507  *         el_tag = self._buildTag(ns_name)
4508  *         if el_tag != element.tag:             # <<<<<<<<<<<<<<
4509  *             raise SaxError("Unexpected element closed: " + el_tag)
4510  * 
4511  */
4512   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_element, __pyx_n_s_tag); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 133, __pyx_L1_error)
4513   __Pyx_GOTREF(__pyx_t_2);
4514   __pyx_t_1 = PyObject_RichCompare(__pyx_v_el_tag, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error)
4515   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4516   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 133, __pyx_L1_error)
4517   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4518   if (unlikely(__pyx_t_4)) {
4519
4520     /* "lxml/sax.py":134
4521  *         el_tag = self._buildTag(ns_name)
4522  *         if el_tag != element.tag:
4523  *             raise SaxError("Unexpected element closed: " + el_tag)             # <<<<<<<<<<<<<<
4524  * 
4525  *     def startElement(self, name, attributes=None):
4526  */
4527     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_SaxError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __pyx_L1_error)
4528     __Pyx_GOTREF(__pyx_t_2);
4529     __pyx_t_3 = PyNumber_Add(__pyx_kp_s_Unexpected_element_closed, __pyx_v_el_tag); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 134, __pyx_L1_error)
4530     __Pyx_GOTREF(__pyx_t_3);
4531     __pyx_t_5 = NULL;
4532     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
4533       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
4534       if (likely(__pyx_t_5)) {
4535         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
4536         __Pyx_INCREF(__pyx_t_5);
4537         __Pyx_INCREF(function);
4538         __Pyx_DECREF_SET(__pyx_t_2, function);
4539       }
4540     }
4541     __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
4542     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
4543     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4544     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 134, __pyx_L1_error)
4545     __Pyx_GOTREF(__pyx_t_1);
4546     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4547     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
4548     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4549     __PYX_ERR(0, 134, __pyx_L1_error)
4550
4551     /* "lxml/sax.py":133
4552  *         element = self._element_stack.pop()
4553  *         el_tag = self._buildTag(ns_name)
4554  *         if el_tag != element.tag:             # <<<<<<<<<<<<<<
4555  *             raise SaxError("Unexpected element closed: " + el_tag)
4556  * 
4557  */
4558   }
4559
4560   /* "lxml/sax.py":130
4561  *             self._element_stack[-1].append(pi)
4562  * 
4563  *     def endElementNS(self, ns_name, qname):             # <<<<<<<<<<<<<<
4564  *         element = self._element_stack.pop()
4565  *         el_tag = self._buildTag(ns_name)
4566  */
4567
4568   /* function exit code */
4569   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4570   goto __pyx_L0;
4571   __pyx_L1_error:;
4572   __Pyx_XDECREF(__pyx_t_1);
4573   __Pyx_XDECREF(__pyx_t_2);
4574   __Pyx_XDECREF(__pyx_t_3);
4575   __Pyx_XDECREF(__pyx_t_5);
4576   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.endElementNS", __pyx_clineno, __pyx_lineno, __pyx_filename);
4577   __pyx_r = NULL;
4578   __pyx_L0:;
4579   __Pyx_XDECREF(__pyx_v_element);
4580   __Pyx_XDECREF(__pyx_v_el_tag);
4581   __Pyx_XGIVEREF(__pyx_r);
4582   __Pyx_RefNannyFinishContext();
4583   return __pyx_r;
4584 }
4585
4586 /* "lxml/sax.py":136
4587  *             raise SaxError("Unexpected element closed: " + el_tag)
4588  * 
4589  *     def startElement(self, name, attributes=None):             # <<<<<<<<<<<<<<
4590  *         if attributes:
4591  *             attributes = dict(
4592  */
4593
4594 /* Python wrapper */
4595 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_23startElement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4596 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_23startElement = {"startElement", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_23startElement, METH_VARARGS|METH_KEYWORDS, 0};
4597 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_23startElement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4598   PyObject *__pyx_v_self = 0;
4599   PyObject *__pyx_v_name = 0;
4600   PyObject *__pyx_v_attributes = 0;
4601   int __pyx_lineno = 0;
4602   const char *__pyx_filename = NULL;
4603   int __pyx_clineno = 0;
4604   PyObject *__pyx_r = 0;
4605   __Pyx_RefNannyDeclarations
4606   __Pyx_RefNannySetupContext("startElement (wrapper)", 0);
4607   {
4608     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_name,&__pyx_n_s_attributes,0};
4609     PyObject* values[3] = {0,0,0};
4610     values[2] = ((PyObject *)((PyObject *)Py_None));
4611     if (unlikely(__pyx_kwds)) {
4612       Py_ssize_t kw_args;
4613       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4614       switch (pos_args) {
4615         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4616         CYTHON_FALLTHROUGH;
4617         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4618         CYTHON_FALLTHROUGH;
4619         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4620         CYTHON_FALLTHROUGH;
4621         case  0: break;
4622         default: goto __pyx_L5_argtuple_error;
4623       }
4624       kw_args = PyDict_Size(__pyx_kwds);
4625       switch (pos_args) {
4626         case  0:
4627         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
4628         else goto __pyx_L5_argtuple_error;
4629         CYTHON_FALLTHROUGH;
4630         case  1:
4631         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
4632         else {
4633           __Pyx_RaiseArgtupleInvalid("startElement", 0, 2, 3, 1); __PYX_ERR(0, 136, __pyx_L3_error)
4634         }
4635         CYTHON_FALLTHROUGH;
4636         case  2:
4637         if (kw_args > 0) {
4638           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_attributes);
4639           if (value) { values[2] = value; kw_args--; }
4640         }
4641       }
4642       if (unlikely(kw_args > 0)) {
4643         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "startElement") < 0)) __PYX_ERR(0, 136, __pyx_L3_error)
4644       }
4645     } else {
4646       switch (PyTuple_GET_SIZE(__pyx_args)) {
4647         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4648         CYTHON_FALLTHROUGH;
4649         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4650         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4651         break;
4652         default: goto __pyx_L5_argtuple_error;
4653       }
4654     }
4655     __pyx_v_self = values[0];
4656     __pyx_v_name = values[1];
4657     __pyx_v_attributes = values[2];
4658   }
4659   goto __pyx_L4_argument_unpacking_done;
4660   __pyx_L5_argtuple_error:;
4661   __Pyx_RaiseArgtupleInvalid("startElement", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 136, __pyx_L3_error)
4662   __pyx_L3_error:;
4663   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.startElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
4664   __Pyx_RefNannyFinishContext();
4665   return NULL;
4666   __pyx_L4_argument_unpacking_done:;
4667   __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_22startElement(__pyx_self, __pyx_v_self, __pyx_v_name, __pyx_v_attributes);
4668
4669   /* function exit code */
4670   __Pyx_RefNannyFinishContext();
4671   return __pyx_r;
4672 }
4673
4674 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_22startElement(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_attributes) {
4675   PyObject *__pyx_v_k = NULL;
4676   PyObject *__pyx_v_v = NULL;
4677   PyObject *__pyx_r = NULL;
4678   __Pyx_RefNannyDeclarations
4679   int __pyx_t_1;
4680   PyObject *__pyx_t_2 = NULL;
4681   PyObject *__pyx_t_3 = NULL;
4682   PyObject *__pyx_t_4 = NULL;
4683   PyObject *__pyx_t_5 = NULL;
4684   Py_ssize_t __pyx_t_6;
4685   PyObject *(*__pyx_t_7)(PyObject *);
4686   PyObject *__pyx_t_8 = NULL;
4687   PyObject *__pyx_t_9 = NULL;
4688   PyObject *(*__pyx_t_10)(PyObject *);
4689   int __pyx_t_11;
4690   int __pyx_lineno = 0;
4691   const char *__pyx_filename = NULL;
4692   int __pyx_clineno = 0;
4693   __Pyx_RefNannySetupContext("startElement", 0);
4694   __Pyx_INCREF(__pyx_v_attributes);
4695
4696   /* "lxml/sax.py":137
4697  * 
4698  *     def startElement(self, name, attributes=None):
4699  *         if attributes:             # <<<<<<<<<<<<<<
4700  *             attributes = dict(
4701  *                     [((None, k), v) for k, v in attributes.items()]
4702  */
4703   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_attributes); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 137, __pyx_L1_error)
4704   if (__pyx_t_1) {
4705
4706     /* "lxml/sax.py":139
4707  *         if attributes:
4708  *             attributes = dict(
4709  *                     [((None, k), v) for k, v in attributes.items()]             # <<<<<<<<<<<<<<
4710  *                 )
4711  *         self.startElementNS((None, name), name, attributes)
4712  */
4713     __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __pyx_L1_error)
4714     __Pyx_GOTREF(__pyx_t_2);
4715     __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_attributes, __pyx_n_s_items); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 139, __pyx_L1_error)
4716     __Pyx_GOTREF(__pyx_t_4);
4717     __pyx_t_5 = NULL;
4718     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
4719       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
4720       if (likely(__pyx_t_5)) {
4721         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
4722         __Pyx_INCREF(__pyx_t_5);
4723         __Pyx_INCREF(function);
4724         __Pyx_DECREF_SET(__pyx_t_4, function);
4725       }
4726     }
4727     __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
4728     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
4729     if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 139, __pyx_L1_error)
4730     __Pyx_GOTREF(__pyx_t_3);
4731     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4732     if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
4733       __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0;
4734       __pyx_t_7 = NULL;
4735     } else {
4736       __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 139, __pyx_L1_error)
4737       __Pyx_GOTREF(__pyx_t_4);
4738       __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 139, __pyx_L1_error)
4739     }
4740     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4741     for (;;) {
4742       if (likely(!__pyx_t_7)) {
4743         if (likely(PyList_CheckExact(__pyx_t_4))) {
4744           if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break;
4745           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4746           __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 139, __pyx_L1_error)
4747           #else
4748           __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 139, __pyx_L1_error)
4749           __Pyx_GOTREF(__pyx_t_3);
4750           #endif
4751         } else {
4752           if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
4753           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4754           __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 139, __pyx_L1_error)
4755           #else
4756           __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 139, __pyx_L1_error)
4757           __Pyx_GOTREF(__pyx_t_3);
4758           #endif
4759         }
4760       } else {
4761         __pyx_t_3 = __pyx_t_7(__pyx_t_4);
4762         if (unlikely(!__pyx_t_3)) {
4763           PyObject* exc_type = PyErr_Occurred();
4764           if (exc_type) {
4765             if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
4766             else __PYX_ERR(0, 139, __pyx_L1_error)
4767           }
4768           break;
4769         }
4770         __Pyx_GOTREF(__pyx_t_3);
4771       }
4772       if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
4773         PyObject* sequence = __pyx_t_3;
4774         Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
4775         if (unlikely(size != 2)) {
4776           if (size > 2) __Pyx_RaiseTooManyValuesError(2);
4777           else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
4778           __PYX_ERR(0, 139, __pyx_L1_error)
4779         }
4780         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4781         if (likely(PyTuple_CheckExact(sequence))) {
4782           __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
4783           __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
4784         } else {
4785           __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
4786           __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
4787         }
4788         __Pyx_INCREF(__pyx_t_5);
4789         __Pyx_INCREF(__pyx_t_8);
4790         #else
4791         __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 139, __pyx_L1_error)
4792         __Pyx_GOTREF(__pyx_t_5);
4793         __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 139, __pyx_L1_error)
4794         __Pyx_GOTREF(__pyx_t_8);
4795         #endif
4796         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4797       } else {
4798         Py_ssize_t index = -1;
4799         __pyx_t_9 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 139, __pyx_L1_error)
4800         __Pyx_GOTREF(__pyx_t_9);
4801         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4802         __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
4803         index = 0; __pyx_t_5 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
4804         __Pyx_GOTREF(__pyx_t_5);
4805         index = 1; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed;
4806         __Pyx_GOTREF(__pyx_t_8);
4807         if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) __PYX_ERR(0, 139, __pyx_L1_error)
4808         __pyx_t_10 = NULL;
4809         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
4810         goto __pyx_L7_unpacking_done;
4811         __pyx_L6_unpacking_failed:;
4812         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
4813         __pyx_t_10 = NULL;
4814         if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
4815         __PYX_ERR(0, 139, __pyx_L1_error)
4816         __pyx_L7_unpacking_done:;
4817       }
4818       __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_5);
4819       __pyx_t_5 = 0;
4820       __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_8);
4821       __pyx_t_8 = 0;
4822       __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 139, __pyx_L1_error)
4823       __Pyx_GOTREF(__pyx_t_3);
4824       __Pyx_INCREF(Py_None);
4825       __Pyx_GIVEREF(Py_None);
4826       PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
4827       __Pyx_INCREF(__pyx_v_k);
4828       __Pyx_GIVEREF(__pyx_v_k);
4829       PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_k);
4830       __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 139, __pyx_L1_error)
4831       __Pyx_GOTREF(__pyx_t_8);
4832       __Pyx_GIVEREF(__pyx_t_3);
4833       PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3);
4834       __Pyx_INCREF(__pyx_v_v);
4835       __Pyx_GIVEREF(__pyx_v_v);
4836       PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_v);
4837       __pyx_t_3 = 0;
4838       if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_8))) __PYX_ERR(0, 139, __pyx_L1_error)
4839       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4840     }
4841     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4842
4843     /* "lxml/sax.py":138
4844  *     def startElement(self, name, attributes=None):
4845  *         if attributes:
4846  *             attributes = dict(             # <<<<<<<<<<<<<<
4847  *                     [((None, k), v) for k, v in attributes.items()]
4848  *                 )
4849  */
4850     __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyDict_Type)), __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 138, __pyx_L1_error)
4851     __Pyx_GOTREF(__pyx_t_4);
4852     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4853     __Pyx_DECREF_SET(__pyx_v_attributes, __pyx_t_4);
4854     __pyx_t_4 = 0;
4855
4856     /* "lxml/sax.py":137
4857  * 
4858  *     def startElement(self, name, attributes=None):
4859  *         if attributes:             # <<<<<<<<<<<<<<
4860  *             attributes = dict(
4861  *                     [((None, k), v) for k, v in attributes.items()]
4862  */
4863   }
4864
4865   /* "lxml/sax.py":141
4866  *                     [((None, k), v) for k, v in attributes.items()]
4867  *                 )
4868  *         self.startElementNS((None, name), name, attributes)             # <<<<<<<<<<<<<<
4869  * 
4870  *     def endElement(self, name):
4871  */
4872   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_startElementNS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 141, __pyx_L1_error)
4873   __Pyx_GOTREF(__pyx_t_2);
4874   __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 141, __pyx_L1_error)
4875   __Pyx_GOTREF(__pyx_t_8);
4876   __Pyx_INCREF(Py_None);
4877   __Pyx_GIVEREF(Py_None);
4878   PyTuple_SET_ITEM(__pyx_t_8, 0, Py_None);
4879   __Pyx_INCREF(__pyx_v_name);
4880   __Pyx_GIVEREF(__pyx_v_name);
4881   PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_name);
4882   __pyx_t_3 = NULL;
4883   __pyx_t_11 = 0;
4884   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
4885     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
4886     if (likely(__pyx_t_3)) {
4887       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
4888       __Pyx_INCREF(__pyx_t_3);
4889       __Pyx_INCREF(function);
4890       __Pyx_DECREF_SET(__pyx_t_2, function);
4891       __pyx_t_11 = 1;
4892     }
4893   }
4894   #if CYTHON_FAST_PYCALL
4895   if (PyFunction_Check(__pyx_t_2)) {
4896     PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_t_8, __pyx_v_name, __pyx_v_attributes};
4897     __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 141, __pyx_L1_error)
4898     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4899     __Pyx_GOTREF(__pyx_t_4);
4900     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4901   } else
4902   #endif
4903   #if CYTHON_FAST_PYCCALL
4904   if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
4905     PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_t_8, __pyx_v_name, __pyx_v_attributes};
4906     __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 141, __pyx_L1_error)
4907     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4908     __Pyx_GOTREF(__pyx_t_4);
4909     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4910   } else
4911   #endif
4912   {
4913     __pyx_t_5 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 141, __pyx_L1_error)
4914     __Pyx_GOTREF(__pyx_t_5);
4915     if (__pyx_t_3) {
4916       __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
4917     }
4918     __Pyx_GIVEREF(__pyx_t_8);
4919     PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_11, __pyx_t_8);
4920     __Pyx_INCREF(__pyx_v_name);
4921     __Pyx_GIVEREF(__pyx_v_name);
4922     PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_11, __pyx_v_name);
4923     __Pyx_INCREF(__pyx_v_attributes);
4924     __Pyx_GIVEREF(__pyx_v_attributes);
4925     PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_11, __pyx_v_attributes);
4926     __pyx_t_8 = 0;
4927     __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 141, __pyx_L1_error)
4928     __Pyx_GOTREF(__pyx_t_4);
4929     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4930   }
4931   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4932   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4933
4934   /* "lxml/sax.py":136
4935  *             raise SaxError("Unexpected element closed: " + el_tag)
4936  * 
4937  *     def startElement(self, name, attributes=None):             # <<<<<<<<<<<<<<
4938  *         if attributes:
4939  *             attributes = dict(
4940  */
4941
4942   /* function exit code */
4943   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4944   goto __pyx_L0;
4945   __pyx_L1_error:;
4946   __Pyx_XDECREF(__pyx_t_2);
4947   __Pyx_XDECREF(__pyx_t_3);
4948   __Pyx_XDECREF(__pyx_t_4);
4949   __Pyx_XDECREF(__pyx_t_5);
4950   __Pyx_XDECREF(__pyx_t_8);
4951   __Pyx_XDECREF(__pyx_t_9);
4952   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.startElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
4953   __pyx_r = NULL;
4954   __pyx_L0:;
4955   __Pyx_XDECREF(__pyx_v_k);
4956   __Pyx_XDECREF(__pyx_v_v);
4957   __Pyx_XDECREF(__pyx_v_attributes);
4958   __Pyx_XGIVEREF(__pyx_r);
4959   __Pyx_RefNannyFinishContext();
4960   return __pyx_r;
4961 }
4962
4963 /* "lxml/sax.py":143
4964  *         self.startElementNS((None, name), name, attributes)
4965  * 
4966  *     def endElement(self, name):             # <<<<<<<<<<<<<<
4967  *         self.endElementNS((None, name), name)
4968  * 
4969  */
4970
4971 /* Python wrapper */
4972 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_25endElement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4973 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_25endElement = {"endElement", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_25endElement, METH_VARARGS|METH_KEYWORDS, 0};
4974 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_25endElement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4975   PyObject *__pyx_v_self = 0;
4976   PyObject *__pyx_v_name = 0;
4977   int __pyx_lineno = 0;
4978   const char *__pyx_filename = NULL;
4979   int __pyx_clineno = 0;
4980   PyObject *__pyx_r = 0;
4981   __Pyx_RefNannyDeclarations
4982   __Pyx_RefNannySetupContext("endElement (wrapper)", 0);
4983   {
4984     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_name,0};
4985     PyObject* values[2] = {0,0};
4986     if (unlikely(__pyx_kwds)) {
4987       Py_ssize_t kw_args;
4988       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4989       switch (pos_args) {
4990         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4991         CYTHON_FALLTHROUGH;
4992         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4993         CYTHON_FALLTHROUGH;
4994         case  0: break;
4995         default: goto __pyx_L5_argtuple_error;
4996       }
4997       kw_args = PyDict_Size(__pyx_kwds);
4998       switch (pos_args) {
4999         case  0:
5000         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
5001         else goto __pyx_L5_argtuple_error;
5002         CYTHON_FALLTHROUGH;
5003         case  1:
5004         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
5005         else {
5006           __Pyx_RaiseArgtupleInvalid("endElement", 1, 2, 2, 1); __PYX_ERR(0, 143, __pyx_L3_error)
5007         }
5008       }
5009       if (unlikely(kw_args > 0)) {
5010         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "endElement") < 0)) __PYX_ERR(0, 143, __pyx_L3_error)
5011       }
5012     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
5013       goto __pyx_L5_argtuple_error;
5014     } else {
5015       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5016       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5017     }
5018     __pyx_v_self = values[0];
5019     __pyx_v_name = values[1];
5020   }
5021   goto __pyx_L4_argument_unpacking_done;
5022   __pyx_L5_argtuple_error:;
5023   __Pyx_RaiseArgtupleInvalid("endElement", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 143, __pyx_L3_error)
5024   __pyx_L3_error:;
5025   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.endElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
5026   __Pyx_RefNannyFinishContext();
5027   return NULL;
5028   __pyx_L4_argument_unpacking_done:;
5029   __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_24endElement(__pyx_self, __pyx_v_self, __pyx_v_name);
5030
5031   /* function exit code */
5032   __Pyx_RefNannyFinishContext();
5033   return __pyx_r;
5034 }
5035
5036 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_24endElement(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
5037   PyObject *__pyx_r = NULL;
5038   __Pyx_RefNannyDeclarations
5039   PyObject *__pyx_t_1 = NULL;
5040   PyObject *__pyx_t_2 = NULL;
5041   PyObject *__pyx_t_3 = NULL;
5042   PyObject *__pyx_t_4 = NULL;
5043   int __pyx_t_5;
5044   PyObject *__pyx_t_6 = NULL;
5045   int __pyx_lineno = 0;
5046   const char *__pyx_filename = NULL;
5047   int __pyx_clineno = 0;
5048   __Pyx_RefNannySetupContext("endElement", 0);
5049
5050   /* "lxml/sax.py":144
5051  * 
5052  *     def endElement(self, name):
5053  *         self.endElementNS((None, name), name)             # <<<<<<<<<<<<<<
5054  * 
5055  *     def characters(self, data):
5056  */
5057   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_endElementNS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 144, __pyx_L1_error)
5058   __Pyx_GOTREF(__pyx_t_2);
5059   __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 144, __pyx_L1_error)
5060   __Pyx_GOTREF(__pyx_t_3);
5061   __Pyx_INCREF(Py_None);
5062   __Pyx_GIVEREF(Py_None);
5063   PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
5064   __Pyx_INCREF(__pyx_v_name);
5065   __Pyx_GIVEREF(__pyx_v_name);
5066   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_name);
5067   __pyx_t_4 = NULL;
5068   __pyx_t_5 = 0;
5069   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
5070     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
5071     if (likely(__pyx_t_4)) {
5072       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5073       __Pyx_INCREF(__pyx_t_4);
5074       __Pyx_INCREF(function);
5075       __Pyx_DECREF_SET(__pyx_t_2, function);
5076       __pyx_t_5 = 1;
5077     }
5078   }
5079   #if CYTHON_FAST_PYCALL
5080   if (PyFunction_Check(__pyx_t_2)) {
5081     PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, __pyx_v_name};
5082     __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error)
5083     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5084     __Pyx_GOTREF(__pyx_t_1);
5085     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5086   } else
5087   #endif
5088   #if CYTHON_FAST_PYCCALL
5089   if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
5090     PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, __pyx_v_name};
5091     __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error)
5092     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5093     __Pyx_GOTREF(__pyx_t_1);
5094     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5095   } else
5096   #endif
5097   {
5098     __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 144, __pyx_L1_error)
5099     __Pyx_GOTREF(__pyx_t_6);
5100     if (__pyx_t_4) {
5101       __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
5102     }
5103     __Pyx_GIVEREF(__pyx_t_3);
5104     PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_3);
5105     __Pyx_INCREF(__pyx_v_name);
5106     __Pyx_GIVEREF(__pyx_v_name);
5107     PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_name);
5108     __pyx_t_3 = 0;
5109     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error)
5110     __Pyx_GOTREF(__pyx_t_1);
5111     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5112   }
5113   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5114   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5115
5116   /* "lxml/sax.py":143
5117  *         self.startElementNS((None, name), name, attributes)
5118  * 
5119  *     def endElement(self, name):             # <<<<<<<<<<<<<<
5120  *         self.endElementNS((None, name), name)
5121  * 
5122  */
5123
5124   /* function exit code */
5125   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5126   goto __pyx_L0;
5127   __pyx_L1_error:;
5128   __Pyx_XDECREF(__pyx_t_1);
5129   __Pyx_XDECREF(__pyx_t_2);
5130   __Pyx_XDECREF(__pyx_t_3);
5131   __Pyx_XDECREF(__pyx_t_4);
5132   __Pyx_XDECREF(__pyx_t_6);
5133   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.endElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
5134   __pyx_r = NULL;
5135   __pyx_L0:;
5136   __Pyx_XGIVEREF(__pyx_r);
5137   __Pyx_RefNannyFinishContext();
5138   return __pyx_r;
5139 }
5140
5141 /* "lxml/sax.py":146
5142  *         self.endElementNS((None, name), name)
5143  * 
5144  *     def characters(self, data):             # <<<<<<<<<<<<<<
5145  *         last_element = self._element_stack[-1]
5146  *         try:
5147  */
5148
5149 /* Python wrapper */
5150 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_27characters(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5151 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_27characters = {"characters", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_27characters, METH_VARARGS|METH_KEYWORDS, 0};
5152 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_27characters(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5153   PyObject *__pyx_v_self = 0;
5154   PyObject *__pyx_v_data = 0;
5155   int __pyx_lineno = 0;
5156   const char *__pyx_filename = NULL;
5157   int __pyx_clineno = 0;
5158   PyObject *__pyx_r = 0;
5159   __Pyx_RefNannyDeclarations
5160   __Pyx_RefNannySetupContext("characters (wrapper)", 0);
5161   {
5162     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_data,0};
5163     PyObject* values[2] = {0,0};
5164     if (unlikely(__pyx_kwds)) {
5165       Py_ssize_t kw_args;
5166       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5167       switch (pos_args) {
5168         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5169         CYTHON_FALLTHROUGH;
5170         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5171         CYTHON_FALLTHROUGH;
5172         case  0: break;
5173         default: goto __pyx_L5_argtuple_error;
5174       }
5175       kw_args = PyDict_Size(__pyx_kwds);
5176       switch (pos_args) {
5177         case  0:
5178         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
5179         else goto __pyx_L5_argtuple_error;
5180         CYTHON_FALLTHROUGH;
5181         case  1:
5182         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
5183         else {
5184           __Pyx_RaiseArgtupleInvalid("characters", 1, 2, 2, 1); __PYX_ERR(0, 146, __pyx_L3_error)
5185         }
5186       }
5187       if (unlikely(kw_args > 0)) {
5188         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "characters") < 0)) __PYX_ERR(0, 146, __pyx_L3_error)
5189       }
5190     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
5191       goto __pyx_L5_argtuple_error;
5192     } else {
5193       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5194       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5195     }
5196     __pyx_v_self = values[0];
5197     __pyx_v_data = values[1];
5198   }
5199   goto __pyx_L4_argument_unpacking_done;
5200   __pyx_L5_argtuple_error:;
5201   __Pyx_RaiseArgtupleInvalid("characters", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 146, __pyx_L3_error)
5202   __pyx_L3_error:;
5203   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.characters", __pyx_clineno, __pyx_lineno, __pyx_filename);
5204   __Pyx_RefNannyFinishContext();
5205   return NULL;
5206   __pyx_L4_argument_unpacking_done:;
5207   __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_26characters(__pyx_self, __pyx_v_self, __pyx_v_data);
5208
5209   /* function exit code */
5210   __Pyx_RefNannyFinishContext();
5211   return __pyx_r;
5212 }
5213
5214 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_26characters(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data) {
5215   PyObject *__pyx_v_last_element = NULL;
5216   PyObject *__pyx_r = NULL;
5217   __Pyx_RefNannyDeclarations
5218   PyObject *__pyx_t_1 = NULL;
5219   PyObject *__pyx_t_2 = NULL;
5220   PyObject *__pyx_t_3 = NULL;
5221   PyObject *__pyx_t_4 = NULL;
5222   PyObject *__pyx_t_5 = NULL;
5223   int __pyx_t_6;
5224   int __pyx_t_7;
5225   PyObject *__pyx_t_8 = NULL;
5226   PyObject *__pyx_t_9 = NULL;
5227   PyObject *__pyx_t_10 = NULL;
5228   int __pyx_lineno = 0;
5229   const char *__pyx_filename = NULL;
5230   int __pyx_clineno = 0;
5231   __Pyx_RefNannySetupContext("characters", 0);
5232
5233   /* "lxml/sax.py":147
5234  * 
5235  *     def characters(self, data):
5236  *         last_element = self._element_stack[-1]             # <<<<<<<<<<<<<<
5237  *         try:
5238  *             # if there already is a child element, we must append to its tail
5239  */
5240   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_element_stack); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 147, __pyx_L1_error)
5241   __Pyx_GOTREF(__pyx_t_1);
5242   __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 147, __pyx_L1_error)
5243   __Pyx_GOTREF(__pyx_t_2);
5244   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5245   __pyx_v_last_element = __pyx_t_2;
5246   __pyx_t_2 = 0;
5247
5248   /* "lxml/sax.py":148
5249  *     def characters(self, data):
5250  *         last_element = self._element_stack[-1]
5251  *         try:             # <<<<<<<<<<<<<<
5252  *             # if there already is a child element, we must append to its tail
5253  *             last_element = last_element[-1]
5254  */
5255   {
5256     __Pyx_PyThreadState_declare
5257     __Pyx_PyThreadState_assign
5258     __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
5259     __Pyx_XGOTREF(__pyx_t_3);
5260     __Pyx_XGOTREF(__pyx_t_4);
5261     __Pyx_XGOTREF(__pyx_t_5);
5262     /*try:*/ {
5263
5264       /* "lxml/sax.py":150
5265  *         try:
5266  *             # if there already is a child element, we must append to its tail
5267  *             last_element = last_element[-1]             # <<<<<<<<<<<<<<
5268  *             last_element.tail = (last_element.tail or '') + data
5269  *         except IndexError:
5270  */
5271       __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_last_element, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L3_error)
5272       __Pyx_GOTREF(__pyx_t_2);
5273       __Pyx_DECREF_SET(__pyx_v_last_element, __pyx_t_2);
5274       __pyx_t_2 = 0;
5275
5276       /* "lxml/sax.py":151
5277  *             # if there already is a child element, we must append to its tail
5278  *             last_element = last_element[-1]
5279  *             last_element.tail = (last_element.tail or '') + data             # <<<<<<<<<<<<<<
5280  *         except IndexError:
5281  *             # otherwise: append to the text
5282  */
5283       __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_last_element, __pyx_n_s_tail); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L3_error)
5284       __Pyx_GOTREF(__pyx_t_1);
5285       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 151, __pyx_L3_error)
5286       if (!__pyx_t_6) {
5287         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5288       } else {
5289         __Pyx_INCREF(__pyx_t_1);
5290         __pyx_t_2 = __pyx_t_1;
5291         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5292         goto __pyx_L9_bool_binop_done;
5293       }
5294       __Pyx_INCREF(__pyx_kp_s__6);
5295       __pyx_t_2 = __pyx_kp_s__6;
5296       __pyx_L9_bool_binop_done:;
5297       __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L3_error)
5298       __Pyx_GOTREF(__pyx_t_1);
5299       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5300       if (__Pyx_PyObject_SetAttrStr(__pyx_v_last_element, __pyx_n_s_tail, __pyx_t_1) < 0) __PYX_ERR(0, 151, __pyx_L3_error)
5301       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5302
5303       /* "lxml/sax.py":148
5304  *     def characters(self, data):
5305  *         last_element = self._element_stack[-1]
5306  *         try:             # <<<<<<<<<<<<<<
5307  *             # if there already is a child element, we must append to its tail
5308  *             last_element = last_element[-1]
5309  */
5310     }
5311     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5312     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5313     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
5314     goto __pyx_L8_try_end;
5315     __pyx_L3_error:;
5316     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
5317     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5318
5319     /* "lxml/sax.py":152
5320  *             last_element = last_element[-1]
5321  *             last_element.tail = (last_element.tail or '') + data
5322  *         except IndexError:             # <<<<<<<<<<<<<<
5323  *             # otherwise: append to the text
5324  *             last_element.text = (last_element.text or '') + data
5325  */
5326     __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_IndexError);
5327     if (__pyx_t_7) {
5328       __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.characters", __pyx_clineno, __pyx_lineno, __pyx_filename);
5329       if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_8) < 0) __PYX_ERR(0, 152, __pyx_L5_except_error)
5330       __Pyx_GOTREF(__pyx_t_1);
5331       __Pyx_GOTREF(__pyx_t_2);
5332       __Pyx_GOTREF(__pyx_t_8);
5333
5334       /* "lxml/sax.py":154
5335  *         except IndexError:
5336  *             # otherwise: append to the text
5337  *             last_element.text = (last_element.text or '') + data             # <<<<<<<<<<<<<<
5338  * 
5339  *     ignorableWhitespace = characters
5340  */
5341       __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_last_element, __pyx_n_s_text); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 154, __pyx_L5_except_error)
5342       __Pyx_GOTREF(__pyx_t_10);
5343       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 154, __pyx_L5_except_error)
5344       if (!__pyx_t_6) {
5345         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5346       } else {
5347         __Pyx_INCREF(__pyx_t_10);
5348         __pyx_t_9 = __pyx_t_10;
5349         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5350         goto __pyx_L13_bool_binop_done;
5351       }
5352       __Pyx_INCREF(__pyx_kp_s__6);
5353       __pyx_t_9 = __pyx_kp_s__6;
5354       __pyx_L13_bool_binop_done:;
5355       __pyx_t_10 = PyNumber_Add(__pyx_t_9, __pyx_v_data); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 154, __pyx_L5_except_error)
5356       __Pyx_GOTREF(__pyx_t_10);
5357       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
5358       if (__Pyx_PyObject_SetAttrStr(__pyx_v_last_element, __pyx_n_s_text, __pyx_t_10) < 0) __PYX_ERR(0, 154, __pyx_L5_except_error)
5359       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5360       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
5361       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5362       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
5363       goto __pyx_L4_exception_handled;
5364     }
5365     goto __pyx_L5_except_error;
5366     __pyx_L5_except_error:;
5367
5368     /* "lxml/sax.py":148
5369  *     def characters(self, data):
5370  *         last_element = self._element_stack[-1]
5371  *         try:             # <<<<<<<<<<<<<<
5372  *             # if there already is a child element, we must append to its tail
5373  *             last_element = last_element[-1]
5374  */
5375     __Pyx_XGIVEREF(__pyx_t_3);
5376     __Pyx_XGIVEREF(__pyx_t_4);
5377     __Pyx_XGIVEREF(__pyx_t_5);
5378     __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
5379     goto __pyx_L1_error;
5380     __pyx_L4_exception_handled:;
5381     __Pyx_XGIVEREF(__pyx_t_3);
5382     __Pyx_XGIVEREF(__pyx_t_4);
5383     __Pyx_XGIVEREF(__pyx_t_5);
5384     __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
5385     __pyx_L8_try_end:;
5386   }
5387
5388   /* "lxml/sax.py":146
5389  *         self.endElementNS((None, name), name)
5390  * 
5391  *     def characters(self, data):             # <<<<<<<<<<<<<<
5392  *         last_element = self._element_stack[-1]
5393  *         try:
5394  */
5395
5396   /* function exit code */
5397   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5398   goto __pyx_L0;
5399   __pyx_L1_error:;
5400   __Pyx_XDECREF(__pyx_t_1);
5401   __Pyx_XDECREF(__pyx_t_2);
5402   __Pyx_XDECREF(__pyx_t_8);
5403   __Pyx_XDECREF(__pyx_t_9);
5404   __Pyx_XDECREF(__pyx_t_10);
5405   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.characters", __pyx_clineno, __pyx_lineno, __pyx_filename);
5406   __pyx_r = NULL;
5407   __pyx_L0:;
5408   __Pyx_XDECREF(__pyx_v_last_element);
5409   __Pyx_XGIVEREF(__pyx_r);
5410   __Pyx_RefNannyFinishContext();
5411   return __pyx_r;
5412 }
5413
5414 /* "lxml/sax.py":162
5415  *     """Produces SAX events for an element and children.
5416  *     """
5417  *     def __init__(self, element_or_tree, content_handler):             # <<<<<<<<<<<<<<
5418  *         try:
5419  *             element = element_or_tree.getroot()
5420  */
5421
5422 /* Python wrapper */
5423 static int __pyx_pw_4lxml_3sax_19ElementTreeProducer_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5424 static int __pyx_pw_4lxml_3sax_19ElementTreeProducer_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5425   PyObject *__pyx_v_element_or_tree = 0;
5426   PyObject *__pyx_v_content_handler = 0;
5427   int __pyx_lineno = 0;
5428   const char *__pyx_filename = NULL;
5429   int __pyx_clineno = 0;
5430   int __pyx_r;
5431   __Pyx_RefNannyDeclarations
5432   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
5433   {
5434     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_element_or_tree,&__pyx_n_s_content_handler,0};
5435     PyObject* values[2] = {0,0};
5436     if (unlikely(__pyx_kwds)) {
5437       Py_ssize_t kw_args;
5438       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5439       switch (pos_args) {
5440         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5441         CYTHON_FALLTHROUGH;
5442         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5443         CYTHON_FALLTHROUGH;
5444         case  0: break;
5445         default: goto __pyx_L5_argtuple_error;
5446       }
5447       kw_args = PyDict_Size(__pyx_kwds);
5448       switch (pos_args) {
5449         case  0:
5450         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_element_or_tree)) != 0)) kw_args--;
5451         else goto __pyx_L5_argtuple_error;
5452         CYTHON_FALLTHROUGH;
5453         case  1:
5454         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_content_handler)) != 0)) kw_args--;
5455         else {
5456           __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 162, __pyx_L3_error)
5457         }
5458       }
5459       if (unlikely(kw_args > 0)) {
5460         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 162, __pyx_L3_error)
5461       }
5462     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
5463       goto __pyx_L5_argtuple_error;
5464     } else {
5465       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5466       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5467     }
5468     __pyx_v_element_or_tree = values[0];
5469     __pyx_v_content_handler = values[1];
5470   }
5471   goto __pyx_L4_argument_unpacking_done;
5472   __pyx_L5_argtuple_error:;
5473   __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 162, __pyx_L3_error)
5474   __pyx_L3_error:;
5475   __Pyx_AddTraceback("lxml.sax.ElementTreeProducer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5476   __Pyx_RefNannyFinishContext();
5477   return -1;
5478   __pyx_L4_argument_unpacking_done:;
5479   __pyx_r = __pyx_pf_4lxml_3sax_19ElementTreeProducer___init__(((struct __pyx_obj_4lxml_3sax_ElementTreeProducer *)__pyx_v_self), __pyx_v_element_or_tree, __pyx_v_content_handler);
5480
5481   /* function exit code */
5482   __Pyx_RefNannyFinishContext();
5483   return __pyx_r;
5484 }
5485
5486 static int __pyx_pf_4lxml_3sax_19ElementTreeProducer___init__(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *__pyx_v_self, PyObject *__pyx_v_element_or_tree, PyObject *__pyx_v_content_handler) {
5487   PyObject *__pyx_v_element = NULL;
5488   PyObject *__pyx_v_attr_class = NULL;
5489   int __pyx_r;
5490   __Pyx_RefNannyDeclarations
5491   PyObject *__pyx_t_1 = NULL;
5492   PyObject *__pyx_t_2 = NULL;
5493   PyObject *__pyx_t_3 = NULL;
5494   PyObject *__pyx_t_4 = NULL;
5495   PyObject *__pyx_t_5 = NULL;
5496   PyObject *__pyx_t_6 = NULL;
5497   int __pyx_t_7;
5498   PyObject *__pyx_t_8 = NULL;
5499   PyObject *__pyx_t_9 = NULL;
5500   PyObject *__pyx_t_10 = NULL;
5501   int __pyx_lineno = 0;
5502   const char *__pyx_filename = NULL;
5503   int __pyx_clineno = 0;
5504   __Pyx_RefNannySetupContext("__init__", 0);
5505
5506   /* "lxml/sax.py":163
5507  *     """
5508  *     def __init__(self, element_or_tree, content_handler):
5509  *         try:             # <<<<<<<<<<<<<<
5510  *             element = element_or_tree.getroot()
5511  *         except AttributeError:
5512  */
5513   {
5514     __Pyx_PyThreadState_declare
5515     __Pyx_PyThreadState_assign
5516     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
5517     __Pyx_XGOTREF(__pyx_t_1);
5518     __Pyx_XGOTREF(__pyx_t_2);
5519     __Pyx_XGOTREF(__pyx_t_3);
5520     /*try:*/ {
5521
5522       /* "lxml/sax.py":164
5523  *     def __init__(self, element_or_tree, content_handler):
5524  *         try:
5525  *             element = element_or_tree.getroot()             # <<<<<<<<<<<<<<
5526  *         except AttributeError:
5527  *             element = element_or_tree
5528  */
5529       __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_element_or_tree, __pyx_n_s_getroot); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 164, __pyx_L3_error)
5530       __Pyx_GOTREF(__pyx_t_5);
5531       __pyx_t_6 = NULL;
5532       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
5533         __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
5534         if (likely(__pyx_t_6)) {
5535           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
5536           __Pyx_INCREF(__pyx_t_6);
5537           __Pyx_INCREF(function);
5538           __Pyx_DECREF_SET(__pyx_t_5, function);
5539         }
5540       }
5541       __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
5542       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
5543       if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 164, __pyx_L3_error)
5544       __Pyx_GOTREF(__pyx_t_4);
5545       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5546       __pyx_v_element = __pyx_t_4;
5547       __pyx_t_4 = 0;
5548
5549       /* "lxml/sax.py":163
5550  *     """
5551  *     def __init__(self, element_or_tree, content_handler):
5552  *         try:             # <<<<<<<<<<<<<<
5553  *             element = element_or_tree.getroot()
5554  *         except AttributeError:
5555  */
5556     }
5557     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
5558     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5559     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5560     goto __pyx_L8_try_end;
5561     __pyx_L3_error:;
5562     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5563     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
5564     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
5565
5566     /* "lxml/sax.py":165
5567  *         try:
5568  *             element = element_or_tree.getroot()
5569  *         except AttributeError:             # <<<<<<<<<<<<<<
5570  *             element = element_or_tree
5571  *         self._element = element
5572  */
5573     __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
5574     if (__pyx_t_7) {
5575       __Pyx_AddTraceback("lxml.sax.ElementTreeProducer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5576       if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(0, 165, __pyx_L5_except_error)
5577       __Pyx_GOTREF(__pyx_t_4);
5578       __Pyx_GOTREF(__pyx_t_5);
5579       __Pyx_GOTREF(__pyx_t_6);
5580
5581       /* "lxml/sax.py":166
5582  *             element = element_or_tree.getroot()
5583  *         except AttributeError:
5584  *             element = element_or_tree             # <<<<<<<<<<<<<<
5585  *         self._element = element
5586  *         self._content_handler = content_handler
5587  */
5588       __Pyx_INCREF(__pyx_v_element_or_tree);
5589       __Pyx_XDECREF_SET(__pyx_v_element, __pyx_v_element_or_tree);
5590       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5591       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
5592       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
5593       goto __pyx_L4_exception_handled;
5594     }
5595     goto __pyx_L5_except_error;
5596     __pyx_L5_except_error:;
5597
5598     /* "lxml/sax.py":163
5599  *     """
5600  *     def __init__(self, element_or_tree, content_handler):
5601  *         try:             # <<<<<<<<<<<<<<
5602  *             element = element_or_tree.getroot()
5603  *         except AttributeError:
5604  */
5605     __Pyx_XGIVEREF(__pyx_t_1);
5606     __Pyx_XGIVEREF(__pyx_t_2);
5607     __Pyx_XGIVEREF(__pyx_t_3);
5608     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
5609     goto __pyx_L1_error;
5610     __pyx_L4_exception_handled:;
5611     __Pyx_XGIVEREF(__pyx_t_1);
5612     __Pyx_XGIVEREF(__pyx_t_2);
5613     __Pyx_XGIVEREF(__pyx_t_3);
5614     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
5615     __pyx_L8_try_end:;
5616   }
5617
5618   /* "lxml/sax.py":167
5619  *         except AttributeError:
5620  *             element = element_or_tree
5621  *         self._element = element             # <<<<<<<<<<<<<<
5622  *         self._content_handler = content_handler
5623  *         from xml.sax.xmlreader import AttributesNSImpl as attr_class
5624  */
5625   __Pyx_INCREF(__pyx_v_element);
5626   __Pyx_GIVEREF(__pyx_v_element);
5627   __Pyx_GOTREF(__pyx_v_self->_element);
5628   __Pyx_DECREF(__pyx_v_self->_element);
5629   __pyx_v_self->_element = __pyx_v_element;
5630
5631   /* "lxml/sax.py":168
5632  *             element = element_or_tree
5633  *         self._element = element
5634  *         self._content_handler = content_handler             # <<<<<<<<<<<<<<
5635  *         from xml.sax.xmlreader import AttributesNSImpl as attr_class
5636  *         self._attr_class = attr_class
5637  */
5638   __Pyx_INCREF(__pyx_v_content_handler);
5639   __Pyx_GIVEREF(__pyx_v_content_handler);
5640   __Pyx_GOTREF(__pyx_v_self->_content_handler);
5641   __Pyx_DECREF(__pyx_v_self->_content_handler);
5642   __pyx_v_self->_content_handler = __pyx_v_content_handler;
5643
5644   /* "lxml/sax.py":169
5645  *         self._element = element
5646  *         self._content_handler = content_handler
5647  *         from xml.sax.xmlreader import AttributesNSImpl as attr_class             # <<<<<<<<<<<<<<
5648  *         self._attr_class = attr_class
5649  *         self._empty_attributes = attr_class({}, {})
5650  */
5651   __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 169, __pyx_L1_error)
5652   __Pyx_GOTREF(__pyx_t_6);
5653   __Pyx_INCREF(__pyx_n_s_AttributesNSImpl);
5654   __Pyx_GIVEREF(__pyx_n_s_AttributesNSImpl);
5655   PyList_SET_ITEM(__pyx_t_6, 0, __pyx_n_s_AttributesNSImpl);
5656   __pyx_t_5 = __Pyx_Import(__pyx_n_s_xml_sax_xmlreader, __pyx_t_6, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 169, __pyx_L1_error)
5657   __Pyx_GOTREF(__pyx_t_5);
5658   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5659   __pyx_t_6 = __Pyx_ImportFrom(__pyx_t_5, __pyx_n_s_AttributesNSImpl); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 169, __pyx_L1_error)
5660   __Pyx_GOTREF(__pyx_t_6);
5661   __Pyx_INCREF(__pyx_t_6);
5662   __pyx_v_attr_class = __pyx_t_6;
5663   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5664   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5665
5666   /* "lxml/sax.py":170
5667  *         self._content_handler = content_handler
5668  *         from xml.sax.xmlreader import AttributesNSImpl as attr_class
5669  *         self._attr_class = attr_class             # <<<<<<<<<<<<<<
5670  *         self._empty_attributes = attr_class({}, {})
5671  * 
5672  */
5673   __Pyx_INCREF(__pyx_v_attr_class);
5674   __Pyx_GIVEREF(__pyx_v_attr_class);
5675   __Pyx_GOTREF(__pyx_v_self->_attr_class);
5676   __Pyx_DECREF(__pyx_v_self->_attr_class);
5677   __pyx_v_self->_attr_class = __pyx_v_attr_class;
5678
5679   /* "lxml/sax.py":171
5680  *         from xml.sax.xmlreader import AttributesNSImpl as attr_class
5681  *         self._attr_class = attr_class
5682  *         self._empty_attributes = attr_class({}, {})             # <<<<<<<<<<<<<<
5683  * 
5684  *     def saxify(self):
5685  */
5686   __pyx_t_6 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 171, __pyx_L1_error)
5687   __Pyx_GOTREF(__pyx_t_6);
5688   __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 171, __pyx_L1_error)
5689   __Pyx_GOTREF(__pyx_t_4);
5690   __Pyx_INCREF(__pyx_v_attr_class);
5691   __pyx_t_8 = __pyx_v_attr_class; __pyx_t_9 = NULL;
5692   __pyx_t_7 = 0;
5693   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
5694     __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
5695     if (likely(__pyx_t_9)) {
5696       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
5697       __Pyx_INCREF(__pyx_t_9);
5698       __Pyx_INCREF(function);
5699       __Pyx_DECREF_SET(__pyx_t_8, function);
5700       __pyx_t_7 = 1;
5701     }
5702   }
5703   #if CYTHON_FAST_PYCALL
5704   if (PyFunction_Check(__pyx_t_8)) {
5705     PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_6, __pyx_t_4};
5706     __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 171, __pyx_L1_error)
5707     __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5708     __Pyx_GOTREF(__pyx_t_5);
5709     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5710     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5711   } else
5712   #endif
5713   #if CYTHON_FAST_PYCCALL
5714   if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
5715     PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_6, __pyx_t_4};
5716     __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 171, __pyx_L1_error)
5717     __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5718     __Pyx_GOTREF(__pyx_t_5);
5719     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5720     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5721   } else
5722   #endif
5723   {
5724     __pyx_t_10 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 171, __pyx_L1_error)
5725     __Pyx_GOTREF(__pyx_t_10);
5726     if (__pyx_t_9) {
5727       __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL;
5728     }
5729     __Pyx_GIVEREF(__pyx_t_6);
5730     PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_7, __pyx_t_6);
5731     __Pyx_GIVEREF(__pyx_t_4);
5732     PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_7, __pyx_t_4);
5733     __pyx_t_6 = 0;
5734     __pyx_t_4 = 0;
5735     __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_10, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 171, __pyx_L1_error)
5736     __Pyx_GOTREF(__pyx_t_5);
5737     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5738   }
5739   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5740   __Pyx_GIVEREF(__pyx_t_5);
5741   __Pyx_GOTREF(__pyx_v_self->_empty_attributes);
5742   __Pyx_DECREF(__pyx_v_self->_empty_attributes);
5743   __pyx_v_self->_empty_attributes = __pyx_t_5;
5744   __pyx_t_5 = 0;
5745
5746   /* "lxml/sax.py":162
5747  *     """Produces SAX events for an element and children.
5748  *     """
5749  *     def __init__(self, element_or_tree, content_handler):             # <<<<<<<<<<<<<<
5750  *         try:
5751  *             element = element_or_tree.getroot()
5752  */
5753
5754   /* function exit code */
5755   __pyx_r = 0;
5756   goto __pyx_L0;
5757   __pyx_L1_error:;
5758   __Pyx_XDECREF(__pyx_t_4);
5759   __Pyx_XDECREF(__pyx_t_5);
5760   __Pyx_XDECREF(__pyx_t_6);
5761   __Pyx_XDECREF(__pyx_t_8);
5762   __Pyx_XDECREF(__pyx_t_9);
5763   __Pyx_XDECREF(__pyx_t_10);
5764   __Pyx_AddTraceback("lxml.sax.ElementTreeProducer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5765   __pyx_r = -1;
5766   __pyx_L0:;
5767   __Pyx_XDECREF(__pyx_v_element);
5768   __Pyx_XDECREF(__pyx_v_attr_class);
5769   __Pyx_RefNannyFinishContext();
5770   return __pyx_r;
5771 }
5772
5773 /* "lxml/sax.py":173
5774  *         self._empty_attributes = attr_class({}, {})
5775  * 
5776  *     def saxify(self):             # <<<<<<<<<<<<<<
5777  *         self._content_handler.startDocument()
5778  * 
5779  */
5780
5781 /* Python wrapper */
5782 static PyObject *__pyx_pw_4lxml_3sax_19ElementTreeProducer_3saxify(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
5783 static PyMethodDef __pyx_mdef_4lxml_3sax_19ElementTreeProducer_3saxify = {"saxify", (PyCFunction)__pyx_pw_4lxml_3sax_19ElementTreeProducer_3saxify, METH_NOARGS, 0};
5784 static PyObject *__pyx_pw_4lxml_3sax_19ElementTreeProducer_3saxify(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
5785   PyObject *__pyx_r = 0;
5786   __Pyx_RefNannyDeclarations
5787   __Pyx_RefNannySetupContext("saxify (wrapper)", 0);
5788   __pyx_r = __pyx_pf_4lxml_3sax_19ElementTreeProducer_2saxify(((struct __pyx_obj_4lxml_3sax_ElementTreeProducer *)__pyx_v_self));
5789
5790   /* function exit code */
5791   __Pyx_RefNannyFinishContext();
5792   return __pyx_r;
5793 }
5794
5795 static PyObject *__pyx_pf_4lxml_3sax_19ElementTreeProducer_2saxify(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *__pyx_v_self) {
5796   PyObject *__pyx_v_element = NULL;
5797   PyObject *__pyx_v_siblings = NULL;
5798   PyObject *__pyx_v_sibling = NULL;
5799   PyObject *__pyx_r = NULL;
5800   __Pyx_RefNannyDeclarations
5801   PyObject *__pyx_t_1 = NULL;
5802   PyObject *__pyx_t_2 = NULL;
5803   PyObject *__pyx_t_3 = NULL;
5804   int __pyx_t_4;
5805   int __pyx_t_5;
5806   int __pyx_t_6;
5807   Py_ssize_t __pyx_t_7;
5808   int __pyx_lineno = 0;
5809   const char *__pyx_filename = NULL;
5810   int __pyx_clineno = 0;
5811   __Pyx_RefNannySetupContext("saxify", 0);
5812
5813   /* "lxml/sax.py":174
5814  * 
5815  *     def saxify(self):
5816  *         self._content_handler.startDocument()             # <<<<<<<<<<<<<<
5817  * 
5818  *         element = self._element
5819  */
5820   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_content_handler, __pyx_n_s_startDocument); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 174, __pyx_L1_error)
5821   __Pyx_GOTREF(__pyx_t_2);
5822   __pyx_t_3 = NULL;
5823   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
5824     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
5825     if (likely(__pyx_t_3)) {
5826       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5827       __Pyx_INCREF(__pyx_t_3);
5828       __Pyx_INCREF(function);
5829       __Pyx_DECREF_SET(__pyx_t_2, function);
5830     }
5831   }
5832   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
5833   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5834   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error)
5835   __Pyx_GOTREF(__pyx_t_1);
5836   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5837   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5838
5839   /* "lxml/sax.py":176
5840  *         self._content_handler.startDocument()
5841  * 
5842  *         element = self._element             # <<<<<<<<<<<<<<
5843  *         if hasattr(element, 'getprevious'):
5844  *             siblings = []
5845  */
5846   __pyx_t_1 = __pyx_v_self->_element;
5847   __Pyx_INCREF(__pyx_t_1);
5848   __pyx_v_element = __pyx_t_1;
5849   __pyx_t_1 = 0;
5850
5851   /* "lxml/sax.py":177
5852  * 
5853  *         element = self._element
5854  *         if hasattr(element, 'getprevious'):             # <<<<<<<<<<<<<<
5855  *             siblings = []
5856  *             sibling = element.getprevious()
5857  */
5858   __pyx_t_4 = __Pyx_HasAttr(__pyx_v_element, __pyx_n_s_getprevious); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 177, __pyx_L1_error)
5859   __pyx_t_5 = (__pyx_t_4 != 0);
5860   if (__pyx_t_5) {
5861
5862     /* "lxml/sax.py":178
5863  *         element = self._element
5864  *         if hasattr(element, 'getprevious'):
5865  *             siblings = []             # <<<<<<<<<<<<<<
5866  *             sibling = element.getprevious()
5867  *             while getattr(sibling, 'tag', None) is ProcessingInstruction:
5868  */
5869     __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error)
5870     __Pyx_GOTREF(__pyx_t_1);
5871     __pyx_v_siblings = ((PyObject*)__pyx_t_1);
5872     __pyx_t_1 = 0;
5873
5874     /* "lxml/sax.py":179
5875  *         if hasattr(element, 'getprevious'):
5876  *             siblings = []
5877  *             sibling = element.getprevious()             # <<<<<<<<<<<<<<
5878  *             while getattr(sibling, 'tag', None) is ProcessingInstruction:
5879  *                 siblings.append(sibling)
5880  */
5881     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_element, __pyx_n_s_getprevious); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 179, __pyx_L1_error)
5882     __Pyx_GOTREF(__pyx_t_2);
5883     __pyx_t_3 = NULL;
5884     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
5885       __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
5886       if (likely(__pyx_t_3)) {
5887         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5888         __Pyx_INCREF(__pyx_t_3);
5889         __Pyx_INCREF(function);
5890         __Pyx_DECREF_SET(__pyx_t_2, function);
5891       }
5892     }
5893     __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
5894     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5895     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error)
5896     __Pyx_GOTREF(__pyx_t_1);
5897     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5898     __pyx_v_sibling = __pyx_t_1;
5899     __pyx_t_1 = 0;
5900
5901     /* "lxml/sax.py":180
5902  *             siblings = []
5903  *             sibling = element.getprevious()
5904  *             while getattr(sibling, 'tag', None) is ProcessingInstruction:             # <<<<<<<<<<<<<<
5905  *                 siblings.append(sibling)
5906  *                 sibling = sibling.getprevious()
5907  */
5908     while (1) {
5909       __pyx_t_1 = __Pyx_GetAttr3(__pyx_v_sibling, __pyx_n_s_tag, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
5910       __Pyx_GOTREF(__pyx_t_1);
5911       __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ProcessingInstruction); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error)
5912       __Pyx_GOTREF(__pyx_t_2);
5913       __pyx_t_5 = (__pyx_t_1 == __pyx_t_2);
5914       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5915       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5916       __pyx_t_4 = (__pyx_t_5 != 0);
5917       if (!__pyx_t_4) break;
5918
5919       /* "lxml/sax.py":181
5920  *             sibling = element.getprevious()
5921  *             while getattr(sibling, 'tag', None) is ProcessingInstruction:
5922  *                 siblings.append(sibling)             # <<<<<<<<<<<<<<
5923  *                 sibling = sibling.getprevious()
5924  *             for sibling in siblings[::-1]:
5925  */
5926       __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_siblings, __pyx_v_sibling); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 181, __pyx_L1_error)
5927
5928       /* "lxml/sax.py":182
5929  *             while getattr(sibling, 'tag', None) is ProcessingInstruction:
5930  *                 siblings.append(sibling)
5931  *                 sibling = sibling.getprevious()             # <<<<<<<<<<<<<<
5932  *             for sibling in siblings[::-1]:
5933  *                 self._recursive_saxify(sibling, {})
5934  */
5935       __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sibling, __pyx_n_s_getprevious); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error)
5936       __Pyx_GOTREF(__pyx_t_1);
5937       __pyx_t_3 = NULL;
5938       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
5939         __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
5940         if (likely(__pyx_t_3)) {
5941           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
5942           __Pyx_INCREF(__pyx_t_3);
5943           __Pyx_INCREF(function);
5944           __Pyx_DECREF_SET(__pyx_t_1, function);
5945         }
5946       }
5947       __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
5948       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5949       if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 182, __pyx_L1_error)
5950       __Pyx_GOTREF(__pyx_t_2);
5951       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5952       __Pyx_DECREF_SET(__pyx_v_sibling, __pyx_t_2);
5953       __pyx_t_2 = 0;
5954     }
5955
5956     /* "lxml/sax.py":183
5957  *                 siblings.append(sibling)
5958  *                 sibling = sibling.getprevious()
5959  *             for sibling in siblings[::-1]:             # <<<<<<<<<<<<<<
5960  *                 self._recursive_saxify(sibling, {})
5961  * 
5962  */
5963     __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_siblings, __pyx_slice__7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 183, __pyx_L1_error)
5964     __Pyx_GOTREF(__pyx_t_2);
5965     __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_7 = 0;
5966     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5967     for (;;) {
5968       if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_1)) break;
5969       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5970       __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 183, __pyx_L1_error)
5971       #else
5972       __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 183, __pyx_L1_error)
5973       __Pyx_GOTREF(__pyx_t_2);
5974       #endif
5975       __Pyx_DECREF_SET(__pyx_v_sibling, __pyx_t_2);
5976       __pyx_t_2 = 0;
5977
5978       /* "lxml/sax.py":184
5979  *                 sibling = sibling.getprevious()
5980  *             for sibling in siblings[::-1]:
5981  *                 self._recursive_saxify(sibling, {})             # <<<<<<<<<<<<<<
5982  * 
5983  *         self._recursive_saxify(element, {})
5984  */
5985       __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 184, __pyx_L1_error)
5986       __Pyx_GOTREF(__pyx_t_2);
5987       __pyx_t_3 = __pyx_f_4lxml_3sax_19ElementTreeProducer__recursive_saxify(__pyx_v_self, __pyx_v_sibling, ((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L1_error)
5988       __Pyx_GOTREF(__pyx_t_3);
5989       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5990       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5991
5992       /* "lxml/sax.py":183
5993  *                 siblings.append(sibling)
5994  *                 sibling = sibling.getprevious()
5995  *             for sibling in siblings[::-1]:             # <<<<<<<<<<<<<<
5996  *                 self._recursive_saxify(sibling, {})
5997  * 
5998  */
5999     }
6000     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6001
6002     /* "lxml/sax.py":177
6003  * 
6004  *         element = self._element
6005  *         if hasattr(element, 'getprevious'):             # <<<<<<<<<<<<<<
6006  *             siblings = []
6007  *             sibling = element.getprevious()
6008  */
6009   }
6010
6011   /* "lxml/sax.py":186
6012  *                 self._recursive_saxify(sibling, {})
6013  * 
6014  *         self._recursive_saxify(element, {})             # <<<<<<<<<<<<<<
6015  * 
6016  *         if hasattr(element, 'getnext'):
6017  */
6018   __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error)
6019   __Pyx_GOTREF(__pyx_t_1);
6020   __pyx_t_3 = __pyx_f_4lxml_3sax_19ElementTreeProducer__recursive_saxify(__pyx_v_self, __pyx_v_element, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 186, __pyx_L1_error)
6021   __Pyx_GOTREF(__pyx_t_3);
6022   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6023   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6024
6025   /* "lxml/sax.py":188
6026  *         self._recursive_saxify(element, {})
6027  * 
6028  *         if hasattr(element, 'getnext'):             # <<<<<<<<<<<<<<
6029  *             sibling = element.getnext()
6030  *             while getattr(sibling, 'tag', None) is ProcessingInstruction:
6031  */
6032   __pyx_t_4 = __Pyx_HasAttr(__pyx_v_element, __pyx_n_s_getnext); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 188, __pyx_L1_error)
6033   __pyx_t_5 = (__pyx_t_4 != 0);
6034   if (__pyx_t_5) {
6035
6036     /* "lxml/sax.py":189
6037  * 
6038  *         if hasattr(element, 'getnext'):
6039  *             sibling = element.getnext()             # <<<<<<<<<<<<<<
6040  *             while getattr(sibling, 'tag', None) is ProcessingInstruction:
6041  *                 self._recursive_saxify(sibling, {})
6042  */
6043     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_element, __pyx_n_s_getnext); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error)
6044     __Pyx_GOTREF(__pyx_t_1);
6045     __pyx_t_2 = NULL;
6046     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
6047       __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
6048       if (likely(__pyx_t_2)) {
6049         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
6050         __Pyx_INCREF(__pyx_t_2);
6051         __Pyx_INCREF(function);
6052         __Pyx_DECREF_SET(__pyx_t_1, function);
6053       }
6054     }
6055     __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
6056     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6057     if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 189, __pyx_L1_error)
6058     __Pyx_GOTREF(__pyx_t_3);
6059     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6060     __Pyx_XDECREF_SET(__pyx_v_sibling, __pyx_t_3);
6061     __pyx_t_3 = 0;
6062
6063     /* "lxml/sax.py":190
6064  *         if hasattr(element, 'getnext'):
6065  *             sibling = element.getnext()
6066  *             while getattr(sibling, 'tag', None) is ProcessingInstruction:             # <<<<<<<<<<<<<<
6067  *                 self._recursive_saxify(sibling, {})
6068  *                 sibling = sibling.getnext()
6069  */
6070     while (1) {
6071       __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_sibling, __pyx_n_s_tag, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 190, __pyx_L1_error)
6072       __Pyx_GOTREF(__pyx_t_3);
6073       __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_ProcessingInstruction); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error)
6074       __Pyx_GOTREF(__pyx_t_1);
6075       __pyx_t_5 = (__pyx_t_3 == __pyx_t_1);
6076       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6077       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6078       __pyx_t_4 = (__pyx_t_5 != 0);
6079       if (!__pyx_t_4) break;
6080
6081       /* "lxml/sax.py":191
6082  *             sibling = element.getnext()
6083  *             while getattr(sibling, 'tag', None) is ProcessingInstruction:
6084  *                 self._recursive_saxify(sibling, {})             # <<<<<<<<<<<<<<
6085  *                 sibling = sibling.getnext()
6086  * 
6087  */
6088       __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __pyx_L1_error)
6089       __Pyx_GOTREF(__pyx_t_1);
6090       __pyx_t_3 = __pyx_f_4lxml_3sax_19ElementTreeProducer__recursive_saxify(__pyx_v_self, __pyx_v_sibling, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 191, __pyx_L1_error)
6091       __Pyx_GOTREF(__pyx_t_3);
6092       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6093       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6094
6095       /* "lxml/sax.py":192
6096  *             while getattr(sibling, 'tag', None) is ProcessingInstruction:
6097  *                 self._recursive_saxify(sibling, {})
6098  *                 sibling = sibling.getnext()             # <<<<<<<<<<<<<<
6099  * 
6100  *         self._content_handler.endDocument()
6101  */
6102       __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sibling, __pyx_n_s_getnext); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error)
6103       __Pyx_GOTREF(__pyx_t_1);
6104       __pyx_t_2 = NULL;
6105       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
6106         __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
6107         if (likely(__pyx_t_2)) {
6108           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
6109           __Pyx_INCREF(__pyx_t_2);
6110           __Pyx_INCREF(function);
6111           __Pyx_DECREF_SET(__pyx_t_1, function);
6112         }
6113       }
6114       __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
6115       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6116       if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 192, __pyx_L1_error)
6117       __Pyx_GOTREF(__pyx_t_3);
6118       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6119       __Pyx_DECREF_SET(__pyx_v_sibling, __pyx_t_3);
6120       __pyx_t_3 = 0;
6121     }
6122
6123     /* "lxml/sax.py":188
6124  *         self._recursive_saxify(element, {})
6125  * 
6126  *         if hasattr(element, 'getnext'):             # <<<<<<<<<<<<<<
6127  *             sibling = element.getnext()
6128  *             while getattr(sibling, 'tag', None) is ProcessingInstruction:
6129  */
6130   }
6131
6132   /* "lxml/sax.py":194
6133  *                 sibling = sibling.getnext()
6134  * 
6135  *         self._content_handler.endDocument()             # <<<<<<<<<<<<<<
6136  * 
6137  *     def _recursive_saxify(self, element, parent_nsmap):
6138  */
6139   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_content_handler, __pyx_n_s_endDocument); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 194, __pyx_L1_error)
6140   __Pyx_GOTREF(__pyx_t_1);
6141   __pyx_t_2 = NULL;
6142   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
6143     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
6144     if (likely(__pyx_t_2)) {
6145       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
6146       __Pyx_INCREF(__pyx_t_2);
6147       __Pyx_INCREF(function);
6148       __Pyx_DECREF_SET(__pyx_t_1, function);
6149     }
6150   }
6151   __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
6152   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6153   if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 194, __pyx_L1_error)
6154   __Pyx_GOTREF(__pyx_t_3);
6155   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6156   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6157
6158   /* "lxml/sax.py":173
6159  *         self._empty_attributes = attr_class({}, {})
6160  * 
6161  *     def saxify(self):             # <<<<<<<<<<<<<<
6162  *         self._content_handler.startDocument()
6163  * 
6164  */
6165
6166   /* function exit code */
6167   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6168   goto __pyx_L0;
6169   __pyx_L1_error:;
6170   __Pyx_XDECREF(__pyx_t_1);
6171   __Pyx_XDECREF(__pyx_t_2);
6172   __Pyx_XDECREF(__pyx_t_3);
6173   __Pyx_AddTraceback("lxml.sax.ElementTreeProducer.saxify", __pyx_clineno, __pyx_lineno, __pyx_filename);
6174   __pyx_r = NULL;
6175   __pyx_L0:;
6176   __Pyx_XDECREF(__pyx_v_element);
6177   __Pyx_XDECREF(__pyx_v_siblings);
6178   __Pyx_XDECREF(__pyx_v_sibling);
6179   __Pyx_XGIVEREF(__pyx_r);
6180   __Pyx_RefNannyFinishContext();
6181   return __pyx_r;
6182 }
6183
6184 /* "lxml/sax.py":196
6185  *         self._content_handler.endDocument()
6186  * 
6187  *     def _recursive_saxify(self, element, parent_nsmap):             # <<<<<<<<<<<<<<
6188  *         content_handler = self._content_handler
6189  *         tag = element.tag
6190  */
6191
6192 static CYTHON_INLINE PyObject *__pyx_f_4lxml_3sax_19ElementTreeProducer__recursive_saxify(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *__pyx_v_self, PyObject *__pyx_v_element, PyObject *__pyx_v_parent_nsmap) {
6193   PyObject *__pyx_v_element_nsmap = 0;
6194   PyObject *__pyx_v_content_handler = NULL;
6195   PyObject *__pyx_v_tag = NULL;
6196   PyObject *__pyx_v_tail = NULL;
6197   PyObject *__pyx_v_new_prefixes = NULL;
6198   PyObject *__pyx_v_prefix = NULL;
6199   PyObject *__pyx_v_ns_uri = NULL;
6200   PyObject *__pyx_v_attribs = NULL;
6201   PyObject *__pyx_v_attr_values = NULL;
6202   PyObject *__pyx_v_attr_qnames = NULL;
6203   PyObject *__pyx_v_attr_ns_name = NULL;
6204   PyObject *__pyx_v_value = NULL;
6205   PyObject *__pyx_v_attr_ns_tuple = NULL;
6206   PyObject *__pyx_v_sax_attributes = NULL;
6207   PyObject *__pyx_v_local_name = NULL;
6208   PyObject *__pyx_v_qname = NULL;
6209   PyObject *__pyx_v_uri = NULL;
6210   PyObject *__pyx_v_text = NULL;
6211   PyObject *__pyx_v_child = NULL;
6212   PyObject *__pyx_r = NULL;
6213   __Pyx_RefNannyDeclarations
6214   PyObject *__pyx_t_1 = NULL;
6215   int __pyx_t_2;
6216   int __pyx_t_3;
6217   int __pyx_t_4;
6218   PyObject *__pyx_t_5 = NULL;
6219   PyObject *__pyx_t_6 = NULL;
6220   PyObject *__pyx_t_7 = NULL;
6221   PyObject *__pyx_t_8 = NULL;
6222   int __pyx_t_9;
6223   PyObject *__pyx_t_10 = NULL;
6224   Py_ssize_t __pyx_t_11;
6225   PyObject *(*__pyx_t_12)(PyObject *);
6226   PyObject *(*__pyx_t_13)(PyObject *);
6227   int __pyx_t_14;
6228   int __pyx_lineno = 0;
6229   const char *__pyx_filename = NULL;
6230   int __pyx_clineno = 0;
6231   __Pyx_RefNannySetupContext("_recursive_saxify", 0);
6232
6233   /* "lxml/sax.py":197
6234  * 
6235  *     def _recursive_saxify(self, element, parent_nsmap):
6236  *         content_handler = self._content_handler             # <<<<<<<<<<<<<<
6237  *         tag = element.tag
6238  *         if tag is Comment or tag is ProcessingInstruction:
6239  */
6240   __pyx_t_1 = __pyx_v_self->_content_handler;
6241   __Pyx_INCREF(__pyx_t_1);
6242   __pyx_v_content_handler = __pyx_t_1;
6243   __pyx_t_1 = 0;
6244
6245   /* "lxml/sax.py":198
6246  *     def _recursive_saxify(self, element, parent_nsmap):
6247  *         content_handler = self._content_handler
6248  *         tag = element.tag             # <<<<<<<<<<<<<<
6249  *         if tag is Comment or tag is ProcessingInstruction:
6250  *             if tag is ProcessingInstruction:
6251  */
6252   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_element, __pyx_n_s_tag); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 198, __pyx_L1_error)
6253   __Pyx_GOTREF(__pyx_t_1);
6254   __pyx_v_tag = __pyx_t_1;
6255   __pyx_t_1 = 0;
6256
6257   /* "lxml/sax.py":199
6258  *         content_handler = self._content_handler
6259  *         tag = element.tag
6260  *         if tag is Comment or tag is ProcessingInstruction:             # <<<<<<<<<<<<<<
6261  *             if tag is ProcessingInstruction:
6262  *                 content_handler.processingInstruction(
6263  */
6264   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Comment); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error)
6265   __Pyx_GOTREF(__pyx_t_1);
6266   __pyx_t_3 = (__pyx_v_tag == __pyx_t_1);
6267   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6268   __pyx_t_4 = (__pyx_t_3 != 0);
6269   if (!__pyx_t_4) {
6270   } else {
6271     __pyx_t_2 = __pyx_t_4;
6272     goto __pyx_L4_bool_binop_done;
6273   }
6274   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_ProcessingInstruction); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error)
6275   __Pyx_GOTREF(__pyx_t_1);
6276   __pyx_t_4 = (__pyx_v_tag == __pyx_t_1);
6277   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6278   __pyx_t_3 = (__pyx_t_4 != 0);
6279   __pyx_t_2 = __pyx_t_3;
6280   __pyx_L4_bool_binop_done:;
6281   if (__pyx_t_2) {
6282
6283     /* "lxml/sax.py":200
6284  *         tag = element.tag
6285  *         if tag is Comment or tag is ProcessingInstruction:
6286  *             if tag is ProcessingInstruction:             # <<<<<<<<<<<<<<
6287  *                 content_handler.processingInstruction(
6288  *                     element.target, element.text)
6289  */
6290     __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_ProcessingInstruction); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 200, __pyx_L1_error)
6291     __Pyx_GOTREF(__pyx_t_1);
6292     __pyx_t_2 = (__pyx_v_tag == __pyx_t_1);
6293     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6294     __pyx_t_3 = (__pyx_t_2 != 0);
6295     if (__pyx_t_3) {
6296
6297       /* "lxml/sax.py":201
6298  *         if tag is Comment or tag is ProcessingInstruction:
6299  *             if tag is ProcessingInstruction:
6300  *                 content_handler.processingInstruction(             # <<<<<<<<<<<<<<
6301  *                     element.target, element.text)
6302  *             tail = element.tail
6303  */
6304       __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_content_handler, __pyx_n_s_processingInstruction); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 201, __pyx_L1_error)
6305       __Pyx_GOTREF(__pyx_t_5);
6306
6307       /* "lxml/sax.py":202
6308  *             if tag is ProcessingInstruction:
6309  *                 content_handler.processingInstruction(
6310  *                     element.target, element.text)             # <<<<<<<<<<<<<<
6311  *             tail = element.tail
6312  *             if tail:
6313  */
6314       __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_element, __pyx_n_s_target); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 202, __pyx_L1_error)
6315       __Pyx_GOTREF(__pyx_t_6);
6316       __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_element, __pyx_n_s_text); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 202, __pyx_L1_error)
6317       __Pyx_GOTREF(__pyx_t_7);
6318       __pyx_t_8 = NULL;
6319       __pyx_t_9 = 0;
6320       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
6321         __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
6322         if (likely(__pyx_t_8)) {
6323           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
6324           __Pyx_INCREF(__pyx_t_8);
6325           __Pyx_INCREF(function);
6326           __Pyx_DECREF_SET(__pyx_t_5, function);
6327           __pyx_t_9 = 1;
6328         }
6329       }
6330       #if CYTHON_FAST_PYCALL
6331       if (PyFunction_Check(__pyx_t_5)) {
6332         PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_6, __pyx_t_7};
6333         __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error)
6334         __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
6335         __Pyx_GOTREF(__pyx_t_1);
6336         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6337         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6338       } else
6339       #endif
6340       #if CYTHON_FAST_PYCCALL
6341       if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
6342         PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_6, __pyx_t_7};
6343         __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error)
6344         __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
6345         __Pyx_GOTREF(__pyx_t_1);
6346         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6347         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6348       } else
6349       #endif
6350       {
6351         __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 201, __pyx_L1_error)
6352         __Pyx_GOTREF(__pyx_t_10);
6353         if (__pyx_t_8) {
6354           __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
6355         }
6356         __Pyx_GIVEREF(__pyx_t_6);
6357         PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_6);
6358         __Pyx_GIVEREF(__pyx_t_7);
6359         PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_7);
6360         __pyx_t_6 = 0;
6361         __pyx_t_7 = 0;
6362         __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error)
6363         __Pyx_GOTREF(__pyx_t_1);
6364         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6365       }
6366       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6367       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6368
6369       /* "lxml/sax.py":200
6370  *         tag = element.tag
6371  *         if tag is Comment or tag is ProcessingInstruction:
6372  *             if tag is ProcessingInstruction:             # <<<<<<<<<<<<<<
6373  *                 content_handler.processingInstruction(
6374  *                     element.target, element.text)
6375  */
6376     }
6377
6378     /* "lxml/sax.py":203
6379  *                 content_handler.processingInstruction(
6380  *                     element.target, element.text)
6381  *             tail = element.tail             # <<<<<<<<<<<<<<
6382  *             if tail:
6383  *                 content_handler.characters(tail)
6384  */
6385     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_element, __pyx_n_s_tail); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error)
6386     __Pyx_GOTREF(__pyx_t_1);
6387     __pyx_v_tail = __pyx_t_1;
6388     __pyx_t_1 = 0;
6389
6390     /* "lxml/sax.py":204
6391  *                     element.target, element.text)
6392  *             tail = element.tail
6393  *             if tail:             # <<<<<<<<<<<<<<
6394  *                 content_handler.characters(tail)
6395  *             return
6396  */
6397     __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_tail); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 204, __pyx_L1_error)
6398     if (__pyx_t_3) {
6399
6400       /* "lxml/sax.py":205
6401  *             tail = element.tail
6402  *             if tail:
6403  *                 content_handler.characters(tail)             # <<<<<<<<<<<<<<
6404  *             return
6405  * 
6406  */
6407       __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_content_handler, __pyx_n_s_characters); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 205, __pyx_L1_error)
6408       __Pyx_GOTREF(__pyx_t_5);
6409       __pyx_t_10 = NULL;
6410       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
6411         __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_5);
6412         if (likely(__pyx_t_10)) {
6413           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
6414           __Pyx_INCREF(__pyx_t_10);
6415           __Pyx_INCREF(function);
6416           __Pyx_DECREF_SET(__pyx_t_5, function);
6417         }
6418       }
6419       __pyx_t_1 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_10, __pyx_v_tail) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_tail);
6420       __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
6421       if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error)
6422       __Pyx_GOTREF(__pyx_t_1);
6423       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6424       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6425
6426       /* "lxml/sax.py":204
6427  *                     element.target, element.text)
6428  *             tail = element.tail
6429  *             if tail:             # <<<<<<<<<<<<<<
6430  *                 content_handler.characters(tail)
6431  *             return
6432  */
6433     }
6434
6435     /* "lxml/sax.py":206
6436  *             if tail:
6437  *                 content_handler.characters(tail)
6438  *             return             # <<<<<<<<<<<<<<
6439  * 
6440  *         element_nsmap = element.nsmap
6441  */
6442     __Pyx_XDECREF(__pyx_r);
6443     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6444     goto __pyx_L0;
6445
6446     /* "lxml/sax.py":199
6447  *         content_handler = self._content_handler
6448  *         tag = element.tag
6449  *         if tag is Comment or tag is ProcessingInstruction:             # <<<<<<<<<<<<<<
6450  *             if tag is ProcessingInstruction:
6451  *                 content_handler.processingInstruction(
6452  */
6453   }
6454
6455   /* "lxml/sax.py":208
6456  *             return
6457  * 
6458  *         element_nsmap = element.nsmap             # <<<<<<<<<<<<<<
6459  *         new_prefixes = []
6460  *         if element_nsmap != parent_nsmap:
6461  */
6462   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_element, __pyx_n_s_nsmap); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error)
6463   __Pyx_GOTREF(__pyx_t_1);
6464   if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 208, __pyx_L1_error)
6465   __pyx_v_element_nsmap = ((PyObject*)__pyx_t_1);
6466   __pyx_t_1 = 0;
6467
6468   /* "lxml/sax.py":209
6469  * 
6470  *         element_nsmap = element.nsmap
6471  *         new_prefixes = []             # <<<<<<<<<<<<<<
6472  *         if element_nsmap != parent_nsmap:
6473  *             # There have been updates to the namespace
6474  */
6475   __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __pyx_L1_error)
6476   __Pyx_GOTREF(__pyx_t_1);
6477   __pyx_v_new_prefixes = ((PyObject*)__pyx_t_1);
6478   __pyx_t_1 = 0;
6479
6480   /* "lxml/sax.py":210
6481  *         element_nsmap = element.nsmap
6482  *         new_prefixes = []
6483  *         if element_nsmap != parent_nsmap:             # <<<<<<<<<<<<<<
6484  *             # There have been updates to the namespace
6485  *             for prefix, ns_uri in element_nsmap.items():
6486  */
6487   __pyx_t_1 = PyObject_RichCompare(__pyx_v_element_nsmap, __pyx_v_parent_nsmap, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error)
6488   __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 210, __pyx_L1_error)
6489   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6490   if (__pyx_t_3) {
6491
6492     /* "lxml/sax.py":212
6493  *         if element_nsmap != parent_nsmap:
6494  *             # There have been updates to the namespace
6495  *             for prefix, ns_uri in element_nsmap.items():             # <<<<<<<<<<<<<<
6496  *                 if parent_nsmap.get(prefix) != ns_uri:
6497  *                     new_prefixes.append( (prefix, ns_uri) )
6498  */
6499     if (unlikely(__pyx_v_element_nsmap == Py_None)) {
6500       PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
6501       __PYX_ERR(0, 212, __pyx_L1_error)
6502     }
6503     __pyx_t_1 = __Pyx_PyDict_Items(__pyx_v_element_nsmap); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error)
6504     __Pyx_GOTREF(__pyx_t_1);
6505     if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
6506       __pyx_t_5 = __pyx_t_1; __Pyx_INCREF(__pyx_t_5); __pyx_t_11 = 0;
6507       __pyx_t_12 = NULL;
6508     } else {
6509       __pyx_t_11 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 212, __pyx_L1_error)
6510       __Pyx_GOTREF(__pyx_t_5);
6511       __pyx_t_12 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 212, __pyx_L1_error)
6512     }
6513     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6514     for (;;) {
6515       if (likely(!__pyx_t_12)) {
6516         if (likely(PyList_CheckExact(__pyx_t_5))) {
6517           if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_5)) break;
6518           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6519           __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 212, __pyx_L1_error)
6520           #else
6521           __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error)
6522           __Pyx_GOTREF(__pyx_t_1);
6523           #endif
6524         } else {
6525           if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
6526           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6527           __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 212, __pyx_L1_error)
6528           #else
6529           __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error)
6530           __Pyx_GOTREF(__pyx_t_1);
6531           #endif
6532         }
6533       } else {
6534         __pyx_t_1 = __pyx_t_12(__pyx_t_5);
6535         if (unlikely(!__pyx_t_1)) {
6536           PyObject* exc_type = PyErr_Occurred();
6537           if (exc_type) {
6538             if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
6539             else __PYX_ERR(0, 212, __pyx_L1_error)
6540           }
6541           break;
6542         }
6543         __Pyx_GOTREF(__pyx_t_1);
6544       }
6545       if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
6546         PyObject* sequence = __pyx_t_1;
6547         Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
6548         if (unlikely(size != 2)) {
6549           if (size > 2) __Pyx_RaiseTooManyValuesError(2);
6550           else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
6551           __PYX_ERR(0, 212, __pyx_L1_error)
6552         }
6553         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6554         if (likely(PyTuple_CheckExact(sequence))) {
6555           __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0); 
6556           __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
6557         } else {
6558           __pyx_t_10 = PyList_GET_ITEM(sequence, 0); 
6559           __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
6560         }
6561         __Pyx_INCREF(__pyx_t_10);
6562         __Pyx_INCREF(__pyx_t_7);
6563         #else
6564         __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 212, __pyx_L1_error)
6565         __Pyx_GOTREF(__pyx_t_10);
6566         __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 212, __pyx_L1_error)
6567         __Pyx_GOTREF(__pyx_t_7);
6568         #endif
6569         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6570       } else {
6571         Py_ssize_t index = -1;
6572         __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 212, __pyx_L1_error)
6573         __Pyx_GOTREF(__pyx_t_6);
6574         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6575         __pyx_t_13 = Py_TYPE(__pyx_t_6)->tp_iternext;
6576         index = 0; __pyx_t_10 = __pyx_t_13(__pyx_t_6); if (unlikely(!__pyx_t_10)) goto __pyx_L11_unpacking_failed;
6577         __Pyx_GOTREF(__pyx_t_10);
6578         index = 1; __pyx_t_7 = __pyx_t_13(__pyx_t_6); if (unlikely(!__pyx_t_7)) goto __pyx_L11_unpacking_failed;
6579         __Pyx_GOTREF(__pyx_t_7);
6580         if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_6), 2) < 0) __PYX_ERR(0, 212, __pyx_L1_error)
6581         __pyx_t_13 = NULL;
6582         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6583         goto __pyx_L12_unpacking_done;
6584         __pyx_L11_unpacking_failed:;
6585         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6586         __pyx_t_13 = NULL;
6587         if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
6588         __PYX_ERR(0, 212, __pyx_L1_error)
6589         __pyx_L12_unpacking_done:;
6590       }
6591       __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_10);
6592       __pyx_t_10 = 0;
6593       __Pyx_XDECREF_SET(__pyx_v_ns_uri, __pyx_t_7);
6594       __pyx_t_7 = 0;
6595
6596       /* "lxml/sax.py":213
6597  *             # There have been updates to the namespace
6598  *             for prefix, ns_uri in element_nsmap.items():
6599  *                 if parent_nsmap.get(prefix) != ns_uri:             # <<<<<<<<<<<<<<
6600  *                     new_prefixes.append( (prefix, ns_uri) )
6601  * 
6602  */
6603       if (unlikely(__pyx_v_parent_nsmap == Py_None)) {
6604         PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get");
6605         __PYX_ERR(0, 213, __pyx_L1_error)
6606       }
6607       __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_parent_nsmap, __pyx_v_prefix, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error)
6608       __Pyx_GOTREF(__pyx_t_1);
6609       __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_v_ns_uri, Py_NE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 213, __pyx_L1_error)
6610       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6611       __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 213, __pyx_L1_error)
6612       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6613       if (__pyx_t_3) {
6614
6615         /* "lxml/sax.py":214
6616  *             for prefix, ns_uri in element_nsmap.items():
6617  *                 if parent_nsmap.get(prefix) != ns_uri:
6618  *                     new_prefixes.append( (prefix, ns_uri) )             # <<<<<<<<<<<<<<
6619  * 
6620  *         attribs = element.items()
6621  */
6622         __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 214, __pyx_L1_error)
6623         __Pyx_GOTREF(__pyx_t_7);
6624         __Pyx_INCREF(__pyx_v_prefix);
6625         __Pyx_GIVEREF(__pyx_v_prefix);
6626         PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_prefix);
6627         __Pyx_INCREF(__pyx_v_ns_uri);
6628         __Pyx_GIVEREF(__pyx_v_ns_uri);
6629         PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_ns_uri);
6630         __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_new_prefixes, __pyx_t_7); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 214, __pyx_L1_error)
6631         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6632
6633         /* "lxml/sax.py":213
6634  *             # There have been updates to the namespace
6635  *             for prefix, ns_uri in element_nsmap.items():
6636  *                 if parent_nsmap.get(prefix) != ns_uri:             # <<<<<<<<<<<<<<
6637  *                     new_prefixes.append( (prefix, ns_uri) )
6638  * 
6639  */
6640       }
6641
6642       /* "lxml/sax.py":212
6643  *         if element_nsmap != parent_nsmap:
6644  *             # There have been updates to the namespace
6645  *             for prefix, ns_uri in element_nsmap.items():             # <<<<<<<<<<<<<<
6646  *                 if parent_nsmap.get(prefix) != ns_uri:
6647  *                     new_prefixes.append( (prefix, ns_uri) )
6648  */
6649     }
6650     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6651
6652     /* "lxml/sax.py":210
6653  *         element_nsmap = element.nsmap
6654  *         new_prefixes = []
6655  *         if element_nsmap != parent_nsmap:             # <<<<<<<<<<<<<<
6656  *             # There have been updates to the namespace
6657  *             for prefix, ns_uri in element_nsmap.items():
6658  */
6659   }
6660
6661   /* "lxml/sax.py":216
6662  *                     new_prefixes.append( (prefix, ns_uri) )
6663  * 
6664  *         attribs = element.items()             # <<<<<<<<<<<<<<
6665  *         if attribs:
6666  *             attr_values = {}
6667  */
6668   __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_element, __pyx_n_s_items); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 216, __pyx_L1_error)
6669   __Pyx_GOTREF(__pyx_t_7);
6670   __pyx_t_1 = NULL;
6671   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
6672     __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
6673     if (likely(__pyx_t_1)) {
6674       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
6675       __Pyx_INCREF(__pyx_t_1);
6676       __Pyx_INCREF(function);
6677       __Pyx_DECREF_SET(__pyx_t_7, function);
6678     }
6679   }
6680   __pyx_t_5 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
6681   __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
6682   if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 216, __pyx_L1_error)
6683   __Pyx_GOTREF(__pyx_t_5);
6684   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6685   __pyx_v_attribs = __pyx_t_5;
6686   __pyx_t_5 = 0;
6687
6688   /* "lxml/sax.py":217
6689  * 
6690  *         attribs = element.items()
6691  *         if attribs:             # <<<<<<<<<<<<<<
6692  *             attr_values = {}
6693  *             attr_qnames = {}
6694  */
6695   __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_attribs); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 217, __pyx_L1_error)
6696   if (__pyx_t_3) {
6697
6698     /* "lxml/sax.py":218
6699  *         attribs = element.items()
6700  *         if attribs:
6701  *             attr_values = {}             # <<<<<<<<<<<<<<
6702  *             attr_qnames = {}
6703  *             for attr_ns_name, value in attribs:
6704  */
6705     __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 218, __pyx_L1_error)
6706     __Pyx_GOTREF(__pyx_t_5);
6707     __pyx_v_attr_values = ((PyObject*)__pyx_t_5);
6708     __pyx_t_5 = 0;
6709
6710     /* "lxml/sax.py":219
6711  *         if attribs:
6712  *             attr_values = {}
6713  *             attr_qnames = {}             # <<<<<<<<<<<<<<
6714  *             for attr_ns_name, value in attribs:
6715  *                 attr_ns_tuple = _getNsTag(attr_ns_name)
6716  */
6717     __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 219, __pyx_L1_error)
6718     __Pyx_GOTREF(__pyx_t_5);
6719     __pyx_v_attr_qnames = ((PyObject*)__pyx_t_5);
6720     __pyx_t_5 = 0;
6721
6722     /* "lxml/sax.py":220
6723  *             attr_values = {}
6724  *             attr_qnames = {}
6725  *             for attr_ns_name, value in attribs:             # <<<<<<<<<<<<<<
6726  *                 attr_ns_tuple = _getNsTag(attr_ns_name)
6727  *                 attr_values[attr_ns_tuple] = value
6728  */
6729     if (likely(PyList_CheckExact(__pyx_v_attribs)) || PyTuple_CheckExact(__pyx_v_attribs)) {
6730       __pyx_t_5 = __pyx_v_attribs; __Pyx_INCREF(__pyx_t_5); __pyx_t_11 = 0;
6731       __pyx_t_12 = NULL;
6732     } else {
6733       __pyx_t_11 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_attribs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 220, __pyx_L1_error)
6734       __Pyx_GOTREF(__pyx_t_5);
6735       __pyx_t_12 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 220, __pyx_L1_error)
6736     }
6737     for (;;) {
6738       if (likely(!__pyx_t_12)) {
6739         if (likely(PyList_CheckExact(__pyx_t_5))) {
6740           if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_5)) break;
6741           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6742           __pyx_t_7 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_11); __Pyx_INCREF(__pyx_t_7); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 220, __pyx_L1_error)
6743           #else
6744           __pyx_t_7 = PySequence_ITEM(__pyx_t_5, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 220, __pyx_L1_error)
6745           __Pyx_GOTREF(__pyx_t_7);
6746           #endif
6747         } else {
6748           if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
6749           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6750           __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_11); __Pyx_INCREF(__pyx_t_7); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 220, __pyx_L1_error)
6751           #else
6752           __pyx_t_7 = PySequence_ITEM(__pyx_t_5, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 220, __pyx_L1_error)
6753           __Pyx_GOTREF(__pyx_t_7);
6754           #endif
6755         }
6756       } else {
6757         __pyx_t_7 = __pyx_t_12(__pyx_t_5);
6758         if (unlikely(!__pyx_t_7)) {
6759           PyObject* exc_type = PyErr_Occurred();
6760           if (exc_type) {
6761             if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
6762             else __PYX_ERR(0, 220, __pyx_L1_error)
6763           }
6764           break;
6765         }
6766         __Pyx_GOTREF(__pyx_t_7);
6767       }
6768       if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
6769         PyObject* sequence = __pyx_t_7;
6770         Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
6771         if (unlikely(size != 2)) {
6772           if (size > 2) __Pyx_RaiseTooManyValuesError(2);
6773           else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
6774           __PYX_ERR(0, 220, __pyx_L1_error)
6775         }
6776         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6777         if (likely(PyTuple_CheckExact(sequence))) {
6778           __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
6779           __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); 
6780         } else {
6781           __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
6782           __pyx_t_10 = PyList_GET_ITEM(sequence, 1); 
6783         }
6784         __Pyx_INCREF(__pyx_t_1);
6785         __Pyx_INCREF(__pyx_t_10);
6786         #else
6787         __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error)
6788         __Pyx_GOTREF(__pyx_t_1);
6789         __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 220, __pyx_L1_error)
6790         __Pyx_GOTREF(__pyx_t_10);
6791         #endif
6792         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6793       } else {
6794         Py_ssize_t index = -1;
6795         __pyx_t_6 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 220, __pyx_L1_error)
6796         __Pyx_GOTREF(__pyx_t_6);
6797         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6798         __pyx_t_13 = Py_TYPE(__pyx_t_6)->tp_iternext;
6799         index = 0; __pyx_t_1 = __pyx_t_13(__pyx_t_6); if (unlikely(!__pyx_t_1)) goto __pyx_L17_unpacking_failed;
6800         __Pyx_GOTREF(__pyx_t_1);
6801         index = 1; __pyx_t_10 = __pyx_t_13(__pyx_t_6); if (unlikely(!__pyx_t_10)) goto __pyx_L17_unpacking_failed;
6802         __Pyx_GOTREF(__pyx_t_10);
6803         if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_6), 2) < 0) __PYX_ERR(0, 220, __pyx_L1_error)
6804         __pyx_t_13 = NULL;
6805         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6806         goto __pyx_L18_unpacking_done;
6807         __pyx_L17_unpacking_failed:;
6808         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6809         __pyx_t_13 = NULL;
6810         if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
6811         __PYX_ERR(0, 220, __pyx_L1_error)
6812         __pyx_L18_unpacking_done:;
6813       }
6814       __Pyx_XDECREF_SET(__pyx_v_attr_ns_name, __pyx_t_1);
6815       __pyx_t_1 = 0;
6816       __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_10);
6817       __pyx_t_10 = 0;
6818
6819       /* "lxml/sax.py":221
6820  *             attr_qnames = {}
6821  *             for attr_ns_name, value in attribs:
6822  *                 attr_ns_tuple = _getNsTag(attr_ns_name)             # <<<<<<<<<<<<<<
6823  *                 attr_values[attr_ns_tuple] = value
6824  *                 attr_qnames[attr_ns_tuple] = self._build_qname(
6825  */
6826       __pyx_t_7 = __pyx_f_4lxml_3sax__getNsTag(__pyx_v_attr_ns_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 221, __pyx_L1_error)
6827       __Pyx_GOTREF(__pyx_t_7);
6828       __Pyx_XDECREF_SET(__pyx_v_attr_ns_tuple, ((PyObject*)__pyx_t_7));
6829       __pyx_t_7 = 0;
6830
6831       /* "lxml/sax.py":222
6832  *             for attr_ns_name, value in attribs:
6833  *                 attr_ns_tuple = _getNsTag(attr_ns_name)
6834  *                 attr_values[attr_ns_tuple] = value             # <<<<<<<<<<<<<<
6835  *                 attr_qnames[attr_ns_tuple] = self._build_qname(
6836  *                     attr_ns_tuple[0], attr_ns_tuple[1], element_nsmap,
6837  */
6838       if (unlikely(PyDict_SetItem(__pyx_v_attr_values, __pyx_v_attr_ns_tuple, __pyx_v_value) < 0)) __PYX_ERR(0, 222, __pyx_L1_error)
6839
6840       /* "lxml/sax.py":224
6841  *                 attr_values[attr_ns_tuple] = value
6842  *                 attr_qnames[attr_ns_tuple] = self._build_qname(
6843  *                     attr_ns_tuple[0], attr_ns_tuple[1], element_nsmap,             # <<<<<<<<<<<<<<
6844  *                     preferred_prefix=None, is_attribute=True)
6845  *             sax_attributes = self._attr_class(attr_values, attr_qnames)
6846  */
6847       if (unlikely(__pyx_v_attr_ns_tuple == Py_None)) {
6848         PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6849         __PYX_ERR(0, 224, __pyx_L1_error)
6850       }
6851       __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v_attr_ns_tuple, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 224, __pyx_L1_error)
6852       __Pyx_GOTREF(__pyx_t_7);
6853       if (unlikely(__pyx_v_attr_ns_tuple == Py_None)) {
6854         PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6855         __PYX_ERR(0, 224, __pyx_L1_error)
6856       }
6857       __pyx_t_10 = __Pyx_GetItemInt_Tuple(__pyx_v_attr_ns_tuple, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 224, __pyx_L1_error)
6858       __Pyx_GOTREF(__pyx_t_10);
6859
6860       /* "lxml/sax.py":223
6861  *                 attr_ns_tuple = _getNsTag(attr_ns_name)
6862  *                 attr_values[attr_ns_tuple] = value
6863  *                 attr_qnames[attr_ns_tuple] = self._build_qname(             # <<<<<<<<<<<<<<
6864  *                     attr_ns_tuple[0], attr_ns_tuple[1], element_nsmap,
6865  *                     preferred_prefix=None, is_attribute=True)
6866  */
6867       __pyx_t_1 = __pyx_f_4lxml_3sax_19ElementTreeProducer__build_qname(__pyx_v_self, __pyx_t_7, __pyx_t_10, __pyx_v_element_nsmap, Py_None, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 223, __pyx_L1_error)
6868       __Pyx_GOTREF(__pyx_t_1);
6869       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6870       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6871       if (unlikely(PyDict_SetItem(__pyx_v_attr_qnames, __pyx_v_attr_ns_tuple, __pyx_t_1) < 0)) __PYX_ERR(0, 223, __pyx_L1_error)
6872       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6873
6874       /* "lxml/sax.py":220
6875  *             attr_values = {}
6876  *             attr_qnames = {}
6877  *             for attr_ns_name, value in attribs:             # <<<<<<<<<<<<<<
6878  *                 attr_ns_tuple = _getNsTag(attr_ns_name)
6879  *                 attr_values[attr_ns_tuple] = value
6880  */
6881     }
6882     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6883
6884     /* "lxml/sax.py":226
6885  *                     attr_ns_tuple[0], attr_ns_tuple[1], element_nsmap,
6886  *                     preferred_prefix=None, is_attribute=True)
6887  *             sax_attributes = self._attr_class(attr_values, attr_qnames)             # <<<<<<<<<<<<<<
6888  *         else:
6889  *             sax_attributes = self._empty_attributes
6890  */
6891     __Pyx_INCREF(__pyx_v_self->_attr_class);
6892     __pyx_t_1 = __pyx_v_self->_attr_class; __pyx_t_10 = NULL;
6893     __pyx_t_9 = 0;
6894     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
6895       __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_1);
6896       if (likely(__pyx_t_10)) {
6897         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
6898         __Pyx_INCREF(__pyx_t_10);
6899         __Pyx_INCREF(function);
6900         __Pyx_DECREF_SET(__pyx_t_1, function);
6901         __pyx_t_9 = 1;
6902       }
6903     }
6904     #if CYTHON_FAST_PYCALL
6905     if (PyFunction_Check(__pyx_t_1)) {
6906       PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_v_attr_values, __pyx_v_attr_qnames};
6907       __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 226, __pyx_L1_error)
6908       __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
6909       __Pyx_GOTREF(__pyx_t_5);
6910     } else
6911     #endif
6912     #if CYTHON_FAST_PYCCALL
6913     if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
6914       PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_v_attr_values, __pyx_v_attr_qnames};
6915       __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 226, __pyx_L1_error)
6916       __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
6917       __Pyx_GOTREF(__pyx_t_5);
6918     } else
6919     #endif
6920     {
6921       __pyx_t_7 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 226, __pyx_L1_error)
6922       __Pyx_GOTREF(__pyx_t_7);
6923       if (__pyx_t_10) {
6924         __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_10); __pyx_t_10 = NULL;
6925       }
6926       __Pyx_INCREF(__pyx_v_attr_values);
6927       __Pyx_GIVEREF(__pyx_v_attr_values);
6928       PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_9, __pyx_v_attr_values);
6929       __Pyx_INCREF(__pyx_v_attr_qnames);
6930       __Pyx_GIVEREF(__pyx_v_attr_qnames);
6931       PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_9, __pyx_v_attr_qnames);
6932       __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 226, __pyx_L1_error)
6933       __Pyx_GOTREF(__pyx_t_5);
6934       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6935     }
6936     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6937     __pyx_v_sax_attributes = __pyx_t_5;
6938     __pyx_t_5 = 0;
6939
6940     /* "lxml/sax.py":217
6941  * 
6942  *         attribs = element.items()
6943  *         if attribs:             # <<<<<<<<<<<<<<
6944  *             attr_values = {}
6945  *             attr_qnames = {}
6946  */
6947     goto __pyx_L14;
6948   }
6949
6950   /* "lxml/sax.py":228
6951  *             sax_attributes = self._attr_class(attr_values, attr_qnames)
6952  *         else:
6953  *             sax_attributes = self._empty_attributes             # <<<<<<<<<<<<<<
6954  * 
6955  *         ns_uri, local_name = _getNsTag(tag)
6956  */
6957   /*else*/ {
6958     __pyx_t_5 = __pyx_v_self->_empty_attributes;
6959     __Pyx_INCREF(__pyx_t_5);
6960     __pyx_v_sax_attributes = __pyx_t_5;
6961     __pyx_t_5 = 0;
6962   }
6963   __pyx_L14:;
6964
6965   /* "lxml/sax.py":230
6966  *             sax_attributes = self._empty_attributes
6967  * 
6968  *         ns_uri, local_name = _getNsTag(tag)             # <<<<<<<<<<<<<<
6969  *         qname = self._build_qname(
6970  *             ns_uri, local_name, element_nsmap, element.prefix, is_attribute=False)
6971  */
6972   __pyx_t_5 = __pyx_f_4lxml_3sax__getNsTag(__pyx_v_tag); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 230, __pyx_L1_error)
6973   __Pyx_GOTREF(__pyx_t_5);
6974   if (likely(__pyx_t_5 != Py_None)) {
6975     PyObject* sequence = __pyx_t_5;
6976     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
6977     if (unlikely(size != 2)) {
6978       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
6979       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
6980       __PYX_ERR(0, 230, __pyx_L1_error)
6981     }
6982     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6983     __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
6984     __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
6985     __Pyx_INCREF(__pyx_t_1);
6986     __Pyx_INCREF(__pyx_t_7);
6987     #else
6988     __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error)
6989     __Pyx_GOTREF(__pyx_t_1);
6990     __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 230, __pyx_L1_error)
6991     __Pyx_GOTREF(__pyx_t_7);
6992     #endif
6993     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6994   } else {
6995     __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 230, __pyx_L1_error)
6996   }
6997   __Pyx_XDECREF_SET(__pyx_v_ns_uri, __pyx_t_1);
6998   __pyx_t_1 = 0;
6999   __pyx_v_local_name = __pyx_t_7;
7000   __pyx_t_7 = 0;
7001
7002   /* "lxml/sax.py":232
7003  *         ns_uri, local_name = _getNsTag(tag)
7004  *         qname = self._build_qname(
7005  *             ns_uri, local_name, element_nsmap, element.prefix, is_attribute=False)             # <<<<<<<<<<<<<<
7006  * 
7007  *         for prefix, uri in new_prefixes:
7008  */
7009   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_element, __pyx_n_s_prefix); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 232, __pyx_L1_error)
7010   __Pyx_GOTREF(__pyx_t_5);
7011
7012   /* "lxml/sax.py":231
7013  * 
7014  *         ns_uri, local_name = _getNsTag(tag)
7015  *         qname = self._build_qname(             # <<<<<<<<<<<<<<
7016  *             ns_uri, local_name, element_nsmap, element.prefix, is_attribute=False)
7017  * 
7018  */
7019   __pyx_t_7 = __pyx_f_4lxml_3sax_19ElementTreeProducer__build_qname(__pyx_v_self, __pyx_v_ns_uri, __pyx_v_local_name, __pyx_v_element_nsmap, __pyx_t_5, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 231, __pyx_L1_error)
7020   __Pyx_GOTREF(__pyx_t_7);
7021   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7022   __pyx_v_qname = __pyx_t_7;
7023   __pyx_t_7 = 0;
7024
7025   /* "lxml/sax.py":234
7026  *             ns_uri, local_name, element_nsmap, element.prefix, is_attribute=False)
7027  * 
7028  *         for prefix, uri in new_prefixes:             # <<<<<<<<<<<<<<
7029  *             content_handler.startPrefixMapping(prefix, uri)
7030  *         content_handler.startElementNS(
7031  */
7032   __pyx_t_7 = __pyx_v_new_prefixes; __Pyx_INCREF(__pyx_t_7); __pyx_t_11 = 0;
7033   for (;;) {
7034     if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_7)) break;
7035     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7036     __pyx_t_5 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_11); __Pyx_INCREF(__pyx_t_5); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 234, __pyx_L1_error)
7037     #else
7038     __pyx_t_5 = PySequence_ITEM(__pyx_t_7, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 234, __pyx_L1_error)
7039     __Pyx_GOTREF(__pyx_t_5);
7040     #endif
7041     if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
7042       PyObject* sequence = __pyx_t_5;
7043       Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
7044       if (unlikely(size != 2)) {
7045         if (size > 2) __Pyx_RaiseTooManyValuesError(2);
7046         else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
7047         __PYX_ERR(0, 234, __pyx_L1_error)
7048       }
7049       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7050       if (likely(PyTuple_CheckExact(sequence))) {
7051         __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
7052         __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); 
7053       } else {
7054         __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
7055         __pyx_t_10 = PyList_GET_ITEM(sequence, 1); 
7056       }
7057       __Pyx_INCREF(__pyx_t_1);
7058       __Pyx_INCREF(__pyx_t_10);
7059       #else
7060       __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error)
7061       __Pyx_GOTREF(__pyx_t_1);
7062       __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 234, __pyx_L1_error)
7063       __Pyx_GOTREF(__pyx_t_10);
7064       #endif
7065       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7066     } else {
7067       Py_ssize_t index = -1;
7068       __pyx_t_6 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 234, __pyx_L1_error)
7069       __Pyx_GOTREF(__pyx_t_6);
7070       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7071       __pyx_t_13 = Py_TYPE(__pyx_t_6)->tp_iternext;
7072       index = 0; __pyx_t_1 = __pyx_t_13(__pyx_t_6); if (unlikely(!__pyx_t_1)) goto __pyx_L21_unpacking_failed;
7073       __Pyx_GOTREF(__pyx_t_1);
7074       index = 1; __pyx_t_10 = __pyx_t_13(__pyx_t_6); if (unlikely(!__pyx_t_10)) goto __pyx_L21_unpacking_failed;
7075       __Pyx_GOTREF(__pyx_t_10);
7076       if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_6), 2) < 0) __PYX_ERR(0, 234, __pyx_L1_error)
7077       __pyx_t_13 = NULL;
7078       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7079       goto __pyx_L22_unpacking_done;
7080       __pyx_L21_unpacking_failed:;
7081       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7082       __pyx_t_13 = NULL;
7083       if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
7084       __PYX_ERR(0, 234, __pyx_L1_error)
7085       __pyx_L22_unpacking_done:;
7086     }
7087     __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_1);
7088     __pyx_t_1 = 0;
7089     __Pyx_XDECREF_SET(__pyx_v_uri, __pyx_t_10);
7090     __pyx_t_10 = 0;
7091
7092     /* "lxml/sax.py":235
7093  * 
7094  *         for prefix, uri in new_prefixes:
7095  *             content_handler.startPrefixMapping(prefix, uri)             # <<<<<<<<<<<<<<
7096  *         content_handler.startElementNS(
7097  *             (ns_uri, local_name), qname, sax_attributes)
7098  */
7099     __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_content_handler, __pyx_n_s_startPrefixMapping); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 235, __pyx_L1_error)
7100     __Pyx_GOTREF(__pyx_t_10);
7101     __pyx_t_1 = NULL;
7102     __pyx_t_9 = 0;
7103     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
7104       __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_10);
7105       if (likely(__pyx_t_1)) {
7106         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
7107         __Pyx_INCREF(__pyx_t_1);
7108         __Pyx_INCREF(function);
7109         __Pyx_DECREF_SET(__pyx_t_10, function);
7110         __pyx_t_9 = 1;
7111       }
7112     }
7113     #if CYTHON_FAST_PYCALL
7114     if (PyFunction_Check(__pyx_t_10)) {
7115       PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_prefix, __pyx_v_uri};
7116       __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 235, __pyx_L1_error)
7117       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7118       __Pyx_GOTREF(__pyx_t_5);
7119     } else
7120     #endif
7121     #if CYTHON_FAST_PYCCALL
7122     if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
7123       PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_prefix, __pyx_v_uri};
7124       __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 235, __pyx_L1_error)
7125       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7126       __Pyx_GOTREF(__pyx_t_5);
7127     } else
7128     #endif
7129     {
7130       __pyx_t_6 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 235, __pyx_L1_error)
7131       __Pyx_GOTREF(__pyx_t_6);
7132       if (__pyx_t_1) {
7133         __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __pyx_t_1 = NULL;
7134       }
7135       __Pyx_INCREF(__pyx_v_prefix);
7136       __Pyx_GIVEREF(__pyx_v_prefix);
7137       PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_9, __pyx_v_prefix);
7138       __Pyx_INCREF(__pyx_v_uri);
7139       __Pyx_GIVEREF(__pyx_v_uri);
7140       PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_9, __pyx_v_uri);
7141       __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 235, __pyx_L1_error)
7142       __Pyx_GOTREF(__pyx_t_5);
7143       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7144     }
7145     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7146     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7147
7148     /* "lxml/sax.py":234
7149  *             ns_uri, local_name, element_nsmap, element.prefix, is_attribute=False)
7150  * 
7151  *         for prefix, uri in new_prefixes:             # <<<<<<<<<<<<<<
7152  *             content_handler.startPrefixMapping(prefix, uri)
7153  *         content_handler.startElementNS(
7154  */
7155   }
7156   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7157
7158   /* "lxml/sax.py":236
7159  *         for prefix, uri in new_prefixes:
7160  *             content_handler.startPrefixMapping(prefix, uri)
7161  *         content_handler.startElementNS(             # <<<<<<<<<<<<<<
7162  *             (ns_uri, local_name), qname, sax_attributes)
7163  *         text = element.text
7164  */
7165   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_content_handler, __pyx_n_s_startElementNS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 236, __pyx_L1_error)
7166   __Pyx_GOTREF(__pyx_t_5);
7167
7168   /* "lxml/sax.py":237
7169  *             content_handler.startPrefixMapping(prefix, uri)
7170  *         content_handler.startElementNS(
7171  *             (ns_uri, local_name), qname, sax_attributes)             # <<<<<<<<<<<<<<
7172  *         text = element.text
7173  *         if text:
7174  */
7175   __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 237, __pyx_L1_error)
7176   __Pyx_GOTREF(__pyx_t_10);
7177   __Pyx_INCREF(__pyx_v_ns_uri);
7178   __Pyx_GIVEREF(__pyx_v_ns_uri);
7179   PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_ns_uri);
7180   __Pyx_INCREF(__pyx_v_local_name);
7181   __Pyx_GIVEREF(__pyx_v_local_name);
7182   PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_local_name);
7183   __pyx_t_6 = NULL;
7184   __pyx_t_9 = 0;
7185   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
7186     __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
7187     if (likely(__pyx_t_6)) {
7188       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
7189       __Pyx_INCREF(__pyx_t_6);
7190       __Pyx_INCREF(function);
7191       __Pyx_DECREF_SET(__pyx_t_5, function);
7192       __pyx_t_9 = 1;
7193     }
7194   }
7195   #if CYTHON_FAST_PYCALL
7196   if (PyFunction_Check(__pyx_t_5)) {
7197     PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_10, __pyx_v_qname, __pyx_v_sax_attributes};
7198     __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 236, __pyx_L1_error)
7199     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7200     __Pyx_GOTREF(__pyx_t_7);
7201     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7202   } else
7203   #endif
7204   #if CYTHON_FAST_PYCCALL
7205   if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
7206     PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_10, __pyx_v_qname, __pyx_v_sax_attributes};
7207     __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 236, __pyx_L1_error)
7208     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7209     __Pyx_GOTREF(__pyx_t_7);
7210     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7211   } else
7212   #endif
7213   {
7214     __pyx_t_1 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 236, __pyx_L1_error)
7215     __Pyx_GOTREF(__pyx_t_1);
7216     if (__pyx_t_6) {
7217       __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6); __pyx_t_6 = NULL;
7218     }
7219     __Pyx_GIVEREF(__pyx_t_10);
7220     PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_9, __pyx_t_10);
7221     __Pyx_INCREF(__pyx_v_qname);
7222     __Pyx_GIVEREF(__pyx_v_qname);
7223     PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_9, __pyx_v_qname);
7224     __Pyx_INCREF(__pyx_v_sax_attributes);
7225     __Pyx_GIVEREF(__pyx_v_sax_attributes);
7226     PyTuple_SET_ITEM(__pyx_t_1, 2+__pyx_t_9, __pyx_v_sax_attributes);
7227     __pyx_t_10 = 0;
7228     __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 236, __pyx_L1_error)
7229     __Pyx_GOTREF(__pyx_t_7);
7230     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7231   }
7232   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7233   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7234
7235   /* "lxml/sax.py":238
7236  *         content_handler.startElementNS(
7237  *             (ns_uri, local_name), qname, sax_attributes)
7238  *         text = element.text             # <<<<<<<<<<<<<<
7239  *         if text:
7240  *             content_handler.characters(text)
7241  */
7242   __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_element, __pyx_n_s_text); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 238, __pyx_L1_error)
7243   __Pyx_GOTREF(__pyx_t_7);
7244   __pyx_v_text = __pyx_t_7;
7245   __pyx_t_7 = 0;
7246
7247   /* "lxml/sax.py":239
7248  *             (ns_uri, local_name), qname, sax_attributes)
7249  *         text = element.text
7250  *         if text:             # <<<<<<<<<<<<<<
7251  *             content_handler.characters(text)
7252  *         for child in element:
7253  */
7254   __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_text); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 239, __pyx_L1_error)
7255   if (__pyx_t_3) {
7256
7257     /* "lxml/sax.py":240
7258  *         text = element.text
7259  *         if text:
7260  *             content_handler.characters(text)             # <<<<<<<<<<<<<<
7261  *         for child in element:
7262  *             self._recursive_saxify(child, element_nsmap)
7263  */
7264     __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_content_handler, __pyx_n_s_characters); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 240, __pyx_L1_error)
7265     __Pyx_GOTREF(__pyx_t_5);
7266     __pyx_t_1 = NULL;
7267     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
7268       __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
7269       if (likely(__pyx_t_1)) {
7270         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
7271         __Pyx_INCREF(__pyx_t_1);
7272         __Pyx_INCREF(function);
7273         __Pyx_DECREF_SET(__pyx_t_5, function);
7274       }
7275     }
7276     __pyx_t_7 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_1, __pyx_v_text) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_text);
7277     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7278     if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 240, __pyx_L1_error)
7279     __Pyx_GOTREF(__pyx_t_7);
7280     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7281     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7282
7283     /* "lxml/sax.py":239
7284  *             (ns_uri, local_name), qname, sax_attributes)
7285  *         text = element.text
7286  *         if text:             # <<<<<<<<<<<<<<
7287  *             content_handler.characters(text)
7288  *         for child in element:
7289  */
7290   }
7291
7292   /* "lxml/sax.py":241
7293  *         if text:
7294  *             content_handler.characters(text)
7295  *         for child in element:             # <<<<<<<<<<<<<<
7296  *             self._recursive_saxify(child, element_nsmap)
7297  *         content_handler.endElementNS((ns_uri, local_name), qname)
7298  */
7299   if (likely(PyList_CheckExact(__pyx_v_element)) || PyTuple_CheckExact(__pyx_v_element)) {
7300     __pyx_t_7 = __pyx_v_element; __Pyx_INCREF(__pyx_t_7); __pyx_t_11 = 0;
7301     __pyx_t_12 = NULL;
7302   } else {
7303     __pyx_t_11 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_element); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 241, __pyx_L1_error)
7304     __Pyx_GOTREF(__pyx_t_7);
7305     __pyx_t_12 = Py_TYPE(__pyx_t_7)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 241, __pyx_L1_error)
7306   }
7307   for (;;) {
7308     if (likely(!__pyx_t_12)) {
7309       if (likely(PyList_CheckExact(__pyx_t_7))) {
7310         if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_7)) break;
7311         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7312         __pyx_t_5 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_11); __Pyx_INCREF(__pyx_t_5); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 241, __pyx_L1_error)
7313         #else
7314         __pyx_t_5 = PySequence_ITEM(__pyx_t_7, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 241, __pyx_L1_error)
7315         __Pyx_GOTREF(__pyx_t_5);
7316         #endif
7317       } else {
7318         if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_7)) break;
7319         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7320         __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_11); __Pyx_INCREF(__pyx_t_5); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 241, __pyx_L1_error)
7321         #else
7322         __pyx_t_5 = PySequence_ITEM(__pyx_t_7, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 241, __pyx_L1_error)
7323         __Pyx_GOTREF(__pyx_t_5);
7324         #endif
7325       }
7326     } else {
7327       __pyx_t_5 = __pyx_t_12(__pyx_t_7);
7328       if (unlikely(!__pyx_t_5)) {
7329         PyObject* exc_type = PyErr_Occurred();
7330         if (exc_type) {
7331           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
7332           else __PYX_ERR(0, 241, __pyx_L1_error)
7333         }
7334         break;
7335       }
7336       __Pyx_GOTREF(__pyx_t_5);
7337     }
7338     __Pyx_XDECREF_SET(__pyx_v_child, __pyx_t_5);
7339     __pyx_t_5 = 0;
7340
7341     /* "lxml/sax.py":242
7342  *             content_handler.characters(text)
7343  *         for child in element:
7344  *             self._recursive_saxify(child, element_nsmap)             # <<<<<<<<<<<<<<
7345  *         content_handler.endElementNS((ns_uri, local_name), qname)
7346  *         for prefix, uri in new_prefixes:
7347  */
7348     __pyx_t_5 = __pyx_f_4lxml_3sax_19ElementTreeProducer__recursive_saxify(__pyx_v_self, __pyx_v_child, __pyx_v_element_nsmap); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 242, __pyx_L1_error)
7349     __Pyx_GOTREF(__pyx_t_5);
7350     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7351
7352     /* "lxml/sax.py":241
7353  *         if text:
7354  *             content_handler.characters(text)
7355  *         for child in element:             # <<<<<<<<<<<<<<
7356  *             self._recursive_saxify(child, element_nsmap)
7357  *         content_handler.endElementNS((ns_uri, local_name), qname)
7358  */
7359   }
7360   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7361
7362   /* "lxml/sax.py":243
7363  *         for child in element:
7364  *             self._recursive_saxify(child, element_nsmap)
7365  *         content_handler.endElementNS((ns_uri, local_name), qname)             # <<<<<<<<<<<<<<
7366  *         for prefix, uri in new_prefixes:
7367  *             content_handler.endPrefixMapping(prefix)
7368  */
7369   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_content_handler, __pyx_n_s_endElementNS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 243, __pyx_L1_error)
7370   __Pyx_GOTREF(__pyx_t_5);
7371   __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 243, __pyx_L1_error)
7372   __Pyx_GOTREF(__pyx_t_1);
7373   __Pyx_INCREF(__pyx_v_ns_uri);
7374   __Pyx_GIVEREF(__pyx_v_ns_uri);
7375   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_ns_uri);
7376   __Pyx_INCREF(__pyx_v_local_name);
7377   __Pyx_GIVEREF(__pyx_v_local_name);
7378   PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_local_name);
7379   __pyx_t_10 = NULL;
7380   __pyx_t_9 = 0;
7381   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
7382     __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_5);
7383     if (likely(__pyx_t_10)) {
7384       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
7385       __Pyx_INCREF(__pyx_t_10);
7386       __Pyx_INCREF(function);
7387       __Pyx_DECREF_SET(__pyx_t_5, function);
7388       __pyx_t_9 = 1;
7389     }
7390   }
7391   #if CYTHON_FAST_PYCALL
7392   if (PyFunction_Check(__pyx_t_5)) {
7393     PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_1, __pyx_v_qname};
7394     __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 243, __pyx_L1_error)
7395     __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
7396     __Pyx_GOTREF(__pyx_t_7);
7397     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7398   } else
7399   #endif
7400   #if CYTHON_FAST_PYCCALL
7401   if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
7402     PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_1, __pyx_v_qname};
7403     __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 243, __pyx_L1_error)
7404     __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
7405     __Pyx_GOTREF(__pyx_t_7);
7406     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7407   } else
7408   #endif
7409   {
7410     __pyx_t_6 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 243, __pyx_L1_error)
7411     __Pyx_GOTREF(__pyx_t_6);
7412     if (__pyx_t_10) {
7413       __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_10); __pyx_t_10 = NULL;
7414     }
7415     __Pyx_GIVEREF(__pyx_t_1);
7416     PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_9, __pyx_t_1);
7417     __Pyx_INCREF(__pyx_v_qname);
7418     __Pyx_GIVEREF(__pyx_v_qname);
7419     PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_9, __pyx_v_qname);
7420     __pyx_t_1 = 0;
7421     __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 243, __pyx_L1_error)
7422     __Pyx_GOTREF(__pyx_t_7);
7423     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7424   }
7425   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7426   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7427
7428   /* "lxml/sax.py":244
7429  *             self._recursive_saxify(child, element_nsmap)
7430  *         content_handler.endElementNS((ns_uri, local_name), qname)
7431  *         for prefix, uri in new_prefixes:             # <<<<<<<<<<<<<<
7432  *             content_handler.endPrefixMapping(prefix)
7433  *         tail = element.tail
7434  */
7435   __pyx_t_7 = __pyx_v_new_prefixes; __Pyx_INCREF(__pyx_t_7); __pyx_t_11 = 0;
7436   for (;;) {
7437     if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_7)) break;
7438     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7439     __pyx_t_5 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_11); __Pyx_INCREF(__pyx_t_5); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 244, __pyx_L1_error)
7440     #else
7441     __pyx_t_5 = PySequence_ITEM(__pyx_t_7, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 244, __pyx_L1_error)
7442     __Pyx_GOTREF(__pyx_t_5);
7443     #endif
7444     if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
7445       PyObject* sequence = __pyx_t_5;
7446       Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
7447       if (unlikely(size != 2)) {
7448         if (size > 2) __Pyx_RaiseTooManyValuesError(2);
7449         else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
7450         __PYX_ERR(0, 244, __pyx_L1_error)
7451       }
7452       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7453       if (likely(PyTuple_CheckExact(sequence))) {
7454         __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
7455         __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
7456       } else {
7457         __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
7458         __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
7459       }
7460       __Pyx_INCREF(__pyx_t_6);
7461       __Pyx_INCREF(__pyx_t_1);
7462       #else
7463       __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 244, __pyx_L1_error)
7464       __Pyx_GOTREF(__pyx_t_6);
7465       __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error)
7466       __Pyx_GOTREF(__pyx_t_1);
7467       #endif
7468       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7469     } else {
7470       Py_ssize_t index = -1;
7471       __pyx_t_10 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 244, __pyx_L1_error)
7472       __Pyx_GOTREF(__pyx_t_10);
7473       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7474       __pyx_t_13 = Py_TYPE(__pyx_t_10)->tp_iternext;
7475       index = 0; __pyx_t_6 = __pyx_t_13(__pyx_t_10); if (unlikely(!__pyx_t_6)) goto __pyx_L28_unpacking_failed;
7476       __Pyx_GOTREF(__pyx_t_6);
7477       index = 1; __pyx_t_1 = __pyx_t_13(__pyx_t_10); if (unlikely(!__pyx_t_1)) goto __pyx_L28_unpacking_failed;
7478       __Pyx_GOTREF(__pyx_t_1);
7479       if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_10), 2) < 0) __PYX_ERR(0, 244, __pyx_L1_error)
7480       __pyx_t_13 = NULL;
7481       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7482       goto __pyx_L29_unpacking_done;
7483       __pyx_L28_unpacking_failed:;
7484       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7485       __pyx_t_13 = NULL;
7486       if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
7487       __PYX_ERR(0, 244, __pyx_L1_error)
7488       __pyx_L29_unpacking_done:;
7489     }
7490     __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_6);
7491     __pyx_t_6 = 0;
7492     __Pyx_XDECREF_SET(__pyx_v_uri, __pyx_t_1);
7493     __pyx_t_1 = 0;
7494
7495     /* "lxml/sax.py":245
7496  *         content_handler.endElementNS((ns_uri, local_name), qname)
7497  *         for prefix, uri in new_prefixes:
7498  *             content_handler.endPrefixMapping(prefix)             # <<<<<<<<<<<<<<
7499  *         tail = element.tail
7500  *         if tail:
7501  */
7502     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_content_handler, __pyx_n_s_endPrefixMapping); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L1_error)
7503     __Pyx_GOTREF(__pyx_t_1);
7504     __pyx_t_6 = NULL;
7505     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
7506       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
7507       if (likely(__pyx_t_6)) {
7508         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
7509         __Pyx_INCREF(__pyx_t_6);
7510         __Pyx_INCREF(function);
7511         __Pyx_DECREF_SET(__pyx_t_1, function);
7512       }
7513     }
7514     __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_v_prefix) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_prefix);
7515     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7516     if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 245, __pyx_L1_error)
7517     __Pyx_GOTREF(__pyx_t_5);
7518     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7519     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7520
7521     /* "lxml/sax.py":244
7522  *             self._recursive_saxify(child, element_nsmap)
7523  *         content_handler.endElementNS((ns_uri, local_name), qname)
7524  *         for prefix, uri in new_prefixes:             # <<<<<<<<<<<<<<
7525  *             content_handler.endPrefixMapping(prefix)
7526  *         tail = element.tail
7527  */
7528   }
7529   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7530
7531   /* "lxml/sax.py":246
7532  *         for prefix, uri in new_prefixes:
7533  *             content_handler.endPrefixMapping(prefix)
7534  *         tail = element.tail             # <<<<<<<<<<<<<<
7535  *         if tail:
7536  *             content_handler.characters(tail)
7537  */
7538   __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_element, __pyx_n_s_tail); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 246, __pyx_L1_error)
7539   __Pyx_GOTREF(__pyx_t_7);
7540   __pyx_v_tail = __pyx_t_7;
7541   __pyx_t_7 = 0;
7542
7543   /* "lxml/sax.py":247
7544  *             content_handler.endPrefixMapping(prefix)
7545  *         tail = element.tail
7546  *         if tail:             # <<<<<<<<<<<<<<
7547  *             content_handler.characters(tail)
7548  * 
7549  */
7550   __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_tail); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 247, __pyx_L1_error)
7551   if (__pyx_t_3) {
7552
7553     /* "lxml/sax.py":248
7554  *         tail = element.tail
7555  *         if tail:
7556  *             content_handler.characters(tail)             # <<<<<<<<<<<<<<
7557  * 
7558  *     def _build_qname(self, ns_uri, local_name, nsmap, preferred_prefix, is_attribute):
7559  */
7560     __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_content_handler, __pyx_n_s_characters); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 248, __pyx_L1_error)
7561     __Pyx_GOTREF(__pyx_t_5);
7562     __pyx_t_1 = NULL;
7563     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
7564       __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
7565       if (likely(__pyx_t_1)) {
7566         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
7567         __Pyx_INCREF(__pyx_t_1);
7568         __Pyx_INCREF(function);
7569         __Pyx_DECREF_SET(__pyx_t_5, function);
7570       }
7571     }
7572     __pyx_t_7 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_1, __pyx_v_tail) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_tail);
7573     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7574     if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 248, __pyx_L1_error)
7575     __Pyx_GOTREF(__pyx_t_7);
7576     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7577     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7578
7579     /* "lxml/sax.py":247
7580  *             content_handler.endPrefixMapping(prefix)
7581  *         tail = element.tail
7582  *         if tail:             # <<<<<<<<<<<<<<
7583  *             content_handler.characters(tail)
7584  * 
7585  */
7586   }
7587
7588   /* "lxml/sax.py":196
7589  *         self._content_handler.endDocument()
7590  * 
7591  *     def _recursive_saxify(self, element, parent_nsmap):             # <<<<<<<<<<<<<<
7592  *         content_handler = self._content_handler
7593  *         tag = element.tag
7594  */
7595
7596   /* function exit code */
7597   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7598   goto __pyx_L0;
7599   __pyx_L1_error:;
7600   __Pyx_XDECREF(__pyx_t_1);
7601   __Pyx_XDECREF(__pyx_t_5);
7602   __Pyx_XDECREF(__pyx_t_6);
7603   __Pyx_XDECREF(__pyx_t_7);
7604   __Pyx_XDECREF(__pyx_t_8);
7605   __Pyx_XDECREF(__pyx_t_10);
7606   __Pyx_AddTraceback("lxml.sax.ElementTreeProducer._recursive_saxify", __pyx_clineno, __pyx_lineno, __pyx_filename);
7607   __pyx_r = 0;
7608   __pyx_L0:;
7609   __Pyx_XDECREF(__pyx_v_element_nsmap);
7610   __Pyx_XDECREF(__pyx_v_content_handler);
7611   __Pyx_XDECREF(__pyx_v_tag);
7612   __Pyx_XDECREF(__pyx_v_tail);
7613   __Pyx_XDECREF(__pyx_v_new_prefixes);
7614   __Pyx_XDECREF(__pyx_v_prefix);
7615   __Pyx_XDECREF(__pyx_v_ns_uri);
7616   __Pyx_XDECREF(__pyx_v_attribs);
7617   __Pyx_XDECREF(__pyx_v_attr_values);
7618   __Pyx_XDECREF(__pyx_v_attr_qnames);
7619   __Pyx_XDECREF(__pyx_v_attr_ns_name);
7620   __Pyx_XDECREF(__pyx_v_value);
7621   __Pyx_XDECREF(__pyx_v_attr_ns_tuple);
7622   __Pyx_XDECREF(__pyx_v_sax_attributes);
7623   __Pyx_XDECREF(__pyx_v_local_name);
7624   __Pyx_XDECREF(__pyx_v_qname);
7625   __Pyx_XDECREF(__pyx_v_uri);
7626   __Pyx_XDECREF(__pyx_v_text);
7627   __Pyx_XDECREF(__pyx_v_child);
7628   __Pyx_XGIVEREF(__pyx_r);
7629   __Pyx_RefNannyFinishContext();
7630   return __pyx_r;
7631 }
7632
7633 /* "lxml/sax.py":250
7634  *             content_handler.characters(tail)
7635  * 
7636  *     def _build_qname(self, ns_uri, local_name, nsmap, preferred_prefix, is_attribute):             # <<<<<<<<<<<<<<
7637  *         if ns_uri is None:
7638  *             return local_name
7639  */
7640
7641 static CYTHON_INLINE PyObject *__pyx_f_4lxml_3sax_19ElementTreeProducer__build_qname(CYTHON_UNUSED struct __pyx_obj_4lxml_3sax_ElementTreeProducer *__pyx_v_self, PyObject *__pyx_v_ns_uri, PyObject *__pyx_v_local_name, PyObject *__pyx_v_nsmap, PyObject *__pyx_v_preferred_prefix, int __pyx_v_is_attribute) {
7642   PyObject *__pyx_v_prefix = NULL;
7643   PyObject *__pyx_v_candidates = NULL;
7644   PyObject *__pyx_v_pfx = NULL;
7645   PyObject *__pyx_v_uri = NULL;
7646   PyObject *__pyx_r = NULL;
7647   __Pyx_RefNannyDeclarations
7648   int __pyx_t_1;
7649   int __pyx_t_2;
7650   PyObject *__pyx_t_3 = NULL;
7651   PyObject *__pyx_t_4 = NULL;
7652   PyObject *__pyx_t_5 = NULL;
7653   Py_ssize_t __pyx_t_6;
7654   PyObject *(*__pyx_t_7)(PyObject *);
7655   PyObject *__pyx_t_8 = NULL;
7656   PyObject *__pyx_t_9 = NULL;
7657   PyObject *__pyx_t_10 = NULL;
7658   PyObject *(*__pyx_t_11)(PyObject *);
7659   int __pyx_t_12;
7660   int __pyx_lineno = 0;
7661   const char *__pyx_filename = NULL;
7662   int __pyx_clineno = 0;
7663   __Pyx_RefNannySetupContext("_build_qname", 0);
7664
7665   /* "lxml/sax.py":251
7666  * 
7667  *     def _build_qname(self, ns_uri, local_name, nsmap, preferred_prefix, is_attribute):
7668  *         if ns_uri is None:             # <<<<<<<<<<<<<<
7669  *             return local_name
7670  * 
7671  */
7672   __pyx_t_1 = (__pyx_v_ns_uri == Py_None);
7673   __pyx_t_2 = (__pyx_t_1 != 0);
7674   if (__pyx_t_2) {
7675
7676     /* "lxml/sax.py":252
7677  *     def _build_qname(self, ns_uri, local_name, nsmap, preferred_prefix, is_attribute):
7678  *         if ns_uri is None:
7679  *             return local_name             # <<<<<<<<<<<<<<
7680  * 
7681  *         if not is_attribute and nsmap.get(preferred_prefix) == ns_uri:
7682  */
7683     __Pyx_XDECREF(__pyx_r);
7684     __Pyx_INCREF(__pyx_v_local_name);
7685     __pyx_r = __pyx_v_local_name;
7686     goto __pyx_L0;
7687
7688     /* "lxml/sax.py":251
7689  * 
7690  *     def _build_qname(self, ns_uri, local_name, nsmap, preferred_prefix, is_attribute):
7691  *         if ns_uri is None:             # <<<<<<<<<<<<<<
7692  *             return local_name
7693  * 
7694  */
7695   }
7696
7697   /* "lxml/sax.py":254
7698  *             return local_name
7699  * 
7700  *         if not is_attribute and nsmap.get(preferred_prefix) == ns_uri:             # <<<<<<<<<<<<<<
7701  *             prefix = preferred_prefix
7702  *         else:
7703  */
7704   __pyx_t_1 = ((!(__pyx_v_is_attribute != 0)) != 0);
7705   if (__pyx_t_1) {
7706   } else {
7707     __pyx_t_2 = __pyx_t_1;
7708     goto __pyx_L5_bool_binop_done;
7709   }
7710   if (unlikely(__pyx_v_nsmap == Py_None)) {
7711     PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get");
7712     __PYX_ERR(0, 254, __pyx_L1_error)
7713   }
7714   __pyx_t_3 = __Pyx_PyDict_GetItemDefault(__pyx_v_nsmap, __pyx_v_preferred_prefix, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 254, __pyx_L1_error)
7715   __Pyx_GOTREF(__pyx_t_3);
7716   __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_ns_uri, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 254, __pyx_L1_error)
7717   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7718   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 254, __pyx_L1_error)
7719   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7720   __pyx_t_2 = __pyx_t_1;
7721   __pyx_L5_bool_binop_done:;
7722   if (__pyx_t_2) {
7723
7724     /* "lxml/sax.py":255
7725  * 
7726  *         if not is_attribute and nsmap.get(preferred_prefix) == ns_uri:
7727  *             prefix = preferred_prefix             # <<<<<<<<<<<<<<
7728  *         else:
7729  *             # Pick the first matching prefix, in alphabetical order.
7730  */
7731     __Pyx_INCREF(__pyx_v_preferred_prefix);
7732     __pyx_v_prefix = __pyx_v_preferred_prefix;
7733
7734     /* "lxml/sax.py":254
7735  *             return local_name
7736  * 
7737  *         if not is_attribute and nsmap.get(preferred_prefix) == ns_uri:             # <<<<<<<<<<<<<<
7738  *             prefix = preferred_prefix
7739  *         else:
7740  */
7741     goto __pyx_L4;
7742   }
7743
7744   /* "lxml/sax.py":258
7745  *         else:
7746  *             # Pick the first matching prefix, in alphabetical order.
7747  *             candidates = [             # <<<<<<<<<<<<<<
7748  *                 pfx for (pfx, uri) in nsmap.items()
7749  *                 if pfx is not None and uri == ns_uri
7750  */
7751   /*else*/ {
7752     __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 258, __pyx_L1_error)
7753     __Pyx_GOTREF(__pyx_t_4);
7754
7755     /* "lxml/sax.py":259
7756  *             # Pick the first matching prefix, in alphabetical order.
7757  *             candidates = [
7758  *                 pfx for (pfx, uri) in nsmap.items()             # <<<<<<<<<<<<<<
7759  *                 if pfx is not None and uri == ns_uri
7760  *             ]
7761  */
7762     if (unlikely(__pyx_v_nsmap == Py_None)) {
7763       PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
7764       __PYX_ERR(0, 259, __pyx_L1_error)
7765     }
7766     __pyx_t_3 = __Pyx_PyDict_Items(__pyx_v_nsmap); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 259, __pyx_L1_error)
7767     __Pyx_GOTREF(__pyx_t_3);
7768     if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
7769       __pyx_t_5 = __pyx_t_3; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
7770       __pyx_t_7 = NULL;
7771     } else {
7772       __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 259, __pyx_L1_error)
7773       __Pyx_GOTREF(__pyx_t_5);
7774       __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 259, __pyx_L1_error)
7775     }
7776     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7777     for (;;) {
7778       if (likely(!__pyx_t_7)) {
7779         if (likely(PyList_CheckExact(__pyx_t_5))) {
7780           if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
7781           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7782           __pyx_t_3 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 259, __pyx_L1_error)
7783           #else
7784           __pyx_t_3 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 259, __pyx_L1_error)
7785           __Pyx_GOTREF(__pyx_t_3);
7786           #endif
7787         } else {
7788           if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
7789           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7790           __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 259, __pyx_L1_error)
7791           #else
7792           __pyx_t_3 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 259, __pyx_L1_error)
7793           __Pyx_GOTREF(__pyx_t_3);
7794           #endif
7795         }
7796       } else {
7797         __pyx_t_3 = __pyx_t_7(__pyx_t_5);
7798         if (unlikely(!__pyx_t_3)) {
7799           PyObject* exc_type = PyErr_Occurred();
7800           if (exc_type) {
7801             if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
7802             else __PYX_ERR(0, 259, __pyx_L1_error)
7803           }
7804           break;
7805         }
7806         __Pyx_GOTREF(__pyx_t_3);
7807       }
7808       if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
7809         PyObject* sequence = __pyx_t_3;
7810         Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
7811         if (unlikely(size != 2)) {
7812           if (size > 2) __Pyx_RaiseTooManyValuesError(2);
7813           else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
7814           __PYX_ERR(0, 259, __pyx_L1_error)
7815         }
7816         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7817         if (likely(PyTuple_CheckExact(sequence))) {
7818           __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
7819           __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
7820         } else {
7821           __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
7822           __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
7823         }
7824         __Pyx_INCREF(__pyx_t_8);
7825         __Pyx_INCREF(__pyx_t_9);
7826         #else
7827         __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 259, __pyx_L1_error)
7828         __Pyx_GOTREF(__pyx_t_8);
7829         __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 259, __pyx_L1_error)
7830         __Pyx_GOTREF(__pyx_t_9);
7831         #endif
7832         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7833       } else {
7834         Py_ssize_t index = -1;
7835         __pyx_t_10 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 259, __pyx_L1_error)
7836         __Pyx_GOTREF(__pyx_t_10);
7837         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7838         __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
7839         index = 0; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L9_unpacking_failed;
7840         __Pyx_GOTREF(__pyx_t_8);
7841         index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L9_unpacking_failed;
7842         __Pyx_GOTREF(__pyx_t_9);
7843         if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) __PYX_ERR(0, 259, __pyx_L1_error)
7844         __pyx_t_11 = NULL;
7845         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7846         goto __pyx_L10_unpacking_done;
7847         __pyx_L9_unpacking_failed:;
7848         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7849         __pyx_t_11 = NULL;
7850         if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
7851         __PYX_ERR(0, 259, __pyx_L1_error)
7852         __pyx_L10_unpacking_done:;
7853       }
7854       __Pyx_XDECREF_SET(__pyx_v_pfx, __pyx_t_8);
7855       __pyx_t_8 = 0;
7856       __Pyx_XDECREF_SET(__pyx_v_uri, __pyx_t_9);
7857       __pyx_t_9 = 0;
7858
7859       /* "lxml/sax.py":260
7860  *             candidates = [
7861  *                 pfx for (pfx, uri) in nsmap.items()
7862  *                 if pfx is not None and uri == ns_uri             # <<<<<<<<<<<<<<
7863  *             ]
7864  *             prefix = (
7865  */
7866       __pyx_t_1 = (__pyx_v_pfx != Py_None);
7867       __pyx_t_12 = (__pyx_t_1 != 0);
7868       if (__pyx_t_12) {
7869       } else {
7870         __pyx_t_2 = __pyx_t_12;
7871         goto __pyx_L12_bool_binop_done;
7872       }
7873       __pyx_t_3 = PyObject_RichCompare(__pyx_v_uri, __pyx_v_ns_uri, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 260, __pyx_L1_error)
7874       __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 260, __pyx_L1_error)
7875       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7876       __pyx_t_2 = __pyx_t_12;
7877       __pyx_L12_bool_binop_done:;
7878       if (__pyx_t_2) {
7879
7880         /* "lxml/sax.py":259
7881  *             # Pick the first matching prefix, in alphabetical order.
7882  *             candidates = [
7883  *                 pfx for (pfx, uri) in nsmap.items()             # <<<<<<<<<<<<<<
7884  *                 if pfx is not None and uri == ns_uri
7885  *             ]
7886  */
7887         if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_v_pfx))) __PYX_ERR(0, 258, __pyx_L1_error)
7888
7889         /* "lxml/sax.py":260
7890  *             candidates = [
7891  *                 pfx for (pfx, uri) in nsmap.items()
7892  *                 if pfx is not None and uri == ns_uri             # <<<<<<<<<<<<<<
7893  *             ]
7894  *             prefix = (
7895  */
7896       }
7897
7898       /* "lxml/sax.py":259
7899  *             # Pick the first matching prefix, in alphabetical order.
7900  *             candidates = [
7901  *                 pfx for (pfx, uri) in nsmap.items()             # <<<<<<<<<<<<<<
7902  *                 if pfx is not None and uri == ns_uri
7903  *             ]
7904  */
7905     }
7906     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7907     __pyx_v_candidates = ((PyObject*)__pyx_t_4);
7908     __pyx_t_4 = 0;
7909
7910     /* "lxml/sax.py":263
7911  *             ]
7912  *             prefix = (
7913  *                 candidates[0] if len(candidates) == 1             # <<<<<<<<<<<<<<
7914  *                 else min(candidates) if candidates
7915  *                 else None
7916  */
7917     __pyx_t_6 = PyList_GET_SIZE(__pyx_v_candidates); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 263, __pyx_L1_error)
7918     if (((__pyx_t_6 == 1) != 0)) {
7919       __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_candidates, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 263, __pyx_L1_error)
7920       __Pyx_GOTREF(__pyx_t_5);
7921       __pyx_t_4 = __pyx_t_5;
7922       __pyx_t_5 = 0;
7923     } else {
7924
7925       /* "lxml/sax.py":264
7926  *             prefix = (
7927  *                 candidates[0] if len(candidates) == 1
7928  *                 else min(candidates) if candidates             # <<<<<<<<<<<<<<
7929  *                 else None
7930  *             )
7931  */
7932       __pyx_t_2 = (PyList_GET_SIZE(__pyx_v_candidates) != 0);
7933       if (__pyx_t_2) {
7934         __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_min, __pyx_v_candidates); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 264, __pyx_L1_error)
7935         __Pyx_GOTREF(__pyx_t_3);
7936         __pyx_t_5 = __pyx_t_3;
7937         __pyx_t_3 = 0;
7938       } else {
7939
7940         /* "lxml/sax.py":265
7941  *                 candidates[0] if len(candidates) == 1
7942  *                 else min(candidates) if candidates
7943  *                 else None             # <<<<<<<<<<<<<<
7944  *             )
7945  * 
7946  */
7947         __Pyx_INCREF(Py_None);
7948         __pyx_t_5 = Py_None;
7949       }
7950       __pyx_t_4 = __pyx_t_5;
7951       __pyx_t_5 = 0;
7952     }
7953     __pyx_v_prefix = __pyx_t_4;
7954     __pyx_t_4 = 0;
7955   }
7956   __pyx_L4:;
7957
7958   /* "lxml/sax.py":268
7959  *             )
7960  * 
7961  *         if prefix is None:             # <<<<<<<<<<<<<<
7962  *             # Default namespace
7963  *             return local_name
7964  */
7965   __pyx_t_2 = (__pyx_v_prefix == Py_None);
7966   __pyx_t_12 = (__pyx_t_2 != 0);
7967   if (__pyx_t_12) {
7968
7969     /* "lxml/sax.py":270
7970  *         if prefix is None:
7971  *             # Default namespace
7972  *             return local_name             # <<<<<<<<<<<<<<
7973  *         return prefix + ':' + local_name
7974  * 
7975  */
7976     __Pyx_XDECREF(__pyx_r);
7977     __Pyx_INCREF(__pyx_v_local_name);
7978     __pyx_r = __pyx_v_local_name;
7979     goto __pyx_L0;
7980
7981     /* "lxml/sax.py":268
7982  *             )
7983  * 
7984  *         if prefix is None:             # <<<<<<<<<<<<<<
7985  *             # Default namespace
7986  *             return local_name
7987  */
7988   }
7989
7990   /* "lxml/sax.py":271
7991  *             # Default namespace
7992  *             return local_name
7993  *         return prefix + ':' + local_name             # <<<<<<<<<<<<<<
7994  * 
7995  * 
7996  */
7997   __Pyx_XDECREF(__pyx_r);
7998   __pyx_t_4 = PyNumber_Add(__pyx_v_prefix, __pyx_kp_s__8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 271, __pyx_L1_error)
7999   __Pyx_GOTREF(__pyx_t_4);
8000   __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_v_local_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 271, __pyx_L1_error)
8001   __Pyx_GOTREF(__pyx_t_5);
8002   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8003   __pyx_r = __pyx_t_5;
8004   __pyx_t_5 = 0;
8005   goto __pyx_L0;
8006
8007   /* "lxml/sax.py":250
8008  *             content_handler.characters(tail)
8009  * 
8010  *     def _build_qname(self, ns_uri, local_name, nsmap, preferred_prefix, is_attribute):             # <<<<<<<<<<<<<<
8011  *         if ns_uri is None:
8012  *             return local_name
8013  */
8014
8015   /* function exit code */
8016   __pyx_L1_error:;
8017   __Pyx_XDECREF(__pyx_t_3);
8018   __Pyx_XDECREF(__pyx_t_4);
8019   __Pyx_XDECREF(__pyx_t_5);
8020   __Pyx_XDECREF(__pyx_t_8);
8021   __Pyx_XDECREF(__pyx_t_9);
8022   __Pyx_XDECREF(__pyx_t_10);
8023   __Pyx_AddTraceback("lxml.sax.ElementTreeProducer._build_qname", __pyx_clineno, __pyx_lineno, __pyx_filename);
8024   __pyx_r = 0;
8025   __pyx_L0:;
8026   __Pyx_XDECREF(__pyx_v_prefix);
8027   __Pyx_XDECREF(__pyx_v_candidates);
8028   __Pyx_XDECREF(__pyx_v_pfx);
8029   __Pyx_XDECREF(__pyx_v_uri);
8030   __Pyx_XGIVEREF(__pyx_r);
8031   __Pyx_RefNannyFinishContext();
8032   return __pyx_r;
8033 }
8034
8035 /* "(tree fragment)":1
8036  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
8037  *     cdef tuple state
8038  *     cdef object _dict
8039  */
8040
8041 /* Python wrapper */
8042 static PyObject *__pyx_pw_4lxml_3sax_19ElementTreeProducer_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
8043 static PyMethodDef __pyx_mdef_4lxml_3sax_19ElementTreeProducer_5__reduce_cython__ = {"__reduce_cython__", (PyCFunction)__pyx_pw_4lxml_3sax_19ElementTreeProducer_5__reduce_cython__, METH_NOARGS, 0};
8044 static PyObject *__pyx_pw_4lxml_3sax_19ElementTreeProducer_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
8045   PyObject *__pyx_r = 0;
8046   __Pyx_RefNannyDeclarations
8047   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
8048   __pyx_r = __pyx_pf_4lxml_3sax_19ElementTreeProducer_4__reduce_cython__(((struct __pyx_obj_4lxml_3sax_ElementTreeProducer *)__pyx_v_self));
8049
8050   /* function exit code */
8051   __Pyx_RefNannyFinishContext();
8052   return __pyx_r;
8053 }
8054
8055 static PyObject *__pyx_pf_4lxml_3sax_19ElementTreeProducer_4__reduce_cython__(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *__pyx_v_self) {
8056   PyObject *__pyx_v_state = 0;
8057   PyObject *__pyx_v__dict = 0;
8058   int __pyx_v_use_setstate;
8059   PyObject *__pyx_r = NULL;
8060   __Pyx_RefNannyDeclarations
8061   PyObject *__pyx_t_1 = NULL;
8062   int __pyx_t_2;
8063   int __pyx_t_3;
8064   PyObject *__pyx_t_4 = NULL;
8065   int __pyx_t_5;
8066   PyObject *__pyx_t_6 = NULL;
8067   int __pyx_lineno = 0;
8068   const char *__pyx_filename = NULL;
8069   int __pyx_clineno = 0;
8070   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
8071
8072   /* "(tree fragment)":5
8073  *     cdef object _dict
8074  *     cdef bint use_setstate
8075  *     state = (self._attr_class, self._content_handler, self._element, self._empty_attributes)             # <<<<<<<<<<<<<<
8076  *     _dict = getattr(self, '__dict__', None)
8077  *     if _dict is not None:
8078  */
8079   __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
8080   __Pyx_GOTREF(__pyx_t_1);
8081   __Pyx_INCREF(__pyx_v_self->_attr_class);
8082   __Pyx_GIVEREF(__pyx_v_self->_attr_class);
8083   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->_attr_class);
8084   __Pyx_INCREF(__pyx_v_self->_content_handler);
8085   __Pyx_GIVEREF(__pyx_v_self->_content_handler);
8086   PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_self->_content_handler);
8087   __Pyx_INCREF(__pyx_v_self->_element);
8088   __Pyx_GIVEREF(__pyx_v_self->_element);
8089   PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_self->_element);
8090   __Pyx_INCREF(__pyx_v_self->_empty_attributes);
8091   __Pyx_GIVEREF(__pyx_v_self->_empty_attributes);
8092   PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_self->_empty_attributes);
8093   __pyx_v_state = ((PyObject*)__pyx_t_1);
8094   __pyx_t_1 = 0;
8095
8096   /* "(tree fragment)":6
8097  *     cdef bint use_setstate
8098  *     state = (self._attr_class, self._content_handler, self._element, self._empty_attributes)
8099  *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
8100  *     if _dict is not None:
8101  *         state += (_dict,)
8102  */
8103   __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
8104   __Pyx_GOTREF(__pyx_t_1);
8105   __pyx_v__dict = __pyx_t_1;
8106   __pyx_t_1 = 0;
8107
8108   /* "(tree fragment)":7
8109  *     state = (self._attr_class, self._content_handler, self._element, self._empty_attributes)
8110  *     _dict = getattr(self, '__dict__', None)
8111  *     if _dict is not None:             # <<<<<<<<<<<<<<
8112  *         state += (_dict,)
8113  *         use_setstate = True
8114  */
8115   __pyx_t_2 = (__pyx_v__dict != Py_None);
8116   __pyx_t_3 = (__pyx_t_2 != 0);
8117   if (__pyx_t_3) {
8118
8119     /* "(tree fragment)":8
8120  *     _dict = getattr(self, '__dict__', None)
8121  *     if _dict is not None:
8122  *         state += (_dict,)             # <<<<<<<<<<<<<<
8123  *         use_setstate = True
8124  *     else:
8125  */
8126     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
8127     __Pyx_GOTREF(__pyx_t_1);
8128     __Pyx_INCREF(__pyx_v__dict);
8129     __Pyx_GIVEREF(__pyx_v__dict);
8130     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
8131     __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
8132     __Pyx_GOTREF(__pyx_t_4);
8133     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8134     __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
8135     __pyx_t_4 = 0;
8136
8137     /* "(tree fragment)":9
8138  *     if _dict is not None:
8139  *         state += (_dict,)
8140  *         use_setstate = True             # <<<<<<<<<<<<<<
8141  *     else:
8142  *         use_setstate = self._attr_class is not None or self._content_handler is not None or self._element is not None or self._empty_attributes is not None
8143  */
8144     __pyx_v_use_setstate = 1;
8145
8146     /* "(tree fragment)":7
8147  *     state = (self._attr_class, self._content_handler, self._element, self._empty_attributes)
8148  *     _dict = getattr(self, '__dict__', None)
8149  *     if _dict is not None:             # <<<<<<<<<<<<<<
8150  *         state += (_dict,)
8151  *         use_setstate = True
8152  */
8153     goto __pyx_L3;
8154   }
8155
8156   /* "(tree fragment)":11
8157  *         use_setstate = True
8158  *     else:
8159  *         use_setstate = self._attr_class is not None or self._content_handler is not None or self._element is not None or self._empty_attributes is not None             # <<<<<<<<<<<<<<
8160  *     if use_setstate:
8161  *         return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, None), state
8162  */
8163   /*else*/ {
8164     __pyx_t_2 = (__pyx_v_self->_attr_class != Py_None);
8165     __pyx_t_5 = (__pyx_t_2 != 0);
8166     if (!__pyx_t_5) {
8167     } else {
8168       __pyx_t_3 = __pyx_t_5;
8169       goto __pyx_L4_bool_binop_done;
8170     }
8171     __pyx_t_5 = (__pyx_v_self->_content_handler != Py_None);
8172     __pyx_t_2 = (__pyx_t_5 != 0);
8173     if (!__pyx_t_2) {
8174     } else {
8175       __pyx_t_3 = __pyx_t_2;
8176       goto __pyx_L4_bool_binop_done;
8177     }
8178     __pyx_t_2 = (__pyx_v_self->_element != Py_None);
8179     __pyx_t_5 = (__pyx_t_2 != 0);
8180     if (!__pyx_t_5) {
8181     } else {
8182       __pyx_t_3 = __pyx_t_5;
8183       goto __pyx_L4_bool_binop_done;
8184     }
8185     __pyx_t_5 = (__pyx_v_self->_empty_attributes != Py_None);
8186     __pyx_t_2 = (__pyx_t_5 != 0);
8187     __pyx_t_3 = __pyx_t_2;
8188     __pyx_L4_bool_binop_done:;
8189     __pyx_v_use_setstate = __pyx_t_3;
8190   }
8191   __pyx_L3:;
8192
8193   /* "(tree fragment)":12
8194  *     else:
8195  *         use_setstate = self._attr_class is not None or self._content_handler is not None or self._element is not None or self._empty_attributes is not None
8196  *     if use_setstate:             # <<<<<<<<<<<<<<
8197  *         return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, None), state
8198  *     else:
8199  */
8200   __pyx_t_3 = (__pyx_v_use_setstate != 0);
8201   if (__pyx_t_3) {
8202
8203     /* "(tree fragment)":13
8204  *         use_setstate = self._attr_class is not None or self._content_handler is not None or self._element is not None or self._empty_attributes is not None
8205  *     if use_setstate:
8206  *         return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, None), state             # <<<<<<<<<<<<<<
8207  *     else:
8208  *         return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, state)
8209  */
8210     __Pyx_XDECREF(__pyx_r);
8211     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_ElementTreeProduc); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
8212     __Pyx_GOTREF(__pyx_t_4);
8213     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
8214     __Pyx_GOTREF(__pyx_t_1);
8215     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8216     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8217     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8218     __Pyx_INCREF(__pyx_int_30712058);
8219     __Pyx_GIVEREF(__pyx_int_30712058);
8220     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_30712058);
8221     __Pyx_INCREF(Py_None);
8222     __Pyx_GIVEREF(Py_None);
8223     PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
8224     __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
8225     __Pyx_GOTREF(__pyx_t_6);
8226     __Pyx_GIVEREF(__pyx_t_4);
8227     PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
8228     __Pyx_GIVEREF(__pyx_t_1);
8229     PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
8230     __Pyx_INCREF(__pyx_v_state);
8231     __Pyx_GIVEREF(__pyx_v_state);
8232     PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_state);
8233     __pyx_t_4 = 0;
8234     __pyx_t_1 = 0;
8235     __pyx_r = __pyx_t_6;
8236     __pyx_t_6 = 0;
8237     goto __pyx_L0;
8238
8239     /* "(tree fragment)":12
8240  *     else:
8241  *         use_setstate = self._attr_class is not None or self._content_handler is not None or self._element is not None or self._empty_attributes is not None
8242  *     if use_setstate:             # <<<<<<<<<<<<<<
8243  *         return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, None), state
8244  *     else:
8245  */
8246   }
8247
8248   /* "(tree fragment)":15
8249  *         return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, None), state
8250  *     else:
8251  *         return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, state)             # <<<<<<<<<<<<<<
8252  * def __setstate_cython__(self, __pyx_state):
8253  *     __pyx_unpickle_ElementTreeProducer__set_state(self, __pyx_state)
8254  */
8255   /*else*/ {
8256     __Pyx_XDECREF(__pyx_r);
8257     __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pyx_unpickle_ElementTreeProduc); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 15, __pyx_L1_error)
8258     __Pyx_GOTREF(__pyx_t_6);
8259     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
8260     __Pyx_GOTREF(__pyx_t_1);
8261     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8262     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8263     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8264     __Pyx_INCREF(__pyx_int_30712058);
8265     __Pyx_GIVEREF(__pyx_int_30712058);
8266     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_30712058);
8267     __Pyx_INCREF(__pyx_v_state);
8268     __Pyx_GIVEREF(__pyx_v_state);
8269     PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
8270     __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
8271     __Pyx_GOTREF(__pyx_t_4);
8272     __Pyx_GIVEREF(__pyx_t_6);
8273     PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
8274     __Pyx_GIVEREF(__pyx_t_1);
8275     PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
8276     __pyx_t_6 = 0;
8277     __pyx_t_1 = 0;
8278     __pyx_r = __pyx_t_4;
8279     __pyx_t_4 = 0;
8280     goto __pyx_L0;
8281   }
8282
8283   /* "(tree fragment)":1
8284  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
8285  *     cdef tuple state
8286  *     cdef object _dict
8287  */
8288
8289   /* function exit code */
8290   __pyx_L1_error:;
8291   __Pyx_XDECREF(__pyx_t_1);
8292   __Pyx_XDECREF(__pyx_t_4);
8293   __Pyx_XDECREF(__pyx_t_6);
8294   __Pyx_AddTraceback("lxml.sax.ElementTreeProducer.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8295   __pyx_r = NULL;
8296   __pyx_L0:;
8297   __Pyx_XDECREF(__pyx_v_state);
8298   __Pyx_XDECREF(__pyx_v__dict);
8299   __Pyx_XGIVEREF(__pyx_r);
8300   __Pyx_RefNannyFinishContext();
8301   return __pyx_r;
8302 }
8303
8304 /* "(tree fragment)":16
8305  *     else:
8306  *         return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, state)
8307  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
8308  *     __pyx_unpickle_ElementTreeProducer__set_state(self, __pyx_state)
8309  */
8310
8311 /* Python wrapper */
8312 static PyObject *__pyx_pw_4lxml_3sax_19ElementTreeProducer_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
8313 static PyMethodDef __pyx_mdef_4lxml_3sax_19ElementTreeProducer_7__setstate_cython__ = {"__setstate_cython__", (PyCFunction)__pyx_pw_4lxml_3sax_19ElementTreeProducer_7__setstate_cython__, METH_O, 0};
8314 static PyObject *__pyx_pw_4lxml_3sax_19ElementTreeProducer_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
8315   PyObject *__pyx_r = 0;
8316   __Pyx_RefNannyDeclarations
8317   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
8318   __pyx_r = __pyx_pf_4lxml_3sax_19ElementTreeProducer_6__setstate_cython__(((struct __pyx_obj_4lxml_3sax_ElementTreeProducer *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
8319
8320   /* function exit code */
8321   __Pyx_RefNannyFinishContext();
8322   return __pyx_r;
8323 }
8324
8325 static PyObject *__pyx_pf_4lxml_3sax_19ElementTreeProducer_6__setstate_cython__(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
8326   PyObject *__pyx_r = NULL;
8327   __Pyx_RefNannyDeclarations
8328   PyObject *__pyx_t_1 = NULL;
8329   int __pyx_lineno = 0;
8330   const char *__pyx_filename = NULL;
8331   int __pyx_clineno = 0;
8332   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
8333
8334   /* "(tree fragment)":17
8335  *         return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, state)
8336  * def __setstate_cython__(self, __pyx_state):
8337  *     __pyx_unpickle_ElementTreeProducer__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
8338  */
8339   if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
8340   __pyx_t_1 = __pyx_f_4lxml_3sax___pyx_unpickle_ElementTreeProducer__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
8341   __Pyx_GOTREF(__pyx_t_1);
8342   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8343
8344   /* "(tree fragment)":16
8345  *     else:
8346  *         return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, state)
8347  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
8348  *     __pyx_unpickle_ElementTreeProducer__set_state(self, __pyx_state)
8349  */
8350
8351   /* function exit code */
8352   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8353   goto __pyx_L0;
8354   __pyx_L1_error:;
8355   __Pyx_XDECREF(__pyx_t_1);
8356   __Pyx_AddTraceback("lxml.sax.ElementTreeProducer.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8357   __pyx_r = NULL;
8358   __pyx_L0:;
8359   __Pyx_XGIVEREF(__pyx_r);
8360   __Pyx_RefNannyFinishContext();
8361   return __pyx_r;
8362 }
8363
8364 /* "lxml/sax.py":274
8365  * 
8366  * 
8367  * def saxify(element_or_tree, content_handler):             # <<<<<<<<<<<<<<
8368  *     """One-shot helper to generate SAX events from an XML tree and fire
8369  *     them against a SAX ContentHandler.
8370  */
8371
8372 /* Python wrapper */
8373 static PyObject *__pyx_pw_4lxml_3sax_1saxify(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8374 static char __pyx_doc_4lxml_3sax_saxify[] = "One-shot helper to generate SAX events from an XML tree and fire\n    them against a SAX ContentHandler.\n    ";
8375 static PyMethodDef __pyx_mdef_4lxml_3sax_1saxify = {"saxify", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_1saxify, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lxml_3sax_saxify};
8376 static PyObject *__pyx_pw_4lxml_3sax_1saxify(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8377   PyObject *__pyx_v_element_or_tree = 0;
8378   PyObject *__pyx_v_content_handler = 0;
8379   int __pyx_lineno = 0;
8380   const char *__pyx_filename = NULL;
8381   int __pyx_clineno = 0;
8382   PyObject *__pyx_r = 0;
8383   __Pyx_RefNannyDeclarations
8384   __Pyx_RefNannySetupContext("saxify (wrapper)", 0);
8385   {
8386     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_element_or_tree,&__pyx_n_s_content_handler,0};
8387     PyObject* values[2] = {0,0};
8388     if (unlikely(__pyx_kwds)) {
8389       Py_ssize_t kw_args;
8390       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8391       switch (pos_args) {
8392         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8393         CYTHON_FALLTHROUGH;
8394         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8395         CYTHON_FALLTHROUGH;
8396         case  0: break;
8397         default: goto __pyx_L5_argtuple_error;
8398       }
8399       kw_args = PyDict_Size(__pyx_kwds);
8400       switch (pos_args) {
8401         case  0:
8402         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_element_or_tree)) != 0)) kw_args--;
8403         else goto __pyx_L5_argtuple_error;
8404         CYTHON_FALLTHROUGH;
8405         case  1:
8406         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_content_handler)) != 0)) kw_args--;
8407         else {
8408           __Pyx_RaiseArgtupleInvalid("saxify", 1, 2, 2, 1); __PYX_ERR(0, 274, __pyx_L3_error)
8409         }
8410       }
8411       if (unlikely(kw_args > 0)) {
8412         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "saxify") < 0)) __PYX_ERR(0, 274, __pyx_L3_error)
8413       }
8414     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
8415       goto __pyx_L5_argtuple_error;
8416     } else {
8417       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8418       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8419     }
8420     __pyx_v_element_or_tree = values[0];
8421     __pyx_v_content_handler = values[1];
8422   }
8423   goto __pyx_L4_argument_unpacking_done;
8424   __pyx_L5_argtuple_error:;
8425   __Pyx_RaiseArgtupleInvalid("saxify", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 274, __pyx_L3_error)
8426   __pyx_L3_error:;
8427   __Pyx_AddTraceback("lxml.sax.saxify", __pyx_clineno, __pyx_lineno, __pyx_filename);
8428   __Pyx_RefNannyFinishContext();
8429   return NULL;
8430   __pyx_L4_argument_unpacking_done:;
8431   __pyx_r = __pyx_pf_4lxml_3sax_saxify(__pyx_self, __pyx_v_element_or_tree, __pyx_v_content_handler);
8432
8433   /* function exit code */
8434   __Pyx_RefNannyFinishContext();
8435   return __pyx_r;
8436 }
8437
8438 static PyObject *__pyx_pf_4lxml_3sax_saxify(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_element_or_tree, PyObject *__pyx_v_content_handler) {
8439   PyObject *__pyx_r = NULL;
8440   __Pyx_RefNannyDeclarations
8441   PyObject *__pyx_t_1 = NULL;
8442   PyObject *__pyx_t_2 = NULL;
8443   PyObject *__pyx_t_3 = NULL;
8444   int __pyx_lineno = 0;
8445   const char *__pyx_filename = NULL;
8446   int __pyx_clineno = 0;
8447   __Pyx_RefNannySetupContext("saxify", 0);
8448
8449   /* "lxml/sax.py":278
8450  *     them against a SAX ContentHandler.
8451  *     """
8452  *     return ElementTreeProducer(element_or_tree, content_handler).saxify()             # <<<<<<<<<<<<<<
8453  */
8454   __Pyx_XDECREF(__pyx_r);
8455   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 278, __pyx_L1_error)
8456   __Pyx_GOTREF(__pyx_t_2);
8457   __Pyx_INCREF(__pyx_v_element_or_tree);
8458   __Pyx_GIVEREF(__pyx_v_element_or_tree);
8459   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_element_or_tree);
8460   __Pyx_INCREF(__pyx_v_content_handler);
8461   __Pyx_GIVEREF(__pyx_v_content_handler);
8462   PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_content_handler);
8463   __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_3sax_ElementTreeProducer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 278, __pyx_L1_error)
8464   __Pyx_GOTREF(__pyx_t_3);
8465   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8466   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_saxify); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 278, __pyx_L1_error)
8467   __Pyx_GOTREF(__pyx_t_2);
8468   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8469   __pyx_t_3 = NULL;
8470   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
8471     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
8472     if (likely(__pyx_t_3)) {
8473       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
8474       __Pyx_INCREF(__pyx_t_3);
8475       __Pyx_INCREF(function);
8476       __Pyx_DECREF_SET(__pyx_t_2, function);
8477     }
8478   }
8479   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
8480   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
8481   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 278, __pyx_L1_error)
8482   __Pyx_GOTREF(__pyx_t_1);
8483   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8484   __pyx_r = __pyx_t_1;
8485   __pyx_t_1 = 0;
8486   goto __pyx_L0;
8487
8488   /* "lxml/sax.py":274
8489  * 
8490  * 
8491  * def saxify(element_or_tree, content_handler):             # <<<<<<<<<<<<<<
8492  *     """One-shot helper to generate SAX events from an XML tree and fire
8493  *     them against a SAX ContentHandler.
8494  */
8495
8496   /* function exit code */
8497   __pyx_L1_error:;
8498   __Pyx_XDECREF(__pyx_t_1);
8499   __Pyx_XDECREF(__pyx_t_2);
8500   __Pyx_XDECREF(__pyx_t_3);
8501   __Pyx_AddTraceback("lxml.sax.saxify", __pyx_clineno, __pyx_lineno, __pyx_filename);
8502   __pyx_r = NULL;
8503   __pyx_L0:;
8504   __Pyx_XGIVEREF(__pyx_r);
8505   __Pyx_RefNannyFinishContext();
8506   return __pyx_r;
8507 }
8508
8509 /* "(tree fragment)":1
8510  * def __pyx_unpickle_ElementTreeProducer(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
8511  *     cdef object __pyx_PickleError
8512  *     cdef object __pyx_result
8513  */
8514
8515 /* Python wrapper */
8516 static PyObject *__pyx_pw_4lxml_3sax_3__pyx_unpickle_ElementTreeProducer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8517 static PyMethodDef __pyx_mdef_4lxml_3sax_3__pyx_unpickle_ElementTreeProducer = {"__pyx_unpickle_ElementTreeProducer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_3__pyx_unpickle_ElementTreeProducer, METH_VARARGS|METH_KEYWORDS, 0};
8518 static PyObject *__pyx_pw_4lxml_3sax_3__pyx_unpickle_ElementTreeProducer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8519   PyObject *__pyx_v___pyx_type = 0;
8520   long __pyx_v___pyx_checksum;
8521   PyObject *__pyx_v___pyx_state = 0;
8522   int __pyx_lineno = 0;
8523   const char *__pyx_filename = NULL;
8524   int __pyx_clineno = 0;
8525   PyObject *__pyx_r = 0;
8526   __Pyx_RefNannyDeclarations
8527   __Pyx_RefNannySetupContext("__pyx_unpickle_ElementTreeProducer (wrapper)", 0);
8528   {
8529     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
8530     PyObject* values[3] = {0,0,0};
8531     if (unlikely(__pyx_kwds)) {
8532       Py_ssize_t kw_args;
8533       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8534       switch (pos_args) {
8535         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8536         CYTHON_FALLTHROUGH;
8537         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8538         CYTHON_FALLTHROUGH;
8539         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8540         CYTHON_FALLTHROUGH;
8541         case  0: break;
8542         default: goto __pyx_L5_argtuple_error;
8543       }
8544       kw_args = PyDict_Size(__pyx_kwds);
8545       switch (pos_args) {
8546         case  0:
8547         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
8548         else goto __pyx_L5_argtuple_error;
8549         CYTHON_FALLTHROUGH;
8550         case  1:
8551         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
8552         else {
8553           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ElementTreeProducer", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
8554         }
8555         CYTHON_FALLTHROUGH;
8556         case  2:
8557         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
8558         else {
8559           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ElementTreeProducer", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
8560         }
8561       }
8562       if (unlikely(kw_args > 0)) {
8563         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_ElementTreeProducer") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
8564       }
8565     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
8566       goto __pyx_L5_argtuple_error;
8567     } else {
8568       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8569       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8570       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8571     }
8572     __pyx_v___pyx_type = values[0];
8573     __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
8574     __pyx_v___pyx_state = values[2];
8575   }
8576   goto __pyx_L4_argument_unpacking_done;
8577   __pyx_L5_argtuple_error:;
8578   __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ElementTreeProducer", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
8579   __pyx_L3_error:;
8580   __Pyx_AddTraceback("lxml.sax.__pyx_unpickle_ElementTreeProducer", __pyx_clineno, __pyx_lineno, __pyx_filename);
8581   __Pyx_RefNannyFinishContext();
8582   return NULL;
8583   __pyx_L4_argument_unpacking_done:;
8584   __pyx_r = __pyx_pf_4lxml_3sax_2__pyx_unpickle_ElementTreeProducer(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
8585
8586   /* function exit code */
8587   __Pyx_RefNannyFinishContext();
8588   return __pyx_r;
8589 }
8590
8591 static PyObject *__pyx_pf_4lxml_3sax_2__pyx_unpickle_ElementTreeProducer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
8592   PyObject *__pyx_v___pyx_PickleError = 0;
8593   PyObject *__pyx_v___pyx_result = 0;
8594   PyObject *__pyx_r = NULL;
8595   __Pyx_RefNannyDeclarations
8596   int __pyx_t_1;
8597   PyObject *__pyx_t_2 = NULL;
8598   PyObject *__pyx_t_3 = NULL;
8599   PyObject *__pyx_t_4 = NULL;
8600   PyObject *__pyx_t_5 = NULL;
8601   int __pyx_t_6;
8602   int __pyx_lineno = 0;
8603   const char *__pyx_filename = NULL;
8604   int __pyx_clineno = 0;
8605   __Pyx_RefNannySetupContext("__pyx_unpickle_ElementTreeProducer", 0);
8606
8607   /* "(tree fragment)":4
8608  *     cdef object __pyx_PickleError
8609  *     cdef object __pyx_result
8610  *     if __pyx_checksum != 0x1d4a0fa:             # <<<<<<<<<<<<<<
8611  *         from pickle import PickleError as __pyx_PickleError
8612  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x1d4a0fa = (_attr_class, _content_handler, _element, _empty_attributes))" % __pyx_checksum)
8613  */
8614   __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x1d4a0fa) != 0);
8615   if (__pyx_t_1) {
8616
8617     /* "(tree fragment)":5
8618  *     cdef object __pyx_result
8619  *     if __pyx_checksum != 0x1d4a0fa:
8620  *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
8621  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x1d4a0fa = (_attr_class, _content_handler, _element, _empty_attributes))" % __pyx_checksum)
8622  *     __pyx_result = ElementTreeProducer.__new__(__pyx_type)
8623  */
8624     __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
8625     __Pyx_GOTREF(__pyx_t_2);
8626     __Pyx_INCREF(__pyx_n_s_PickleError);
8627     __Pyx_GIVEREF(__pyx_n_s_PickleError);
8628     PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
8629     __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
8630     __Pyx_GOTREF(__pyx_t_3);
8631     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8632     __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
8633     __Pyx_GOTREF(__pyx_t_2);
8634     __Pyx_INCREF(__pyx_t_2);
8635     __pyx_v___pyx_PickleError = __pyx_t_2;
8636     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8637     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8638
8639     /* "(tree fragment)":6
8640  *     if __pyx_checksum != 0x1d4a0fa:
8641  *         from pickle import PickleError as __pyx_PickleError
8642  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x1d4a0fa = (_attr_class, _content_handler, _element, _empty_attributes))" % __pyx_checksum)             # <<<<<<<<<<<<<<
8643  *     __pyx_result = ElementTreeProducer.__new__(__pyx_type)
8644  *     if __pyx_state is not None:
8645  */
8646     __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
8647     __Pyx_GOTREF(__pyx_t_2);
8648     __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x1d, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
8649     __Pyx_GOTREF(__pyx_t_4);
8650     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8651     __Pyx_INCREF(__pyx_v___pyx_PickleError);
8652     __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
8653     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
8654       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
8655       if (likely(__pyx_t_5)) {
8656         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
8657         __Pyx_INCREF(__pyx_t_5);
8658         __Pyx_INCREF(function);
8659         __Pyx_DECREF_SET(__pyx_t_2, function);
8660       }
8661     }
8662     __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
8663     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
8664     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8665     if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
8666     __Pyx_GOTREF(__pyx_t_3);
8667     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8668     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
8669     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8670     __PYX_ERR(1, 6, __pyx_L1_error)
8671
8672     /* "(tree fragment)":4
8673  *     cdef object __pyx_PickleError
8674  *     cdef object __pyx_result
8675  *     if __pyx_checksum != 0x1d4a0fa:             # <<<<<<<<<<<<<<
8676  *         from pickle import PickleError as __pyx_PickleError
8677  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x1d4a0fa = (_attr_class, _content_handler, _element, _empty_attributes))" % __pyx_checksum)
8678  */
8679   }
8680
8681   /* "(tree fragment)":7
8682  *         from pickle import PickleError as __pyx_PickleError
8683  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x1d4a0fa = (_attr_class, _content_handler, _element, _empty_attributes))" % __pyx_checksum)
8684  *     __pyx_result = ElementTreeProducer.__new__(__pyx_type)             # <<<<<<<<<<<<<<
8685  *     if __pyx_state is not None:
8686  *         __pyx_unpickle_ElementTreeProducer__set_state(<ElementTreeProducer> __pyx_result, __pyx_state)
8687  */
8688   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_4lxml_3sax_ElementTreeProducer), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
8689   __Pyx_GOTREF(__pyx_t_2);
8690   __pyx_t_4 = NULL;
8691   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
8692     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
8693     if (likely(__pyx_t_4)) {
8694       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
8695       __Pyx_INCREF(__pyx_t_4);
8696       __Pyx_INCREF(function);
8697       __Pyx_DECREF_SET(__pyx_t_2, function);
8698     }
8699   }
8700   __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
8701   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
8702   if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
8703   __Pyx_GOTREF(__pyx_t_3);
8704   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8705   __pyx_v___pyx_result = __pyx_t_3;
8706   __pyx_t_3 = 0;
8707
8708   /* "(tree fragment)":8
8709  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x1d4a0fa = (_attr_class, _content_handler, _element, _empty_attributes))" % __pyx_checksum)
8710  *     __pyx_result = ElementTreeProducer.__new__(__pyx_type)
8711  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
8712  *         __pyx_unpickle_ElementTreeProducer__set_state(<ElementTreeProducer> __pyx_result, __pyx_state)
8713  *     return __pyx_result
8714  */
8715   __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
8716   __pyx_t_6 = (__pyx_t_1 != 0);
8717   if (__pyx_t_6) {
8718
8719     /* "(tree fragment)":9
8720  *     __pyx_result = ElementTreeProducer.__new__(__pyx_type)
8721  *     if __pyx_state is not None:
8722  *         __pyx_unpickle_ElementTreeProducer__set_state(<ElementTreeProducer> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
8723  *     return __pyx_result
8724  * cdef __pyx_unpickle_ElementTreeProducer__set_state(ElementTreeProducer __pyx_result, tuple __pyx_state):
8725  */
8726     if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
8727     __pyx_t_3 = __pyx_f_4lxml_3sax___pyx_unpickle_ElementTreeProducer__set_state(((struct __pyx_obj_4lxml_3sax_ElementTreeProducer *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
8728     __Pyx_GOTREF(__pyx_t_3);
8729     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8730
8731     /* "(tree fragment)":8
8732  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x1d4a0fa = (_attr_class, _content_handler, _element, _empty_attributes))" % __pyx_checksum)
8733  *     __pyx_result = ElementTreeProducer.__new__(__pyx_type)
8734  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
8735  *         __pyx_unpickle_ElementTreeProducer__set_state(<ElementTreeProducer> __pyx_result, __pyx_state)
8736  *     return __pyx_result
8737  */
8738   }
8739
8740   /* "(tree fragment)":10
8741  *     if __pyx_state is not None:
8742  *         __pyx_unpickle_ElementTreeProducer__set_state(<ElementTreeProducer> __pyx_result, __pyx_state)
8743  *     return __pyx_result             # <<<<<<<<<<<<<<
8744  * cdef __pyx_unpickle_ElementTreeProducer__set_state(ElementTreeProducer __pyx_result, tuple __pyx_state):
8745  *     __pyx_result._attr_class = __pyx_state[0]; __pyx_result._content_handler = __pyx_state[1]; __pyx_result._element = __pyx_state[2]; __pyx_result._empty_attributes = __pyx_state[3]
8746  */
8747   __Pyx_XDECREF(__pyx_r);
8748   __Pyx_INCREF(__pyx_v___pyx_result);
8749   __pyx_r = __pyx_v___pyx_result;
8750   goto __pyx_L0;
8751
8752   /* "(tree fragment)":1
8753  * def __pyx_unpickle_ElementTreeProducer(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
8754  *     cdef object __pyx_PickleError
8755  *     cdef object __pyx_result
8756  */
8757
8758   /* function exit code */
8759   __pyx_L1_error:;
8760   __Pyx_XDECREF(__pyx_t_2);
8761   __Pyx_XDECREF(__pyx_t_3);
8762   __Pyx_XDECREF(__pyx_t_4);
8763   __Pyx_XDECREF(__pyx_t_5);
8764   __Pyx_AddTraceback("lxml.sax.__pyx_unpickle_ElementTreeProducer", __pyx_clineno, __pyx_lineno, __pyx_filename);
8765   __pyx_r = NULL;
8766   __pyx_L0:;
8767   __Pyx_XDECREF(__pyx_v___pyx_PickleError);
8768   __Pyx_XDECREF(__pyx_v___pyx_result);
8769   __Pyx_XGIVEREF(__pyx_r);
8770   __Pyx_RefNannyFinishContext();
8771   return __pyx_r;
8772 }
8773
8774 /* "(tree fragment)":11
8775  *         __pyx_unpickle_ElementTreeProducer__set_state(<ElementTreeProducer> __pyx_result, __pyx_state)
8776  *     return __pyx_result
8777  * cdef __pyx_unpickle_ElementTreeProducer__set_state(ElementTreeProducer __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
8778  *     __pyx_result._attr_class = __pyx_state[0]; __pyx_result._content_handler = __pyx_state[1]; __pyx_result._element = __pyx_state[2]; __pyx_result._empty_attributes = __pyx_state[3]
8779  *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
8780  */
8781
8782 static PyObject *__pyx_f_4lxml_3sax___pyx_unpickle_ElementTreeProducer__set_state(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
8783   PyObject *__pyx_r = NULL;
8784   __Pyx_RefNannyDeclarations
8785   PyObject *__pyx_t_1 = NULL;
8786   int __pyx_t_2;
8787   Py_ssize_t __pyx_t_3;
8788   int __pyx_t_4;
8789   int __pyx_t_5;
8790   PyObject *__pyx_t_6 = NULL;
8791   PyObject *__pyx_t_7 = NULL;
8792   PyObject *__pyx_t_8 = NULL;
8793   int __pyx_lineno = 0;
8794   const char *__pyx_filename = NULL;
8795   int __pyx_clineno = 0;
8796   __Pyx_RefNannySetupContext("__pyx_unpickle_ElementTreeProducer__set_state", 0);
8797
8798   /* "(tree fragment)":12
8799  *     return __pyx_result
8800  * cdef __pyx_unpickle_ElementTreeProducer__set_state(ElementTreeProducer __pyx_result, tuple __pyx_state):
8801  *     __pyx_result._attr_class = __pyx_state[0]; __pyx_result._content_handler = __pyx_state[1]; __pyx_result._element = __pyx_state[2]; __pyx_result._empty_attributes = __pyx_state[3]             # <<<<<<<<<<<<<<
8802  *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
8803  *         __pyx_result.__dict__.update(__pyx_state[4])
8804  */
8805   if (unlikely(__pyx_v___pyx_state == Py_None)) {
8806     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8807     __PYX_ERR(1, 12, __pyx_L1_error)
8808   }
8809   __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
8810   __Pyx_GOTREF(__pyx_t_1);
8811   __Pyx_GIVEREF(__pyx_t_1);
8812   __Pyx_GOTREF(__pyx_v___pyx_result->_attr_class);
8813   __Pyx_DECREF(__pyx_v___pyx_result->_attr_class);
8814   __pyx_v___pyx_result->_attr_class = __pyx_t_1;
8815   __pyx_t_1 = 0;
8816   if (unlikely(__pyx_v___pyx_state == Py_None)) {
8817     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8818     __PYX_ERR(1, 12, __pyx_L1_error)
8819   }
8820   __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
8821   __Pyx_GOTREF(__pyx_t_1);
8822   __Pyx_GIVEREF(__pyx_t_1);
8823   __Pyx_GOTREF(__pyx_v___pyx_result->_content_handler);
8824   __Pyx_DECREF(__pyx_v___pyx_result->_content_handler);
8825   __pyx_v___pyx_result->_content_handler = __pyx_t_1;
8826   __pyx_t_1 = 0;
8827   if (unlikely(__pyx_v___pyx_state == Py_None)) {
8828     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8829     __PYX_ERR(1, 12, __pyx_L1_error)
8830   }
8831   __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
8832   __Pyx_GOTREF(__pyx_t_1);
8833   __Pyx_GIVEREF(__pyx_t_1);
8834   __Pyx_GOTREF(__pyx_v___pyx_result->_element);
8835   __Pyx_DECREF(__pyx_v___pyx_result->_element);
8836   __pyx_v___pyx_result->_element = __pyx_t_1;
8837   __pyx_t_1 = 0;
8838   if (unlikely(__pyx_v___pyx_state == Py_None)) {
8839     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8840     __PYX_ERR(1, 12, __pyx_L1_error)
8841   }
8842   __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
8843   __Pyx_GOTREF(__pyx_t_1);
8844   __Pyx_GIVEREF(__pyx_t_1);
8845   __Pyx_GOTREF(__pyx_v___pyx_result->_empty_attributes);
8846   __Pyx_DECREF(__pyx_v___pyx_result->_empty_attributes);
8847   __pyx_v___pyx_result->_empty_attributes = __pyx_t_1;
8848   __pyx_t_1 = 0;
8849
8850   /* "(tree fragment)":13
8851  * cdef __pyx_unpickle_ElementTreeProducer__set_state(ElementTreeProducer __pyx_result, tuple __pyx_state):
8852  *     __pyx_result._attr_class = __pyx_state[0]; __pyx_result._content_handler = __pyx_state[1]; __pyx_result._element = __pyx_state[2]; __pyx_result._empty_attributes = __pyx_state[3]
8853  *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
8854  *         __pyx_result.__dict__.update(__pyx_state[4])
8855  */
8856   if (unlikely(__pyx_v___pyx_state == Py_None)) {
8857     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
8858     __PYX_ERR(1, 13, __pyx_L1_error)
8859   }
8860   __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
8861   __pyx_t_4 = ((__pyx_t_3 > 4) != 0);
8862   if (__pyx_t_4) {
8863   } else {
8864     __pyx_t_2 = __pyx_t_4;
8865     goto __pyx_L4_bool_binop_done;
8866   }
8867   __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
8868   __pyx_t_5 = (__pyx_t_4 != 0);
8869   __pyx_t_2 = __pyx_t_5;
8870   __pyx_L4_bool_binop_done:;
8871   if (__pyx_t_2) {
8872
8873     /* "(tree fragment)":14
8874  *     __pyx_result._attr_class = __pyx_state[0]; __pyx_result._content_handler = __pyx_state[1]; __pyx_result._element = __pyx_state[2]; __pyx_result._empty_attributes = __pyx_state[3]
8875  *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
8876  *         __pyx_result.__dict__.update(__pyx_state[4])             # <<<<<<<<<<<<<<
8877  */
8878     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
8879     __Pyx_GOTREF(__pyx_t_6);
8880     __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
8881     __Pyx_GOTREF(__pyx_t_7);
8882     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8883     if (unlikely(__pyx_v___pyx_state == Py_None)) {
8884       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8885       __PYX_ERR(1, 14, __pyx_L1_error)
8886     }
8887     __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
8888     __Pyx_GOTREF(__pyx_t_6);
8889     __pyx_t_8 = NULL;
8890     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
8891       __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
8892       if (likely(__pyx_t_8)) {
8893         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
8894         __Pyx_INCREF(__pyx_t_8);
8895         __Pyx_INCREF(function);
8896         __Pyx_DECREF_SET(__pyx_t_7, function);
8897       }
8898     }
8899     __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
8900     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
8901     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8902     if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
8903     __Pyx_GOTREF(__pyx_t_1);
8904     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8905     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8906
8907     /* "(tree fragment)":13
8908  * cdef __pyx_unpickle_ElementTreeProducer__set_state(ElementTreeProducer __pyx_result, tuple __pyx_state):
8909  *     __pyx_result._attr_class = __pyx_state[0]; __pyx_result._content_handler = __pyx_state[1]; __pyx_result._element = __pyx_state[2]; __pyx_result._empty_attributes = __pyx_state[3]
8910  *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
8911  *         __pyx_result.__dict__.update(__pyx_state[4])
8912  */
8913   }
8914
8915   /* "(tree fragment)":11
8916  *         __pyx_unpickle_ElementTreeProducer__set_state(<ElementTreeProducer> __pyx_result, __pyx_state)
8917  *     return __pyx_result
8918  * cdef __pyx_unpickle_ElementTreeProducer__set_state(ElementTreeProducer __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
8919  *     __pyx_result._attr_class = __pyx_state[0]; __pyx_result._content_handler = __pyx_state[1]; __pyx_result._element = __pyx_state[2]; __pyx_result._empty_attributes = __pyx_state[3]
8920  *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
8921  */
8922
8923   /* function exit code */
8924   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8925   goto __pyx_L0;
8926   __pyx_L1_error:;
8927   __Pyx_XDECREF(__pyx_t_1);
8928   __Pyx_XDECREF(__pyx_t_6);
8929   __Pyx_XDECREF(__pyx_t_7);
8930   __Pyx_XDECREF(__pyx_t_8);
8931   __Pyx_AddTraceback("lxml.sax.__pyx_unpickle_ElementTreeProducer__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
8932   __pyx_r = 0;
8933   __pyx_L0:;
8934   __Pyx_XGIVEREF(__pyx_r);
8935   __Pyx_RefNannyFinishContext();
8936   return __pyx_r;
8937 }
8938 static struct __pyx_vtabstruct_4lxml_3sax_ElementTreeProducer __pyx_vtable_4lxml_3sax_ElementTreeProducer;
8939
8940 static PyObject *__pyx_tp_new_4lxml_3sax_ElementTreeProducer(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
8941   struct __pyx_obj_4lxml_3sax_ElementTreeProducer *p;
8942   PyObject *o;
8943   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
8944     o = (*t->tp_alloc)(t, 0);
8945   } else {
8946     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
8947   }
8948   if (unlikely(!o)) return 0;
8949   p = ((struct __pyx_obj_4lxml_3sax_ElementTreeProducer *)o);
8950   p->__pyx_vtab = __pyx_vtabptr_4lxml_3sax_ElementTreeProducer;
8951   p->_element = Py_None; Py_INCREF(Py_None);
8952   p->_content_handler = Py_None; Py_INCREF(Py_None);
8953   p->_attr_class = Py_None; Py_INCREF(Py_None);
8954   p->_empty_attributes = Py_None; Py_INCREF(Py_None);
8955   return o;
8956 }
8957
8958 static void __pyx_tp_dealloc_4lxml_3sax_ElementTreeProducer(PyObject *o) {
8959   struct __pyx_obj_4lxml_3sax_ElementTreeProducer *p = (struct __pyx_obj_4lxml_3sax_ElementTreeProducer *)o;
8960   #if CYTHON_USE_TP_FINALIZE
8961   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
8962     if (PyObject_CallFinalizerFromDealloc(o)) return;
8963   }
8964   #endif
8965   PyObject_GC_UnTrack(o);
8966   Py_CLEAR(p->_element);
8967   Py_CLEAR(p->_content_handler);
8968   Py_CLEAR(p->_attr_class);
8969   Py_CLEAR(p->_empty_attributes);
8970   (*Py_TYPE(o)->tp_free)(o);
8971 }
8972
8973 static int __pyx_tp_traverse_4lxml_3sax_ElementTreeProducer(PyObject *o, visitproc v, void *a) {
8974   int e;
8975   struct __pyx_obj_4lxml_3sax_ElementTreeProducer *p = (struct __pyx_obj_4lxml_3sax_ElementTreeProducer *)o;
8976   if (p->_element) {
8977     e = (*v)(p->_element, a); if (e) return e;
8978   }
8979   if (p->_content_handler) {
8980     e = (*v)(p->_content_handler, a); if (e) return e;
8981   }
8982   if (p->_attr_class) {
8983     e = (*v)(p->_attr_class, a); if (e) return e;
8984   }
8985   if (p->_empty_attributes) {
8986     e = (*v)(p->_empty_attributes, a); if (e) return e;
8987   }
8988   return 0;
8989 }
8990
8991 static int __pyx_tp_clear_4lxml_3sax_ElementTreeProducer(PyObject *o) {
8992   struct __pyx_obj_4lxml_3sax_ElementTreeProducer *p = (struct __pyx_obj_4lxml_3sax_ElementTreeProducer *)o;
8993   Py_CLEAR(p->_element);
8994   Py_CLEAR(p->_content_handler);
8995   Py_CLEAR(p->_attr_class);
8996   Py_CLEAR(p->_empty_attributes);
8997   return 0;
8998 }
8999
9000 static PyMethodDef __pyx_methods_4lxml_3sax_ElementTreeProducer[] = {
9001   {"saxify", (PyCFunction)__pyx_pw_4lxml_3sax_19ElementTreeProducer_3saxify, METH_NOARGS, 0},
9002   {"__reduce_cython__", (PyCFunction)__pyx_pw_4lxml_3sax_19ElementTreeProducer_5__reduce_cython__, METH_NOARGS, 0},
9003   {"__setstate_cython__", (PyCFunction)__pyx_pw_4lxml_3sax_19ElementTreeProducer_7__setstate_cython__, METH_O, 0},
9004   {0, 0, 0, 0}
9005 };
9006
9007 static PyTypeObject __pyx_type_4lxml_3sax_ElementTreeProducer = {
9008   PyVarObject_HEAD_INIT(0, 0)
9009   "lxml.sax.ElementTreeProducer", /*tp_name*/
9010   sizeof(struct __pyx_obj_4lxml_3sax_ElementTreeProducer), /*tp_basicsize*/
9011   0, /*tp_itemsize*/
9012   __pyx_tp_dealloc_4lxml_3sax_ElementTreeProducer, /*tp_dealloc*/
9013   #if PY_VERSION_HEX < 0x030800b4
9014   0, /*tp_print*/
9015   #endif
9016   #if PY_VERSION_HEX >= 0x030800b4
9017   0, /*tp_vectorcall_offset*/
9018   #endif
9019   0, /*tp_getattr*/
9020   0, /*tp_setattr*/
9021   #if PY_MAJOR_VERSION < 3
9022   0, /*tp_compare*/
9023   #endif
9024   #if PY_MAJOR_VERSION >= 3
9025   0, /*tp_as_async*/
9026   #endif
9027   0, /*tp_repr*/
9028   0, /*tp_as_number*/
9029   0, /*tp_as_sequence*/
9030   0, /*tp_as_mapping*/
9031   0, /*tp_hash*/
9032   0, /*tp_call*/
9033   0, /*tp_str*/
9034   0, /*tp_getattro*/
9035   0, /*tp_setattro*/
9036   0, /*tp_as_buffer*/
9037   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
9038   "Produces SAX events for an element and children.\n    ", /*tp_doc*/
9039   __pyx_tp_traverse_4lxml_3sax_ElementTreeProducer, /*tp_traverse*/
9040   __pyx_tp_clear_4lxml_3sax_ElementTreeProducer, /*tp_clear*/
9041   0, /*tp_richcompare*/
9042   0, /*tp_weaklistoffset*/
9043   0, /*tp_iter*/
9044   0, /*tp_iternext*/
9045   __pyx_methods_4lxml_3sax_ElementTreeProducer, /*tp_methods*/
9046   0, /*tp_members*/
9047   0, /*tp_getset*/
9048   0, /*tp_base*/
9049   0, /*tp_dict*/
9050   0, /*tp_descr_get*/
9051   0, /*tp_descr_set*/
9052   0, /*tp_dictoffset*/
9053   __pyx_pw_4lxml_3sax_19ElementTreeProducer_1__init__, /*tp_init*/
9054   0, /*tp_alloc*/
9055   __pyx_tp_new_4lxml_3sax_ElementTreeProducer, /*tp_new*/
9056   0, /*tp_free*/
9057   0, /*tp_is_gc*/
9058   0, /*tp_bases*/
9059   0, /*tp_mro*/
9060   0, /*tp_cache*/
9061   0, /*tp_subclasses*/
9062   0, /*tp_weaklist*/
9063   0, /*tp_del*/
9064   0, /*tp_version_tag*/
9065   #if PY_VERSION_HEX >= 0x030400a1
9066   0, /*tp_finalize*/
9067   #endif
9068   #if PY_VERSION_HEX >= 0x030800b1
9069   0, /*tp_vectorcall*/
9070   #endif
9071   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
9072   0, /*tp_print*/
9073   #endif
9074 };
9075
9076 static PyMethodDef __pyx_methods[] = {
9077   {0, 0, 0, 0}
9078 };
9079
9080 #if PY_MAJOR_VERSION >= 3
9081 #if CYTHON_PEP489_MULTI_PHASE_INIT
9082 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
9083 static int __pyx_pymod_exec_sax(PyObject* module); /*proto*/
9084 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
9085   {Py_mod_create, (void*)__pyx_pymod_create},
9086   {Py_mod_exec, (void*)__pyx_pymod_exec_sax},
9087   {0, NULL}
9088 };
9089 #endif
9090
9091 static struct PyModuleDef __pyx_moduledef = {
9092     PyModuleDef_HEAD_INIT,
9093     "sax",
9094     __pyx_k_SAX_based_adapter_to_copy_trees, /* m_doc */
9095   #if CYTHON_PEP489_MULTI_PHASE_INIT
9096     0, /* m_size */
9097   #else
9098     -1, /* m_size */
9099   #endif
9100     __pyx_methods /* m_methods */,
9101   #if CYTHON_PEP489_MULTI_PHASE_INIT
9102     __pyx_moduledef_slots, /* m_slots */
9103   #else
9104     NULL, /* m_reload */
9105   #endif
9106     NULL, /* m_traverse */
9107     NULL, /* m_clear */
9108     (freefunc)__pyx_module_cleanup /* m_free */
9109 };
9110 #endif
9111 #ifndef CYTHON_SMALL_CODE
9112 #if defined(__clang__)
9113     #define CYTHON_SMALL_CODE
9114 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
9115     #define CYTHON_SMALL_CODE __attribute__((cold))
9116 #else
9117     #define CYTHON_SMALL_CODE
9118 #endif
9119 #endif
9120
9121 static __Pyx_StringTabEntry __pyx_string_tab[] = {
9122   {&__pyx_kp_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0},
9123   {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
9124   {&__pyx_n_s_AttributesNSImpl, __pyx_k_AttributesNSImpl, sizeof(__pyx_k_AttributesNSImpl), 0, 0, 1, 1},
9125   {&__pyx_kp_s_Build_an_lxml_ElementTree_from_S, __pyx_k_Build_an_lxml_ElementTree_from_S, sizeof(__pyx_k_Build_an_lxml_ElementTree_from_S), 0, 0, 1, 0},
9126   {&__pyx_n_s_Comment, __pyx_k_Comment, sizeof(__pyx_k_Comment), 0, 0, 1, 1},
9127   {&__pyx_n_s_ContentHandler, __pyx_k_ContentHandler, sizeof(__pyx_k_ContentHandler), 0, 0, 1, 1},
9128   {&__pyx_n_s_Element, __pyx_k_Element, sizeof(__pyx_k_Element), 0, 0, 1, 1},
9129   {&__pyx_n_s_ElementTree, __pyx_k_ElementTree, sizeof(__pyx_k_ElementTree), 0, 0, 1, 1},
9130   {&__pyx_n_s_ElementTreeContentHandler, __pyx_k_ElementTreeContentHandler, sizeof(__pyx_k_ElementTreeContentHandler), 0, 0, 1, 1},
9131   {&__pyx_n_s_ElementTreeContentHandler___init, __pyx_k_ElementTreeContentHandler___init, sizeof(__pyx_k_ElementTreeContentHandler___init), 0, 0, 1, 1},
9132   {&__pyx_n_s_ElementTreeContentHandler__build, __pyx_k_ElementTreeContentHandler__build, sizeof(__pyx_k_ElementTreeContentHandler__build), 0, 0, 1, 1},
9133   {&__pyx_n_s_ElementTreeContentHandler__get_e, __pyx_k_ElementTreeContentHandler__get_e, sizeof(__pyx_k_ElementTreeContentHandler__get_e), 0, 0, 1, 1},
9134   {&__pyx_n_s_ElementTreeContentHandler_charac, __pyx_k_ElementTreeContentHandler_charac, sizeof(__pyx_k_ElementTreeContentHandler_charac), 0, 0, 1, 1},
9135   {&__pyx_n_s_ElementTreeContentHandler_endDoc, __pyx_k_ElementTreeContentHandler_endDoc, sizeof(__pyx_k_ElementTreeContentHandler_endDoc), 0, 0, 1, 1},
9136   {&__pyx_n_s_ElementTreeContentHandler_endEle, __pyx_k_ElementTreeContentHandler_endEle, sizeof(__pyx_k_ElementTreeContentHandler_endEle), 0, 0, 1, 1},
9137   {&__pyx_n_s_ElementTreeContentHandler_endEle_2, __pyx_k_ElementTreeContentHandler_endEle_2, sizeof(__pyx_k_ElementTreeContentHandler_endEle_2), 0, 0, 1, 1},
9138   {&__pyx_n_s_ElementTreeContentHandler_endPre, __pyx_k_ElementTreeContentHandler_endPre, sizeof(__pyx_k_ElementTreeContentHandler_endPre), 0, 0, 1, 1},
9139   {&__pyx_n_s_ElementTreeContentHandler_proces, __pyx_k_ElementTreeContentHandler_proces, sizeof(__pyx_k_ElementTreeContentHandler_proces), 0, 0, 1, 1},
9140   {&__pyx_n_s_ElementTreeContentHandler_setDoc, __pyx_k_ElementTreeContentHandler_setDoc, sizeof(__pyx_k_ElementTreeContentHandler_setDoc), 0, 0, 1, 1},
9141   {&__pyx_n_s_ElementTreeContentHandler_startD, __pyx_k_ElementTreeContentHandler_startD, sizeof(__pyx_k_ElementTreeContentHandler_startD), 0, 0, 1, 1},
9142   {&__pyx_n_s_ElementTreeContentHandler_startE, __pyx_k_ElementTreeContentHandler_startE, sizeof(__pyx_k_ElementTreeContentHandler_startE), 0, 0, 1, 1},
9143   {&__pyx_n_s_ElementTreeContentHandler_startE_2, __pyx_k_ElementTreeContentHandler_startE_2, sizeof(__pyx_k_ElementTreeContentHandler_startE_2), 0, 0, 1, 1},
9144   {&__pyx_n_s_ElementTreeContentHandler_startP, __pyx_k_ElementTreeContentHandler_startP, sizeof(__pyx_k_ElementTreeContentHandler_startP), 0, 0, 1, 1},
9145   {&__pyx_n_s_ElementTreeProducer, __pyx_k_ElementTreeProducer, sizeof(__pyx_k_ElementTreeProducer), 0, 0, 1, 1},
9146   {&__pyx_n_s_ElementTreeProducer___reduce_cyt, __pyx_k_ElementTreeProducer___reduce_cyt, sizeof(__pyx_k_ElementTreeProducer___reduce_cyt), 0, 0, 1, 1},
9147   {&__pyx_n_s_ElementTreeProducer___setstate_c, __pyx_k_ElementTreeProducer___setstate_c, sizeof(__pyx_k_ElementTreeProducer___setstate_c), 0, 0, 1, 1},
9148   {&__pyx_n_s_ElementTreeProducer_saxify, __pyx_k_ElementTreeProducer_saxify, sizeof(__pyx_k_ElementTreeProducer_saxify), 0, 0, 1, 1},
9149   {&__pyx_kp_s_General_SAX_error, __pyx_k_General_SAX_error, sizeof(__pyx_k_General_SAX_error), 0, 0, 1, 0},
9150   {&__pyx_kp_s_Incompatible_checksums_s_vs_0x1d, __pyx_k_Incompatible_checksums_s_vs_0x1d, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x1d), 0, 0, 1, 0},
9151   {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
9152   {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1},
9153   {&__pyx_n_s_LxmlError, __pyx_k_LxmlError, sizeof(__pyx_k_LxmlError), 0, 0, 1, 1},
9154   {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
9155   {&__pyx_n_s_ProcessingInstruction, __pyx_k_ProcessingInstruction, sizeof(__pyx_k_ProcessingInstruction), 0, 0, 1, 1},
9156   {&__pyx_n_s_SaxError, __pyx_k_SaxError, sizeof(__pyx_k_SaxError), 0, 0, 1, 1},
9157   {&__pyx_n_s_SubElement, __pyx_k_SubElement, sizeof(__pyx_k_SubElement), 0, 0, 1, 1},
9158   {&__pyx_kp_s_Unexpected_element_closed, __pyx_k_Unexpected_element_closed, sizeof(__pyx_k_Unexpected_element_closed), 0, 0, 1, 0},
9159   {&__pyx_kp_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 0},
9160   {&__pyx_kp_s__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 0, 1, 0},
9161   {&__pyx_kp_s__8, __pyx_k__8, sizeof(__pyx_k__8), 0, 0, 1, 0},
9162   {&__pyx_n_s_addprevious, __pyx_k_addprevious, sizeof(__pyx_k_addprevious), 0, 0, 1, 1},
9163   {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
9164   {&__pyx_n_s_attr_name, __pyx_k_attr_name, sizeof(__pyx_k_attr_name), 0, 0, 1, 1},
9165   {&__pyx_n_s_attributes, __pyx_k_attributes, sizeof(__pyx_k_attributes), 0, 0, 1, 1},
9166   {&__pyx_n_s_attrs, __pyx_k_attrs, sizeof(__pyx_k_attrs), 0, 0, 1, 1},
9167   {&__pyx_n_s_buildTag, __pyx_k_buildTag, sizeof(__pyx_k_buildTag), 0, 0, 1, 1},
9168   {&__pyx_n_s_characters, __pyx_k_characters, sizeof(__pyx_k_characters), 0, 0, 1, 1},
9169   {&__pyx_n_s_clear, __pyx_k_clear, sizeof(__pyx_k_clear), 0, 0, 1, 1},
9170   {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
9171   {&__pyx_n_s_content_handler, __pyx_k_content_handler, sizeof(__pyx_k_content_handler), 0, 0, 1, 1},
9172   {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
9173   {&__pyx_n_s_default_ns, __pyx_k_default_ns, sizeof(__pyx_k_default_ns), 0, 0, 1, 1},
9174   {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
9175   {&__pyx_n_s_dict_2, __pyx_k_dict_2, sizeof(__pyx_k_dict_2), 0, 0, 1, 1},
9176   {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
9177   {&__pyx_n_s_doc_2, __pyx_k_doc_2, sizeof(__pyx_k_doc_2), 0, 0, 1, 1},
9178   {&__pyx_n_s_el_name, __pyx_k_el_name, sizeof(__pyx_k_el_name), 0, 0, 1, 1},
9179   {&__pyx_n_s_el_tag, __pyx_k_el_tag, sizeof(__pyx_k_el_tag), 0, 0, 1, 1},
9180   {&__pyx_n_s_element, __pyx_k_element, sizeof(__pyx_k_element), 0, 0, 1, 1},
9181   {&__pyx_n_s_element_or_tree, __pyx_k_element_or_tree, sizeof(__pyx_k_element_or_tree), 0, 0, 1, 1},
9182   {&__pyx_n_s_element_stack, __pyx_k_element_stack, sizeof(__pyx_k_element_stack), 0, 0, 1, 1},
9183   {&__pyx_n_s_element_stack_2, __pyx_k_element_stack_2, sizeof(__pyx_k_element_stack_2), 0, 0, 1, 1},
9184   {&__pyx_n_s_endDocument, __pyx_k_endDocument, sizeof(__pyx_k_endDocument), 0, 0, 1, 1},
9185   {&__pyx_n_s_endElement, __pyx_k_endElement, sizeof(__pyx_k_endElement), 0, 0, 1, 1},
9186   {&__pyx_n_s_endElementNS, __pyx_k_endElementNS, sizeof(__pyx_k_endElementNS), 0, 0, 1, 1},
9187   {&__pyx_n_s_endPrefixMapping, __pyx_k_endPrefixMapping, sizeof(__pyx_k_endPrefixMapping), 0, 0, 1, 1},
9188   {&__pyx_n_s_etree, __pyx_k_etree, sizeof(__pyx_k_etree), 0, 0, 1, 1},
9189   {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
9190   {&__pyx_n_s_get_etree, __pyx_k_get_etree, sizeof(__pyx_k_get_etree), 0, 0, 1, 1},
9191   {&__pyx_n_s_getnext, __pyx_k_getnext, sizeof(__pyx_k_getnext), 0, 0, 1, 1},
9192   {&__pyx_n_s_getprevious, __pyx_k_getprevious, sizeof(__pyx_k_getprevious), 0, 0, 1, 1},
9193   {&__pyx_n_s_getroot, __pyx_k_getroot, sizeof(__pyx_k_getroot), 0, 0, 1, 1},
9194   {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
9195   {&__pyx_n_s_ignorableWhitespace, __pyx_k_ignorableWhitespace, sizeof(__pyx_k_ignorableWhitespace), 0, 0, 1, 1},
9196   {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
9197   {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
9198   {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
9199   {&__pyx_n_s_iter_attributes, __pyx_k_iter_attributes, sizeof(__pyx_k_iter_attributes), 0, 0, 1, 1},
9200   {&__pyx_n_s_iteritems, __pyx_k_iteritems, sizeof(__pyx_k_iteritems), 0, 0, 1, 1},
9201   {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
9202   {&__pyx_n_s_last_element, __pyx_k_last_element, sizeof(__pyx_k_last_element), 0, 0, 1, 1},
9203   {&__pyx_n_s_local_name, __pyx_k_local_name, sizeof(__pyx_k_local_name), 0, 0, 1, 1},
9204   {&__pyx_n_s_locator, __pyx_k_locator, sizeof(__pyx_k_locator), 0, 0, 1, 1},
9205   {&__pyx_n_s_lxml, __pyx_k_lxml, sizeof(__pyx_k_lxml), 0, 0, 1, 1},
9206   {&__pyx_n_s_lxml_etree, __pyx_k_lxml_etree, sizeof(__pyx_k_lxml_etree), 0, 0, 1, 1},
9207   {&__pyx_n_s_lxml_sax, __pyx_k_lxml_sax, sizeof(__pyx_k_lxml_sax), 0, 0, 1, 1},
9208   {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
9209   {&__pyx_n_s_makeelement, __pyx_k_makeelement, sizeof(__pyx_k_makeelement), 0, 0, 1, 1},
9210   {&__pyx_n_s_makeelement_2, __pyx_k_makeelement_2, sizeof(__pyx_k_makeelement_2), 0, 0, 1, 1},
9211   {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
9212   {&__pyx_n_s_min, __pyx_k_min, sizeof(__pyx_k_min), 0, 0, 1, 1},
9213   {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
9214   {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
9215   {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
9216   {&__pyx_n_s_name_tuple, __pyx_k_name_tuple, sizeof(__pyx_k_name_tuple), 0, 0, 1, 1},
9217   {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
9218   {&__pyx_n_s_new_mappings, __pyx_k_new_mappings, sizeof(__pyx_k_new_mappings), 0, 0, 1, 1},
9219   {&__pyx_n_s_ns_mapping, __pyx_k_ns_mapping, sizeof(__pyx_k_ns_mapping), 0, 0, 1, 1},
9220   {&__pyx_n_s_ns_name, __pyx_k_ns_name, sizeof(__pyx_k_ns_name), 0, 0, 1, 1},
9221   {&__pyx_n_s_ns_name_tuple, __pyx_k_ns_name_tuple, sizeof(__pyx_k_ns_name_tuple), 0, 0, 1, 1},
9222   {&__pyx_n_s_ns_uri, __pyx_k_ns_uri, sizeof(__pyx_k_ns_uri), 0, 0, 1, 1},
9223   {&__pyx_n_s_ns_uri_list, __pyx_k_ns_uri_list, sizeof(__pyx_k_ns_uri_list), 0, 0, 1, 1},
9224   {&__pyx_n_s_nsmap, __pyx_k_nsmap, sizeof(__pyx_k_nsmap), 0, 0, 1, 1},
9225   {&__pyx_n_s_pi, __pyx_k_pi, sizeof(__pyx_k_pi), 0, 0, 1, 1},
9226   {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
9227   {&__pyx_n_s_pop, __pyx_k_pop, sizeof(__pyx_k_pop), 0, 0, 1, 1},
9228   {&__pyx_n_s_prefix, __pyx_k_prefix, sizeof(__pyx_k_prefix), 0, 0, 1, 1},
9229   {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
9230   {&__pyx_n_s_processingInstruction, __pyx_k_processingInstruction, sizeof(__pyx_k_processingInstruction), 0, 0, 1, 1},
9231   {&__pyx_n_s_property, __pyx_k_property, sizeof(__pyx_k_property), 0, 0, 1, 1},
9232   {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
9233   {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
9234   {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
9235   {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
9236   {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
9237   {&__pyx_n_s_pyx_unpickle_ElementTreeProduc, __pyx_k_pyx_unpickle_ElementTreeProduc, sizeof(__pyx_k_pyx_unpickle_ElementTreeProduc), 0, 0, 1, 1},
9238   {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
9239   {&__pyx_n_s_qname, __pyx_k_qname, sizeof(__pyx_k_qname), 0, 0, 1, 1},
9240   {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
9241   {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
9242   {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
9243   {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
9244   {&__pyx_n_s_root, __pyx_k_root, sizeof(__pyx_k_root), 0, 0, 1, 1},
9245   {&__pyx_n_s_root_siblings, __pyx_k_root_siblings, sizeof(__pyx_k_root_siblings), 0, 0, 1, 1},
9246   {&__pyx_kp_s_s_s, __pyx_k_s_s, sizeof(__pyx_k_s_s), 0, 0, 1, 0},
9247   {&__pyx_n_s_saxify, __pyx_k_saxify, sizeof(__pyx_k_saxify), 0, 0, 1, 1},
9248   {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
9249   {&__pyx_n_s_setDocumentLocator, __pyx_k_setDocumentLocator, sizeof(__pyx_k_setDocumentLocator), 0, 0, 1, 1},
9250   {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
9251   {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
9252   {&__pyx_n_s_sibling, __pyx_k_sibling, sizeof(__pyx_k_sibling), 0, 0, 1, 1},
9253   {&__pyx_n_s_siblings, __pyx_k_siblings, sizeof(__pyx_k_siblings), 0, 0, 1, 1},
9254   {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
9255   {&__pyx_kp_s_src_lxml_sax_py, __pyx_k_src_lxml_sax_py, sizeof(__pyx_k_src_lxml_sax_py), 0, 0, 1, 0},
9256   {&__pyx_n_s_startDocument, __pyx_k_startDocument, sizeof(__pyx_k_startDocument), 0, 0, 1, 1},
9257   {&__pyx_n_s_startElement, __pyx_k_startElement, sizeof(__pyx_k_startElement), 0, 0, 1, 1},
9258   {&__pyx_n_s_startElementNS, __pyx_k_startElementNS, sizeof(__pyx_k_startElementNS), 0, 0, 1, 1},
9259   {&__pyx_n_s_startPrefixMapping, __pyx_k_startPrefixMapping, sizeof(__pyx_k_startPrefixMapping), 0, 0, 1, 1},
9260   {&__pyx_n_s_state, __pyx_k_state, sizeof(__pyx_k_state), 0, 0, 1, 1},
9261   {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
9262   {&__pyx_n_s_tag, __pyx_k_tag, sizeof(__pyx_k_tag), 0, 0, 1, 1},
9263   {&__pyx_n_s_tail, __pyx_k_tail, sizeof(__pyx_k_tail), 0, 0, 1, 1},
9264   {&__pyx_n_s_target, __pyx_k_target, sizeof(__pyx_k_target), 0, 0, 1, 1},
9265   {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
9266   {&__pyx_n_s_text, __pyx_k_text, sizeof(__pyx_k_text), 0, 0, 1, 1},
9267   {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
9268   {&__pyx_n_s_uri, __pyx_k_uri, sizeof(__pyx_k_uri), 0, 0, 1, 1},
9269   {&__pyx_n_s_use_setstate, __pyx_k_use_setstate, sizeof(__pyx_k_use_setstate), 0, 0, 1, 1},
9270   {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
9271   {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
9272   {&__pyx_n_s_xml_sax_handler, __pyx_k_xml_sax_handler, sizeof(__pyx_k_xml_sax_handler), 0, 0, 1, 1},
9273   {&__pyx_n_s_xml_sax_xmlreader, __pyx_k_xml_sax_xmlreader, sizeof(__pyx_k_xml_sax_xmlreader), 0, 0, 1, 1},
9274   {0, 0, 0, 0, 0, 0, 0}
9275 };
9276 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
9277   __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_n_s_property); if (!__pyx_builtin_property) __PYX_ERR(0, 54, __pyx_L1_error)
9278   __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(0, 69, __pyx_L1_error)
9279   __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) __PYX_ERR(0, 96, __pyx_L1_error)
9280   __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(0, 152, __pyx_L1_error)
9281   __pyx_builtin_min = __Pyx_GetBuiltinName(__pyx_n_s_min); if (!__pyx_builtin_min) __PYX_ERR(0, 264, __pyx_L1_error)
9282   return 0;
9283   __pyx_L1_error:;
9284   return -1;
9285 }
9286
9287 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
9288   __Pyx_RefNannyDeclarations
9289   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
9290
9291   /* "lxml/sax.py":30
9292  * def _getNsTag(tag):
9293  *     if tag[0] == '{':
9294  *         return tuple(tag[1:].split('}', 1))             # <<<<<<<<<<<<<<
9295  *     else:
9296  *         return None, tag
9297  */
9298   __pyx_slice__2 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__2)) __PYX_ERR(0, 30, __pyx_L1_error)
9299   __Pyx_GOTREF(__pyx_slice__2);
9300   __Pyx_GIVEREF(__pyx_slice__2);
9301   __pyx_tuple__4 = PyTuple_Pack(2, __pyx_kp_s__3, __pyx_int_1); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 30, __pyx_L1_error)
9302   __Pyx_GOTREF(__pyx_tuple__4);
9303   __Pyx_GIVEREF(__pyx_tuple__4);
9304
9305   /* "lxml/sax.py":115
9306  *                 for sibling in self._root_siblings:
9307  *                     element.addprevious(sibling)
9308  *             del self._root_siblings[:]             # <<<<<<<<<<<<<<
9309  *         else:
9310  *             element = SubElement(element_stack[-1], el_name,
9311  */
9312   __pyx_slice__5 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__5)) __PYX_ERR(0, 115, __pyx_L1_error)
9313   __Pyx_GOTREF(__pyx_slice__5);
9314   __Pyx_GIVEREF(__pyx_slice__5);
9315
9316   /* "lxml/sax.py":183
9317  *                 siblings.append(sibling)
9318  *                 sibling = sibling.getprevious()
9319  *             for sibling in siblings[::-1]:             # <<<<<<<<<<<<<<
9320  *                 self._recursive_saxify(sibling, {})
9321  * 
9322  */
9323   __pyx_slice__7 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__7)) __PYX_ERR(0, 183, __pyx_L1_error)
9324   __Pyx_GOTREF(__pyx_slice__7);
9325   __Pyx_GIVEREF(__pyx_slice__7);
9326
9327   /* "lxml/sax.py":38
9328  *     """Build an lxml ElementTree from SAX events.
9329  *     """
9330  *     def __init__(self, makeelement=None):             # <<<<<<<<<<<<<<
9331  *         ContentHandler.__init__(self)
9332  *         self._root = None
9333  */
9334   __pyx_tuple__9 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_makeelement); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 38, __pyx_L1_error)
9335   __Pyx_GOTREF(__pyx_tuple__9);
9336   __Pyx_GIVEREF(__pyx_tuple__9);
9337   __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_sax_py, __pyx_n_s_init, 38, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 38, __pyx_L1_error)
9338   __pyx_tuple__11 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 38, __pyx_L1_error)
9339   __Pyx_GOTREF(__pyx_tuple__11);
9340   __Pyx_GIVEREF(__pyx_tuple__11);
9341
9342   /* "lxml/sax.py":50
9343  *         self._makeelement = makeelement
9344  * 
9345  *     def _get_etree(self):             # <<<<<<<<<<<<<<
9346  *         "Contains the generated ElementTree after parsing is finished."
9347  *         return ElementTree(self._root)
9348  */
9349   __pyx_tuple__12 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 50, __pyx_L1_error)
9350   __Pyx_GOTREF(__pyx_tuple__12);
9351   __Pyx_GIVEREF(__pyx_tuple__12);
9352   __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_sax_py, __pyx_n_s_get_etree, 50, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 50, __pyx_L1_error)
9353
9354   /* "lxml/sax.py":56
9355  *     etree = property(_get_etree, doc=_get_etree.__doc__)
9356  * 
9357  *     def setDocumentLocator(self, locator):             # <<<<<<<<<<<<<<
9358  *         pass
9359  * 
9360  */
9361   __pyx_tuple__14 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_locator); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 56, __pyx_L1_error)
9362   __Pyx_GOTREF(__pyx_tuple__14);
9363   __Pyx_GIVEREF(__pyx_tuple__14);
9364   __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_sax_py, __pyx_n_s_setDocumentLocator, 56, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 56, __pyx_L1_error)
9365
9366   /* "lxml/sax.py":59
9367  *         pass
9368  * 
9369  *     def startDocument(self):             # <<<<<<<<<<<<<<
9370  *         pass
9371  * 
9372  */
9373   __pyx_tuple__16 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 59, __pyx_L1_error)
9374   __Pyx_GOTREF(__pyx_tuple__16);
9375   __Pyx_GIVEREF(__pyx_tuple__16);
9376   __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_sax_py, __pyx_n_s_startDocument, 59, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 59, __pyx_L1_error)
9377
9378   /* "lxml/sax.py":62
9379  *         pass
9380  * 
9381  *     def endDocument(self):             # <<<<<<<<<<<<<<
9382  *         pass
9383  * 
9384  */
9385   __pyx_tuple__18 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 62, __pyx_L1_error)
9386   __Pyx_GOTREF(__pyx_tuple__18);
9387   __Pyx_GIVEREF(__pyx_tuple__18);
9388   __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_sax_py, __pyx_n_s_endDocument, 62, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 62, __pyx_L1_error)
9389
9390   /* "lxml/sax.py":65
9391  *         pass
9392  * 
9393  *     def startPrefixMapping(self, prefix, uri):             # <<<<<<<<<<<<<<
9394  *         self._new_mappings[prefix] = uri
9395  *         try:
9396  */
9397   __pyx_tuple__20 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_prefix, __pyx_n_s_uri); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 65, __pyx_L1_error)
9398   __Pyx_GOTREF(__pyx_tuple__20);
9399   __Pyx_GIVEREF(__pyx_tuple__20);
9400   __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_sax_py, __pyx_n_s_startPrefixMapping, 65, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 65, __pyx_L1_error)
9401
9402   /* "lxml/sax.py":74
9403  *             self._default_ns = uri
9404  * 
9405  *     def endPrefixMapping(self, prefix):             # <<<<<<<<<<<<<<
9406  *         ns_uri_list = self._ns_mapping[prefix]
9407  *         ns_uri_list.pop()
9408  */
9409   __pyx_tuple__22 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_prefix, __pyx_n_s_ns_uri_list); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 74, __pyx_L1_error)
9410   __Pyx_GOTREF(__pyx_tuple__22);
9411   __Pyx_GIVEREF(__pyx_tuple__22);
9412   __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_sax_py, __pyx_n_s_endPrefixMapping, 74, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 74, __pyx_L1_error)
9413
9414   /* "lxml/sax.py":80
9415  *             self._default_ns = ns_uri_list[-1]
9416  * 
9417  *     def _buildTag(self, ns_name_tuple):             # <<<<<<<<<<<<<<
9418  *         ns_uri, local_name = ns_name_tuple
9419  *         if ns_uri:
9420  */
9421   __pyx_tuple__24 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_ns_name_tuple, __pyx_n_s_ns_uri, __pyx_n_s_local_name, __pyx_n_s_el_tag); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 80, __pyx_L1_error)
9422   __Pyx_GOTREF(__pyx_tuple__24);
9423   __Pyx_GIVEREF(__pyx_tuple__24);
9424   __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_sax_py, __pyx_n_s_buildTag, 80, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 80, __pyx_L1_error)
9425
9426   /* "lxml/sax.py":90
9427  *         return el_tag
9428  * 
9429  *     def startElementNS(self, ns_name, qname, attributes=None):             # <<<<<<<<<<<<<<
9430  *         el_name = self._buildTag(ns_name)
9431  *         if attributes:
9432  */
9433   __pyx_tuple__26 = PyTuple_Pack(13, __pyx_n_s_self, __pyx_n_s_ns_name, __pyx_n_s_qname, __pyx_n_s_attributes, __pyx_n_s_el_name, __pyx_n_s_attrs, __pyx_n_s_iter_attributes, __pyx_n_s_name_tuple, __pyx_n_s_value, __pyx_n_s_attr_name, __pyx_n_s_element_stack_2, __pyx_n_s_element, __pyx_n_s_sibling); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 90, __pyx_L1_error)
9434   __Pyx_GOTREF(__pyx_tuple__26);
9435   __Pyx_GIVEREF(__pyx_tuple__26);
9436   __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(4, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_sax_py, __pyx_n_s_startElementNS, 90, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 90, __pyx_L1_error)
9437   __pyx_tuple__28 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 90, __pyx_L1_error)
9438   __Pyx_GOTREF(__pyx_tuple__28);
9439   __Pyx_GIVEREF(__pyx_tuple__28);
9440
9441   /* "lxml/sax.py":123
9442  *         self._new_mappings.clear()
9443  * 
9444  *     def processingInstruction(self, target, data):             # <<<<<<<<<<<<<<
9445  *         pi = ProcessingInstruction(target, data)
9446  *         if self._root is None:
9447  */
9448   __pyx_tuple__29 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_target, __pyx_n_s_data, __pyx_n_s_pi); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 123, __pyx_L1_error)
9449   __Pyx_GOTREF(__pyx_tuple__29);
9450   __Pyx_GIVEREF(__pyx_tuple__29);
9451   __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_sax_py, __pyx_n_s_processingInstruction, 123, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 123, __pyx_L1_error)
9452
9453   /* "lxml/sax.py":130
9454  *             self._element_stack[-1].append(pi)
9455  * 
9456  *     def endElementNS(self, ns_name, qname):             # <<<<<<<<<<<<<<
9457  *         element = self._element_stack.pop()
9458  *         el_tag = self._buildTag(ns_name)
9459  */
9460   __pyx_tuple__31 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_ns_name, __pyx_n_s_qname, __pyx_n_s_element, __pyx_n_s_el_tag); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 130, __pyx_L1_error)
9461   __Pyx_GOTREF(__pyx_tuple__31);
9462   __Pyx_GIVEREF(__pyx_tuple__31);
9463   __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_sax_py, __pyx_n_s_endElementNS, 130, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 130, __pyx_L1_error)
9464
9465   /* "lxml/sax.py":136
9466  *             raise SaxError("Unexpected element closed: " + el_tag)
9467  * 
9468  *     def startElement(self, name, attributes=None):             # <<<<<<<<<<<<<<
9469  *         if attributes:
9470  *             attributes = dict(
9471  */
9472   __pyx_tuple__33 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_name, __pyx_n_s_attributes, __pyx_n_s_k, __pyx_n_s_v); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 136, __pyx_L1_error)
9473   __Pyx_GOTREF(__pyx_tuple__33);
9474   __Pyx_GIVEREF(__pyx_tuple__33);
9475   __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_sax_py, __pyx_n_s_startElement, 136, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 136, __pyx_L1_error)
9476   __pyx_tuple__35 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 136, __pyx_L1_error)
9477   __Pyx_GOTREF(__pyx_tuple__35);
9478   __Pyx_GIVEREF(__pyx_tuple__35);
9479
9480   /* "lxml/sax.py":143
9481  *         self.startElementNS((None, name), name, attributes)
9482  * 
9483  *     def endElement(self, name):             # <<<<<<<<<<<<<<
9484  *         self.endElementNS((None, name), name)
9485  * 
9486  */
9487   __pyx_tuple__36 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_name); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 143, __pyx_L1_error)
9488   __Pyx_GOTREF(__pyx_tuple__36);
9489   __Pyx_GIVEREF(__pyx_tuple__36);
9490   __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_sax_py, __pyx_n_s_endElement, 143, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 143, __pyx_L1_error)
9491
9492   /* "lxml/sax.py":146
9493  *         self.endElementNS((None, name), name)
9494  * 
9495  *     def characters(self, data):             # <<<<<<<<<<<<<<
9496  *         last_element = self._element_stack[-1]
9497  *         try:
9498  */
9499   __pyx_tuple__38 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_data, __pyx_n_s_last_element); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 146, __pyx_L1_error)
9500   __Pyx_GOTREF(__pyx_tuple__38);
9501   __Pyx_GIVEREF(__pyx_tuple__38);
9502   __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_sax_py, __pyx_n_s_characters, 146, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 146, __pyx_L1_error)
9503
9504   /* "lxml/sax.py":173
9505  *         self._empty_attributes = attr_class({}, {})
9506  * 
9507  *     def saxify(self):             # <<<<<<<<<<<<<<
9508  *         self._content_handler.startDocument()
9509  * 
9510  */
9511   __pyx_tuple__40 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_element, __pyx_n_s_siblings, __pyx_n_s_sibling); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 173, __pyx_L1_error)
9512   __Pyx_GOTREF(__pyx_tuple__40);
9513   __Pyx_GIVEREF(__pyx_tuple__40);
9514   __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_sax_py, __pyx_n_s_saxify, 173, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 173, __pyx_L1_error)
9515
9516   /* "(tree fragment)":1
9517  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
9518  *     cdef tuple state
9519  *     cdef object _dict
9520  */
9521   __pyx_tuple__42 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_state, __pyx_n_s_dict_2, __pyx_n_s_use_setstate); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(1, 1, __pyx_L1_error)
9522   __Pyx_GOTREF(__pyx_tuple__42);
9523   __Pyx_GIVEREF(__pyx_tuple__42);
9524   __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(1, 1, __pyx_L1_error)
9525
9526   /* "(tree fragment)":16
9527  *     else:
9528  *         return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, state)
9529  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
9530  *     __pyx_unpickle_ElementTreeProducer__set_state(self, __pyx_state)
9531  */
9532   __pyx_tuple__44 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pyx_state); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(1, 16, __pyx_L1_error)
9533   __Pyx_GOTREF(__pyx_tuple__44);
9534   __Pyx_GIVEREF(__pyx_tuple__44);
9535   __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(1, 16, __pyx_L1_error)
9536
9537   /* "lxml/sax.py":274
9538  * 
9539  * 
9540  * def saxify(element_or_tree, content_handler):             # <<<<<<<<<<<<<<
9541  *     """One-shot helper to generate SAX events from an XML tree and fire
9542  *     them against a SAX ContentHandler.
9543  */
9544   __pyx_tuple__46 = PyTuple_Pack(2, __pyx_n_s_element_or_tree, __pyx_n_s_content_handler); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 274, __pyx_L1_error)
9545   __Pyx_GOTREF(__pyx_tuple__46);
9546   __Pyx_GIVEREF(__pyx_tuple__46);
9547   __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_sax_py, __pyx_n_s_saxify, 274, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 274, __pyx_L1_error)
9548
9549   /* "(tree fragment)":1
9550  * def __pyx_unpickle_ElementTreeProducer(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
9551  *     cdef object __pyx_PickleError
9552  *     cdef object __pyx_result
9553  */
9554   __pyx_tuple__48 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(1, 1, __pyx_L1_error)
9555   __Pyx_GOTREF(__pyx_tuple__48);
9556   __Pyx_GIVEREF(__pyx_tuple__48);
9557   __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_ElementTreeProduc, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(1, 1, __pyx_L1_error)
9558   __Pyx_RefNannyFinishContext();
9559   return 0;
9560   __pyx_L1_error:;
9561   __Pyx_RefNannyFinishContext();
9562   return -1;
9563 }
9564
9565 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
9566   __pyx_umethod_PyDict_Type_get.type = (PyObject*)&PyDict_Type;
9567   __pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type;
9568   __pyx_umethod_PyList_Type_pop.type = (PyObject*)&PyList_Type;
9569   if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9570   __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
9571   __pyx_int_30712058 = PyInt_FromLong(30712058L); if (unlikely(!__pyx_int_30712058)) __PYX_ERR(0, 1, __pyx_L1_error)
9572   __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
9573   return 0;
9574   __pyx_L1_error:;
9575   return -1;
9576 }
9577
9578 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
9579 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
9580 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
9581 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
9582 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
9583 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
9584 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
9585
9586 static int __Pyx_modinit_global_init_code(void) {
9587   __Pyx_RefNannyDeclarations
9588   __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
9589   /*--- Global init code ---*/
9590   __Pyx_RefNannyFinishContext();
9591   return 0;
9592 }
9593
9594 static int __Pyx_modinit_variable_export_code(void) {
9595   __Pyx_RefNannyDeclarations
9596   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
9597   /*--- Variable export code ---*/
9598   __Pyx_RefNannyFinishContext();
9599   return 0;
9600 }
9601
9602 static int __Pyx_modinit_function_export_code(void) {
9603   __Pyx_RefNannyDeclarations
9604   int __pyx_lineno = 0;
9605   const char *__pyx_filename = NULL;
9606   int __pyx_clineno = 0;
9607   __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
9608   /*--- Function export code ---*/
9609   if (__Pyx_ExportFunction("_getNsTag", (void (*)(void))__pyx_f_4lxml_3sax__getNsTag, "PyObject *(PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9610   __Pyx_RefNannyFinishContext();
9611   return 0;
9612   __pyx_L1_error:;
9613   __Pyx_RefNannyFinishContext();
9614   return -1;
9615 }
9616
9617 static int __Pyx_modinit_type_init_code(void) {
9618   __Pyx_RefNannyDeclarations
9619   int __pyx_lineno = 0;
9620   const char *__pyx_filename = NULL;
9621   int __pyx_clineno = 0;
9622   __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
9623   /*--- Type init code ---*/
9624   __pyx_vtabptr_4lxml_3sax_ElementTreeProducer = &__pyx_vtable_4lxml_3sax_ElementTreeProducer;
9625   __pyx_vtable_4lxml_3sax_ElementTreeProducer._recursive_saxify = (PyObject *(*)(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *, PyObject *, PyObject *))__pyx_f_4lxml_3sax_19ElementTreeProducer__recursive_saxify;
9626   __pyx_vtable_4lxml_3sax_ElementTreeProducer._build_qname = (PyObject *(*)(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *, PyObject *, PyObject *, PyObject *, PyObject *, int))__pyx_f_4lxml_3sax_19ElementTreeProducer__build_qname;
9627   if (PyType_Ready(&__pyx_type_4lxml_3sax_ElementTreeProducer) < 0) __PYX_ERR(0, 159, __pyx_L1_error)
9628   #if PY_VERSION_HEX < 0x030800B1
9629   __pyx_type_4lxml_3sax_ElementTreeProducer.tp_print = 0;
9630   #endif
9631   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4lxml_3sax_ElementTreeProducer.tp_dictoffset && __pyx_type_4lxml_3sax_ElementTreeProducer.tp_getattro == PyObject_GenericGetAttr)) {
9632     __pyx_type_4lxml_3sax_ElementTreeProducer.tp_getattro = __Pyx_PyObject_GenericGetAttr;
9633   }
9634   if (__Pyx_SetVtable(__pyx_type_4lxml_3sax_ElementTreeProducer.tp_dict, __pyx_vtabptr_4lxml_3sax_ElementTreeProducer) < 0) __PYX_ERR(0, 159, __pyx_L1_error)
9635   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ElementTreeProducer, (PyObject *)&__pyx_type_4lxml_3sax_ElementTreeProducer) < 0) __PYX_ERR(0, 159, __pyx_L1_error)
9636   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_4lxml_3sax_ElementTreeProducer) < 0) __PYX_ERR(0, 159, __pyx_L1_error)
9637   __pyx_ptype_4lxml_3sax_ElementTreeProducer = &__pyx_type_4lxml_3sax_ElementTreeProducer;
9638   __Pyx_RefNannyFinishContext();
9639   return 0;
9640   __pyx_L1_error:;
9641   __Pyx_RefNannyFinishContext();
9642   return -1;
9643 }
9644
9645 static int __Pyx_modinit_type_import_code(void) {
9646   __Pyx_RefNannyDeclarations
9647   __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
9648   /*--- Type import code ---*/
9649   __Pyx_RefNannyFinishContext();
9650   return 0;
9651 }
9652
9653 static int __Pyx_modinit_variable_import_code(void) {
9654   __Pyx_RefNannyDeclarations
9655   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
9656   /*--- Variable import code ---*/
9657   __Pyx_RefNannyFinishContext();
9658   return 0;
9659 }
9660
9661 static int __Pyx_modinit_function_import_code(void) {
9662   __Pyx_RefNannyDeclarations
9663   __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
9664   /*--- Function import code ---*/
9665   __Pyx_RefNannyFinishContext();
9666   return 0;
9667 }
9668
9669
9670 #ifndef CYTHON_NO_PYINIT_EXPORT
9671 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
9672 #elif PY_MAJOR_VERSION < 3
9673 #ifdef __cplusplus
9674 #define __Pyx_PyMODINIT_FUNC extern "C" void
9675 #else
9676 #define __Pyx_PyMODINIT_FUNC void
9677 #endif
9678 #else
9679 #ifdef __cplusplus
9680 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
9681 #else
9682 #define __Pyx_PyMODINIT_FUNC PyObject *
9683 #endif
9684 #endif
9685
9686
9687 #if PY_MAJOR_VERSION < 3
9688 __Pyx_PyMODINIT_FUNC initsax(void) CYTHON_SMALL_CODE; /*proto*/
9689 __Pyx_PyMODINIT_FUNC initsax(void)
9690 #else
9691 __Pyx_PyMODINIT_FUNC PyInit_sax(void) CYTHON_SMALL_CODE; /*proto*/
9692 __Pyx_PyMODINIT_FUNC PyInit_sax(void)
9693 #if CYTHON_PEP489_MULTI_PHASE_INIT
9694 {
9695   return PyModuleDef_Init(&__pyx_moduledef);
9696 }
9697 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
9698     #if PY_VERSION_HEX >= 0x030700A1
9699     static PY_INT64_T main_interpreter_id = -1;
9700     PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
9701     if (main_interpreter_id == -1) {
9702         main_interpreter_id = current_id;
9703         return (unlikely(current_id == -1)) ? -1 : 0;
9704     } else if (unlikely(main_interpreter_id != current_id))
9705     #else
9706     static PyInterpreterState *main_interpreter = NULL;
9707     PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
9708     if (!main_interpreter) {
9709         main_interpreter = current_interpreter;
9710     } else if (unlikely(main_interpreter != current_interpreter))
9711     #endif
9712     {
9713         PyErr_SetString(
9714             PyExc_ImportError,
9715             "Interpreter change detected - this module can only be loaded into one interpreter per process.");
9716         return -1;
9717     }
9718     return 0;
9719 }
9720 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) {
9721     PyObject *value = PyObject_GetAttrString(spec, from_name);
9722     int result = 0;
9723     if (likely(value)) {
9724         if (allow_none || value != Py_None) {
9725             result = PyDict_SetItemString(moddict, to_name, value);
9726         }
9727         Py_DECREF(value);
9728     } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
9729         PyErr_Clear();
9730     } else {
9731         result = -1;
9732     }
9733     return result;
9734 }
9735 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
9736     PyObject *module = NULL, *moddict, *modname;
9737     if (__Pyx_check_single_interpreter())
9738         return NULL;
9739     if (__pyx_m)
9740         return __Pyx_NewRef(__pyx_m);
9741     modname = PyObject_GetAttrString(spec, "name");
9742     if (unlikely(!modname)) goto bad;
9743     module = PyModule_NewObject(modname);
9744     Py_DECREF(modname);
9745     if (unlikely(!module)) goto bad;
9746     moddict = PyModule_GetDict(module);
9747     if (unlikely(!moddict)) goto bad;
9748     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
9749     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
9750     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
9751     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
9752     return module;
9753 bad:
9754     Py_XDECREF(module);
9755     return NULL;
9756 }
9757
9758
9759 static CYTHON_SMALL_CODE int __pyx_pymod_exec_sax(PyObject *__pyx_pyinit_module)
9760 #endif
9761 #endif
9762 {
9763   PyObject *__pyx_t_1 = NULL;
9764   PyObject *__pyx_t_2 = NULL;
9765   PyObject *__pyx_t_3 = NULL;
9766   PyObject *__pyx_t_4 = NULL;
9767   PyObject *__pyx_t_5 = NULL;
9768   PyObject *__pyx_t_6 = NULL;
9769   PyObject *__pyx_t_7 = NULL;
9770   int __pyx_lineno = 0;
9771   const char *__pyx_filename = NULL;
9772   int __pyx_clineno = 0;
9773   __Pyx_RefNannyDeclarations
9774   #if CYTHON_PEP489_MULTI_PHASE_INIT
9775   if (__pyx_m) {
9776     if (__pyx_m == __pyx_pyinit_module) return 0;
9777     PyErr_SetString(PyExc_RuntimeError, "Module 'sax' has already been imported. Re-initialisation is not supported.");
9778     return -1;
9779   }
9780   #elif PY_MAJOR_VERSION >= 3
9781   if (__pyx_m) return __Pyx_NewRef(__pyx_m);
9782   #endif
9783   #if CYTHON_REFNANNY
9784 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
9785 if (!__Pyx_RefNanny) {
9786   PyErr_Clear();
9787   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
9788   if (!__Pyx_RefNanny)
9789       Py_FatalError("failed to import 'refnanny' module");
9790 }
9791 #endif
9792   __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_sax(void)", 0);
9793   if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9794   #ifdef __Pxy_PyFrame_Initialize_Offsets
9795   __Pxy_PyFrame_Initialize_Offsets();
9796   #endif
9797   __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
9798   __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
9799   __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
9800   #ifdef __Pyx_CyFunction_USED
9801   if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9802   #endif
9803   #ifdef __Pyx_FusedFunction_USED
9804   if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9805   #endif
9806   #ifdef __Pyx_Coroutine_USED
9807   if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9808   #endif
9809   #ifdef __Pyx_Generator_USED
9810   if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9811   #endif
9812   #ifdef __Pyx_AsyncGen_USED
9813   if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9814   #endif
9815   #ifdef __Pyx_StopAsyncIteration_USED
9816   if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9817   #endif
9818   /*--- Library function declarations ---*/
9819   /*--- Threads initialization code ---*/
9820   #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
9821   #ifdef WITH_THREAD /* Python build with threading support? */
9822   PyEval_InitThreads();
9823   #endif
9824   #endif
9825   /*--- Module creation code ---*/
9826   #if CYTHON_PEP489_MULTI_PHASE_INIT
9827   __pyx_m = __pyx_pyinit_module;
9828   Py_INCREF(__pyx_m);
9829   #else
9830   #if PY_MAJOR_VERSION < 3
9831   __pyx_m = Py_InitModule4("sax", __pyx_methods, __pyx_k_SAX_based_adapter_to_copy_trees, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
9832   #else
9833   __pyx_m = PyModule_Create(&__pyx_moduledef);
9834   #endif
9835   if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
9836   #endif
9837   __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
9838   Py_INCREF(__pyx_d);
9839   __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
9840   Py_INCREF(__pyx_b);
9841   __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
9842   Py_INCREF(__pyx_cython_runtime);
9843   if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9844   /*--- Initialize various global constants etc. ---*/
9845   if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9846   #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
9847   if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9848   #endif
9849   if (__pyx_module_is_main_lxml__sax) {
9850     if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9851   }
9852   #if PY_MAJOR_VERSION >= 3
9853   {
9854     PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
9855     if (!PyDict_GetItemString(modules, "lxml.sax")) {
9856       if (unlikely(PyDict_SetItemString(modules, "lxml.sax", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
9857     }
9858   }
9859   #endif
9860   /*--- Builtin init code ---*/
9861   if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9862   /*--- Constants init code ---*/
9863   if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9864   /*--- Global type/function init code ---*/
9865   (void)__Pyx_modinit_global_init_code();
9866   (void)__Pyx_modinit_variable_export_code();
9867   if (unlikely(__Pyx_modinit_function_export_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
9868   if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
9869   (void)__Pyx_modinit_type_import_code();
9870   (void)__Pyx_modinit_variable_import_code();
9871   (void)__Pyx_modinit_function_import_code();
9872   /*--- Execution code ---*/
9873   #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
9874   if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9875   #endif
9876
9877   /* "lxml/sax.py":17
9878  * from __future__ import absolute_import
9879  * 
9880  * from xml.sax.handler import ContentHandler             # <<<<<<<<<<<<<<
9881  * from lxml import etree
9882  * from lxml.etree import ElementTree, SubElement
9883  */
9884   __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error)
9885   __Pyx_GOTREF(__pyx_t_1);
9886   __Pyx_INCREF(__pyx_n_s_ContentHandler);
9887   __Pyx_GIVEREF(__pyx_n_s_ContentHandler);
9888   PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ContentHandler);
9889   __pyx_t_2 = __Pyx_Import(__pyx_n_s_xml_sax_handler, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error)
9890   __Pyx_GOTREF(__pyx_t_2);
9891   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9892   __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ContentHandler); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error)
9893   __Pyx_GOTREF(__pyx_t_1);
9894   if (PyDict_SetItem(__pyx_d, __pyx_n_s_ContentHandler, __pyx_t_1) < 0) __PYX_ERR(0, 17, __pyx_L1_error)
9895   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9896   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9897
9898   /* "lxml/sax.py":18
9899  * 
9900  * from xml.sax.handler import ContentHandler
9901  * from lxml import etree             # <<<<<<<<<<<<<<
9902  * from lxml.etree import ElementTree, SubElement
9903  * from lxml.etree import Comment, ProcessingInstruction
9904  */
9905   __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error)
9906   __Pyx_GOTREF(__pyx_t_2);
9907   __Pyx_INCREF(__pyx_n_s_etree);
9908   __Pyx_GIVEREF(__pyx_n_s_etree);
9909   PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_etree);
9910   __pyx_t_1 = __Pyx_Import(__pyx_n_s_lxml, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error)
9911   __Pyx_GOTREF(__pyx_t_1);
9912   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9913   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_etree); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error)
9914   __Pyx_GOTREF(__pyx_t_2);
9915   if (PyDict_SetItem(__pyx_d, __pyx_n_s_etree, __pyx_t_2) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
9916   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9917   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9918
9919   /* "lxml/sax.py":19
9920  * from xml.sax.handler import ContentHandler
9921  * from lxml import etree
9922  * from lxml.etree import ElementTree, SubElement             # <<<<<<<<<<<<<<
9923  * from lxml.etree import Comment, ProcessingInstruction
9924  * 
9925  */
9926   __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
9927   __Pyx_GOTREF(__pyx_t_1);
9928   __Pyx_INCREF(__pyx_n_s_ElementTree);
9929   __Pyx_GIVEREF(__pyx_n_s_ElementTree);
9930   PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ElementTree);
9931   __Pyx_INCREF(__pyx_n_s_SubElement);
9932   __Pyx_GIVEREF(__pyx_n_s_SubElement);
9933   PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_SubElement);
9934   __pyx_t_2 = __Pyx_Import(__pyx_n_s_lxml_etree, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error)
9935   __Pyx_GOTREF(__pyx_t_2);
9936   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9937   __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ElementTree); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
9938   __Pyx_GOTREF(__pyx_t_1);
9939   if (PyDict_SetItem(__pyx_d, __pyx_n_s_ElementTree, __pyx_t_1) < 0) __PYX_ERR(0, 19, __pyx_L1_error)
9940   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9941   __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_SubElement); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
9942   __Pyx_GOTREF(__pyx_t_1);
9943   if (PyDict_SetItem(__pyx_d, __pyx_n_s_SubElement, __pyx_t_1) < 0) __PYX_ERR(0, 19, __pyx_L1_error)
9944   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9945   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9946
9947   /* "lxml/sax.py":20
9948  * from lxml import etree
9949  * from lxml.etree import ElementTree, SubElement
9950  * from lxml.etree import Comment, ProcessingInstruction             # <<<<<<<<<<<<<<
9951  * 
9952  * 
9953  */
9954   __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error)
9955   __Pyx_GOTREF(__pyx_t_2);
9956   __Pyx_INCREF(__pyx_n_s_Comment);
9957   __Pyx_GIVEREF(__pyx_n_s_Comment);
9958   PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Comment);
9959   __Pyx_INCREF(__pyx_n_s_ProcessingInstruction);
9960   __Pyx_GIVEREF(__pyx_n_s_ProcessingInstruction);
9961   PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_ProcessingInstruction);
9962   __pyx_t_1 = __Pyx_Import(__pyx_n_s_lxml_etree, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error)
9963   __Pyx_GOTREF(__pyx_t_1);
9964   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9965   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Comment); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error)
9966   __Pyx_GOTREF(__pyx_t_2);
9967   if (PyDict_SetItem(__pyx_d, __pyx_n_s_Comment, __pyx_t_2) < 0) __PYX_ERR(0, 20, __pyx_L1_error)
9968   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9969   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ProcessingInstruction); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error)
9970   __Pyx_GOTREF(__pyx_t_2);
9971   if (PyDict_SetItem(__pyx_d, __pyx_n_s_ProcessingInstruction, __pyx_t_2) < 0) __PYX_ERR(0, 20, __pyx_L1_error)
9972   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9973   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9974
9975   /* "lxml/sax.py":23
9976  * 
9977  * 
9978  * class SaxError(etree.LxmlError):             # <<<<<<<<<<<<<<
9979  *     """General SAX error.
9980  *     """
9981  */
9982   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_etree); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
9983   __Pyx_GOTREF(__pyx_t_1);
9984   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_LxmlError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
9985   __Pyx_GOTREF(__pyx_t_2);
9986   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9987   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
9988   __Pyx_GOTREF(__pyx_t_1);
9989   __Pyx_GIVEREF(__pyx_t_2);
9990   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
9991   __pyx_t_2 = 0;
9992   __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
9993   __Pyx_GOTREF(__pyx_t_2);
9994   __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_SaxError, __pyx_n_s_SaxError, (PyObject *) NULL, __pyx_n_s_lxml_sax, __pyx_kp_s_General_SAX_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 23, __pyx_L1_error)
9995   __Pyx_GOTREF(__pyx_t_3);
9996   __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_SaxError, __pyx_t_1, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 23, __pyx_L1_error)
9997   __Pyx_GOTREF(__pyx_t_4);
9998   if (PyDict_SetItem(__pyx_d, __pyx_n_s_SaxError, __pyx_t_4) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
9999   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10000   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10001   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10002   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10003
10004   /* "lxml/sax.py":35
10005  * 
10006  * 
10007  * class ElementTreeContentHandler(ContentHandler):             # <<<<<<<<<<<<<<
10008  *     """Build an lxml ElementTree from SAX events.
10009  *     """
10010  */
10011   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_ContentHandler); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error)
10012   __Pyx_GOTREF(__pyx_t_1);
10013   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 35, __pyx_L1_error)
10014   __Pyx_GOTREF(__pyx_t_2);
10015   __Pyx_GIVEREF(__pyx_t_1);
10016   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
10017   __pyx_t_1 = 0;
10018   __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error)
10019   __Pyx_GOTREF(__pyx_t_1);
10020   __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_ElementTreeContentHandler, __pyx_n_s_ElementTreeContentHandler, (PyObject *) NULL, __pyx_n_s_lxml_sax, __pyx_kp_s_Build_an_lxml_ElementTree_from_S); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 35, __pyx_L1_error)
10021   __Pyx_GOTREF(__pyx_t_3);
10022
10023   /* "lxml/sax.py":38
10024  *     """Build an lxml ElementTree from SAX events.
10025  *     """
10026  *     def __init__(self, makeelement=None):             # <<<<<<<<<<<<<<
10027  *         ContentHandler.__init__(self)
10028  *         self._root = None
10029  */
10030   __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_1__init__, 0, __pyx_n_s_ElementTreeContentHandler___init, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__10)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 38, __pyx_L1_error)
10031   __Pyx_GOTREF(__pyx_t_4);
10032   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__11);
10033   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_init, __pyx_t_4) < 0) __PYX_ERR(0, 38, __pyx_L1_error)
10034   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10035
10036   /* "lxml/sax.py":50
10037  *         self._makeelement = makeelement
10038  * 
10039  *     def _get_etree(self):             # <<<<<<<<<<<<<<
10040  *         "Contains the generated ElementTree after parsing is finished."
10041  *         return ElementTree(self._root)
10042  */
10043   __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_3_get_etree, 0, __pyx_n_s_ElementTreeContentHandler__get_e, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__13)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 50, __pyx_L1_error)
10044   __Pyx_GOTREF(__pyx_t_4);
10045   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_get_etree, __pyx_t_4) < 0) __PYX_ERR(0, 50, __pyx_L1_error)
10046   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10047
10048   /* "lxml/sax.py":54
10049  *         return ElementTree(self._root)
10050  * 
10051  *     etree = property(_get_etree, doc=_get_etree.__doc__)             # <<<<<<<<<<<<<<
10052  * 
10053  *     def setDocumentLocator(self, locator):
10054  */
10055   __pyx_t_4 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_get_etree);
10056   if (unlikely(!__pyx_t_4)) {
10057     PyErr_Clear();
10058     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_get_etree);
10059   }
10060   if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error)
10061   __Pyx_GOTREF(__pyx_t_4);
10062   __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 54, __pyx_L1_error)
10063   __Pyx_GOTREF(__pyx_t_5);
10064   __Pyx_GIVEREF(__pyx_t_4);
10065   PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
10066   __pyx_t_4 = 0;
10067   __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error)
10068   __Pyx_GOTREF(__pyx_t_4);
10069   __pyx_t_6 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_get_etree);
10070   if (unlikely(!__pyx_t_6)) {
10071     PyErr_Clear();
10072     __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_get_etree);
10073   }
10074   if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 54, __pyx_L1_error)
10075   __Pyx_GOTREF(__pyx_t_6);
10076   __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_doc); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 54, __pyx_L1_error)
10077   __Pyx_GOTREF(__pyx_t_7);
10078   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10079   if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_doc_2, __pyx_t_7) < 0) __PYX_ERR(0, 54, __pyx_L1_error)
10080   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10081   __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 54, __pyx_L1_error)
10082   __Pyx_GOTREF(__pyx_t_7);
10083   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10084   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10085   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_etree, __pyx_t_7) < 0) __PYX_ERR(0, 54, __pyx_L1_error)
10086   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10087
10088   /* "lxml/sax.py":56
10089  *     etree = property(_get_etree, doc=_get_etree.__doc__)
10090  * 
10091  *     def setDocumentLocator(self, locator):             # <<<<<<<<<<<<<<
10092  *         pass
10093  * 
10094  */
10095   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_5setDocumentLocator, 0, __pyx_n_s_ElementTreeContentHandler_setDoc, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__15)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 56, __pyx_L1_error)
10096   __Pyx_GOTREF(__pyx_t_7);
10097   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_setDocumentLocator, __pyx_t_7) < 0) __PYX_ERR(0, 56, __pyx_L1_error)
10098   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10099
10100   /* "lxml/sax.py":59
10101  *         pass
10102  * 
10103  *     def startDocument(self):             # <<<<<<<<<<<<<<
10104  *         pass
10105  * 
10106  */
10107   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_7startDocument, 0, __pyx_n_s_ElementTreeContentHandler_startD, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__17)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 59, __pyx_L1_error)
10108   __Pyx_GOTREF(__pyx_t_7);
10109   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_startDocument, __pyx_t_7) < 0) __PYX_ERR(0, 59, __pyx_L1_error)
10110   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10111
10112   /* "lxml/sax.py":62
10113  *         pass
10114  * 
10115  *     def endDocument(self):             # <<<<<<<<<<<<<<
10116  *         pass
10117  * 
10118  */
10119   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_9endDocument, 0, __pyx_n_s_ElementTreeContentHandler_endDoc, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__19)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 62, __pyx_L1_error)
10120   __Pyx_GOTREF(__pyx_t_7);
10121   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_endDocument, __pyx_t_7) < 0) __PYX_ERR(0, 62, __pyx_L1_error)
10122   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10123
10124   /* "lxml/sax.py":65
10125  *         pass
10126  * 
10127  *     def startPrefixMapping(self, prefix, uri):             # <<<<<<<<<<<<<<
10128  *         self._new_mappings[prefix] = uri
10129  *         try:
10130  */
10131   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_11startPrefixMapping, 0, __pyx_n_s_ElementTreeContentHandler_startP, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__21)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 65, __pyx_L1_error)
10132   __Pyx_GOTREF(__pyx_t_7);
10133   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_startPrefixMapping, __pyx_t_7) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
10134   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10135
10136   /* "lxml/sax.py":74
10137  *             self._default_ns = uri
10138  * 
10139  *     def endPrefixMapping(self, prefix):             # <<<<<<<<<<<<<<
10140  *         ns_uri_list = self._ns_mapping[prefix]
10141  *         ns_uri_list.pop()
10142  */
10143   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_13endPrefixMapping, 0, __pyx_n_s_ElementTreeContentHandler_endPre, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__23)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 74, __pyx_L1_error)
10144   __Pyx_GOTREF(__pyx_t_7);
10145   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_endPrefixMapping, __pyx_t_7) < 0) __PYX_ERR(0, 74, __pyx_L1_error)
10146   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10147
10148   /* "lxml/sax.py":80
10149  *             self._default_ns = ns_uri_list[-1]
10150  * 
10151  *     def _buildTag(self, ns_name_tuple):             # <<<<<<<<<<<<<<
10152  *         ns_uri, local_name = ns_name_tuple
10153  *         if ns_uri:
10154  */
10155   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_15_buildTag, 0, __pyx_n_s_ElementTreeContentHandler__build, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__25)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 80, __pyx_L1_error)
10156   __Pyx_GOTREF(__pyx_t_7);
10157   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_buildTag, __pyx_t_7) < 0) __PYX_ERR(0, 80, __pyx_L1_error)
10158   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10159
10160   /* "lxml/sax.py":90
10161  *         return el_tag
10162  * 
10163  *     def startElementNS(self, ns_name, qname, attributes=None):             # <<<<<<<<<<<<<<
10164  *         el_name = self._buildTag(ns_name)
10165  *         if attributes:
10166  */
10167   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_17startElementNS, 0, __pyx_n_s_ElementTreeContentHandler_startE, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__27)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 90, __pyx_L1_error)
10168   __Pyx_GOTREF(__pyx_t_7);
10169   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__28);
10170   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_startElementNS, __pyx_t_7) < 0) __PYX_ERR(0, 90, __pyx_L1_error)
10171   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10172
10173   /* "lxml/sax.py":123
10174  *         self._new_mappings.clear()
10175  * 
10176  *     def processingInstruction(self, target, data):             # <<<<<<<<<<<<<<
10177  *         pi = ProcessingInstruction(target, data)
10178  *         if self._root is None:
10179  */
10180   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_19processingInstruction, 0, __pyx_n_s_ElementTreeContentHandler_proces, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 123, __pyx_L1_error)
10181   __Pyx_GOTREF(__pyx_t_7);
10182   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_processingInstruction, __pyx_t_7) < 0) __PYX_ERR(0, 123, __pyx_L1_error)
10183   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10184
10185   /* "lxml/sax.py":130
10186  *             self._element_stack[-1].append(pi)
10187  * 
10188  *     def endElementNS(self, ns_name, qname):             # <<<<<<<<<<<<<<
10189  *         element = self._element_stack.pop()
10190  *         el_tag = self._buildTag(ns_name)
10191  */
10192   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_21endElementNS, 0, __pyx_n_s_ElementTreeContentHandler_endEle, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__32)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 130, __pyx_L1_error)
10193   __Pyx_GOTREF(__pyx_t_7);
10194   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_endElementNS, __pyx_t_7) < 0) __PYX_ERR(0, 130, __pyx_L1_error)
10195   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10196
10197   /* "lxml/sax.py":136
10198  *             raise SaxError("Unexpected element closed: " + el_tag)
10199  * 
10200  *     def startElement(self, name, attributes=None):             # <<<<<<<<<<<<<<
10201  *         if attributes:
10202  *             attributes = dict(
10203  */
10204   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_23startElement, 0, __pyx_n_s_ElementTreeContentHandler_startE_2, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__34)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 136, __pyx_L1_error)
10205   __Pyx_GOTREF(__pyx_t_7);
10206   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__35);
10207   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_startElement, __pyx_t_7) < 0) __PYX_ERR(0, 136, __pyx_L1_error)
10208   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10209
10210   /* "lxml/sax.py":143
10211  *         self.startElementNS((None, name), name, attributes)
10212  * 
10213  *     def endElement(self, name):             # <<<<<<<<<<<<<<
10214  *         self.endElementNS((None, name), name)
10215  * 
10216  */
10217   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_25endElement, 0, __pyx_n_s_ElementTreeContentHandler_endEle_2, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__37)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 143, __pyx_L1_error)
10218   __Pyx_GOTREF(__pyx_t_7);
10219   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_endElement, __pyx_t_7) < 0) __PYX_ERR(0, 143, __pyx_L1_error)
10220   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10221
10222   /* "lxml/sax.py":146
10223  *         self.endElementNS((None, name), name)
10224  * 
10225  *     def characters(self, data):             # <<<<<<<<<<<<<<
10226  *         last_element = self._element_stack[-1]
10227  *         try:
10228  */
10229   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_27characters, 0, __pyx_n_s_ElementTreeContentHandler_charac, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__39)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 146, __pyx_L1_error)
10230   __Pyx_GOTREF(__pyx_t_7);
10231   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_characters, __pyx_t_7) < 0) __PYX_ERR(0, 146, __pyx_L1_error)
10232   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10233
10234   /* "lxml/sax.py":156
10235  *             last_element.text = (last_element.text or '') + data
10236  * 
10237  *     ignorableWhitespace = characters             # <<<<<<<<<<<<<<
10238  * 
10239  * 
10240  */
10241   __pyx_t_7 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_characters);
10242   if (unlikely(!__pyx_t_7)) {
10243     PyErr_Clear();
10244     __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_characters);
10245   }
10246   if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 156, __pyx_L1_error)
10247   __Pyx_GOTREF(__pyx_t_7);
10248   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_ignorableWhitespace, __pyx_t_7) < 0) __PYX_ERR(0, 156, __pyx_L1_error)
10249   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10250
10251   /* "lxml/sax.py":35
10252  * 
10253  * 
10254  * class ElementTreeContentHandler(ContentHandler):             # <<<<<<<<<<<<<<
10255  *     """Build an lxml ElementTree from SAX events.
10256  *     """
10257  */
10258   __pyx_t_7 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_ElementTreeContentHandler, __pyx_t_2, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 35, __pyx_L1_error)
10259   __Pyx_GOTREF(__pyx_t_7);
10260   if (PyDict_SetItem(__pyx_d, __pyx_n_s_ElementTreeContentHandler, __pyx_t_7) < 0) __PYX_ERR(0, 35, __pyx_L1_error)
10261   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10262   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10263   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10264   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10265
10266   /* "lxml/sax.py":173
10267  *         self._empty_attributes = attr_class({}, {})
10268  * 
10269  *     def saxify(self):             # <<<<<<<<<<<<<<
10270  *         self._content_handler.startDocument()
10271  * 
10272  */
10273   __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_19ElementTreeProducer_3saxify, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ElementTreeProducer_saxify, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__41)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error)
10274   __Pyx_GOTREF(__pyx_t_2);
10275   if (PyDict_SetItem((PyObject *)__pyx_ptype_4lxml_3sax_ElementTreeProducer->tp_dict, __pyx_n_s_saxify, __pyx_t_2) < 0) __PYX_ERR(0, 173, __pyx_L1_error)
10276   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10277   PyType_Modified(__pyx_ptype_4lxml_3sax_ElementTreeProducer);
10278
10279   /* "(tree fragment)":1
10280  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
10281  *     cdef tuple state
10282  *     cdef object _dict
10283  */
10284   __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_19ElementTreeProducer_5__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ElementTreeProducer___reduce_cyt, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__43)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error)
10285   __Pyx_GOTREF(__pyx_t_2);
10286   if (PyDict_SetItem((PyObject *)__pyx_ptype_4lxml_3sax_ElementTreeProducer->tp_dict, __pyx_n_s_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
10287   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10288   PyType_Modified(__pyx_ptype_4lxml_3sax_ElementTreeProducer);
10289
10290   /* "(tree fragment)":16
10291  *     else:
10292  *         return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, state)
10293  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
10294  *     __pyx_unpickle_ElementTreeProducer__set_state(self, __pyx_state)
10295  */
10296   __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_19ElementTreeProducer_7__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ElementTreeProducer___setstate_c, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__45)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 16, __pyx_L1_error)
10297   __Pyx_GOTREF(__pyx_t_2);
10298   if (PyDict_SetItem((PyObject *)__pyx_ptype_4lxml_3sax_ElementTreeProducer->tp_dict, __pyx_n_s_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(1, 16, __pyx_L1_error)
10299   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10300   PyType_Modified(__pyx_ptype_4lxml_3sax_ElementTreeProducer);
10301
10302   /* "lxml/sax.py":274
10303  * 
10304  * 
10305  * def saxify(element_or_tree, content_handler):             # <<<<<<<<<<<<<<
10306  *     """One-shot helper to generate SAX events from an XML tree and fire
10307  *     them against a SAX ContentHandler.
10308  */
10309   __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_1saxify, 0, __pyx_n_s_saxify, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__47)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 274, __pyx_L1_error)
10310   __Pyx_GOTREF(__pyx_t_2);
10311   if (PyDict_SetItem(__pyx_d, __pyx_n_s_saxify, __pyx_t_2) < 0) __PYX_ERR(0, 274, __pyx_L1_error)
10312   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10313
10314   /* "(tree fragment)":1
10315  * def __pyx_unpickle_ElementTreeProducer(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
10316  *     cdef object __pyx_PickleError
10317  *     cdef object __pyx_result
10318  */
10319   __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_3__pyx_unpickle_ElementTreeProducer, 0, __pyx_n_s_pyx_unpickle_ElementTreeProduc, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__49)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error)
10320   __Pyx_GOTREF(__pyx_t_2);
10321   if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_ElementTreeProduc, __pyx_t_2) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
10322   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10323
10324   /* "lxml/sax.py":1
10325  * # cython: language_level=2             # <<<<<<<<<<<<<<
10326  * 
10327  * """
10328  */
10329   __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
10330   __Pyx_GOTREF(__pyx_t_2);
10331   if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10332   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10333
10334   /*--- Wrapped vars code ---*/
10335
10336   if (__Pyx_RegisterCleanup()) __PYX_ERR(0, 1, __pyx_L1_error);
10337   goto __pyx_L0;
10338   __pyx_L1_error:;
10339   __Pyx_XDECREF(__pyx_t_1);
10340   __Pyx_XDECREF(__pyx_t_2);
10341   __Pyx_XDECREF(__pyx_t_3);
10342   __Pyx_XDECREF(__pyx_t_4);
10343   __Pyx_XDECREF(__pyx_t_5);
10344   __Pyx_XDECREF(__pyx_t_6);
10345   __Pyx_XDECREF(__pyx_t_7);
10346   if (__pyx_m) {
10347     if (__pyx_d) {
10348       __Pyx_AddTraceback("init lxml.sax", __pyx_clineno, __pyx_lineno, __pyx_filename);
10349     }
10350     Py_CLEAR(__pyx_m);
10351   } else if (!PyErr_Occurred()) {
10352     PyErr_SetString(PyExc_ImportError, "init lxml.sax");
10353   }
10354   __pyx_L0:;
10355   __Pyx_RefNannyFinishContext();
10356   #if CYTHON_PEP489_MULTI_PHASE_INIT
10357   return (__pyx_m != NULL) ? 0 : -1;
10358   #elif PY_MAJOR_VERSION >= 3
10359   return __pyx_m;
10360   #else
10361   return;
10362   #endif
10363 }
10364
10365 static CYTHON_SMALL_CODE void __Pyx_CleanupGlobals(void) {
10366   Py_CLEAR(__pyx_slice__2);
10367   Py_CLEAR(__pyx_tuple__4);
10368   Py_CLEAR(__pyx_slice__5);
10369   Py_CLEAR(__pyx_slice__7);
10370   Py_CLEAR(__pyx_tuple__9);
10371   Py_CLEAR(__pyx_codeobj__10);
10372   Py_CLEAR(__pyx_tuple__11);
10373   Py_CLEAR(__pyx_tuple__12);
10374   Py_CLEAR(__pyx_codeobj__13);
10375   Py_CLEAR(__pyx_tuple__14);
10376   Py_CLEAR(__pyx_codeobj__15);
10377   Py_CLEAR(__pyx_tuple__16);
10378   Py_CLEAR(__pyx_codeobj__17);
10379   Py_CLEAR(__pyx_tuple__18);
10380   Py_CLEAR(__pyx_codeobj__19);
10381   Py_CLEAR(__pyx_tuple__20);
10382   Py_CLEAR(__pyx_codeobj__21);
10383   Py_CLEAR(__pyx_tuple__22);
10384   Py_CLEAR(__pyx_codeobj__23);
10385   Py_CLEAR(__pyx_tuple__24);
10386   Py_CLEAR(__pyx_codeobj__25);
10387   Py_CLEAR(__pyx_tuple__26);
10388   Py_CLEAR(__pyx_codeobj__27);
10389   Py_CLEAR(__pyx_tuple__28);
10390   Py_CLEAR(__pyx_tuple__29);
10391   Py_CLEAR(__pyx_codeobj__30);
10392   Py_CLEAR(__pyx_tuple__31);
10393   Py_CLEAR(__pyx_codeobj__32);
10394   Py_CLEAR(__pyx_tuple__33);
10395   Py_CLEAR(__pyx_codeobj__34);
10396   Py_CLEAR(__pyx_tuple__35);
10397   Py_CLEAR(__pyx_tuple__36);
10398   Py_CLEAR(__pyx_codeobj__37);
10399   Py_CLEAR(__pyx_tuple__38);
10400   Py_CLEAR(__pyx_codeobj__39);
10401   Py_CLEAR(__pyx_tuple__40);
10402   Py_CLEAR(__pyx_codeobj__41);
10403   Py_CLEAR(__pyx_tuple__42);
10404   Py_CLEAR(__pyx_codeobj__43);
10405   Py_CLEAR(__pyx_tuple__44);
10406   Py_CLEAR(__pyx_codeobj__45);
10407   Py_CLEAR(__pyx_tuple__46);
10408   Py_CLEAR(__pyx_codeobj__47);
10409   Py_CLEAR(__pyx_tuple__48);
10410   Py_CLEAR(__pyx_codeobj__49);
10411   /* CodeObjectCache.cleanup */
10412   if (__pyx_code_cache.entries) {
10413       __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
10414       int i, count = __pyx_code_cache.count;
10415       __pyx_code_cache.count = 0;
10416       __pyx_code_cache.max_count = 0;
10417       __pyx_code_cache.entries = NULL;
10418       for (i=0; i<count; i++) {
10419           Py_DECREF(entries[i].code_object);
10420       }
10421       PyMem_Free(entries);
10422   }
10423
10424 Py_CLEAR(__pyx_umethod_PyDict_Type_get.method);
10425   Py_CLEAR(__pyx_umethod_PyDict_Type_items.method);
10426   Py_CLEAR(__pyx_umethod_PyList_Type_pop.method);
10427 }
10428 static void __pyx_module_cleanup(CYTHON_UNUSED PyObject *self) {
10429   /*--- Global cleanup code ---*/
10430   __Pyx_CleanupGlobals();
10431   /*--- Type import cleanup code ---*/
10432   /*--- Builtin cleanup code ---*/
10433   Py_CLEAR(__pyx_builtin_property);
10434   Py_CLEAR(__pyx_builtin_KeyError);
10435   Py_CLEAR(__pyx_builtin_AttributeError);
10436   Py_CLEAR(__pyx_builtin_IndexError);
10437   Py_CLEAR(__pyx_builtin_min);
10438   /*--- Intern cleanup code ---*/
10439   Py_CLEAR(__pyx_empty_tuple);
10440   Py_CLEAR(__pyx_d);
10441   Py_CLEAR(__pyx_cython_runtime);
10442   Py_CLEAR(__pyx_b);
10443 }
10444
10445 /* --- Runtime support code --- */
10446 /* Refnanny */
10447 #if CYTHON_REFNANNY
10448 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
10449     PyObject *m = NULL, *p = NULL;
10450     void *r = NULL;
10451     m = PyImport_ImportModule(modname);
10452     if (!m) goto end;
10453     p = PyObject_GetAttrString(m, "RefNannyAPI");
10454     if (!p) goto end;
10455     r = PyLong_AsVoidPtr(p);
10456 end:
10457     Py_XDECREF(p);
10458     Py_XDECREF(m);
10459     return (__Pyx_RefNannyAPIStruct *)r;
10460 }
10461 #endif
10462
10463 /* PyObjectGetAttrStr */
10464 #if CYTHON_USE_TYPE_SLOTS
10465 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
10466     PyTypeObject* tp = Py_TYPE(obj);
10467     if (likely(tp->tp_getattro))
10468         return tp->tp_getattro(obj, attr_name);
10469 #if PY_MAJOR_VERSION < 3
10470     if (likely(tp->tp_getattr))
10471         return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
10472 #endif
10473     return PyObject_GetAttr(obj, attr_name);
10474 }
10475 #endif
10476
10477 /* GetBuiltinName */
10478 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
10479     PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
10480     if (unlikely(!result)) {
10481         PyErr_Format(PyExc_NameError,
10482 #if PY_MAJOR_VERSION >= 3
10483             "name '%U' is not defined", name);
10484 #else
10485             "name '%.200s' is not defined", PyString_AS_STRING(name));
10486 #endif
10487     }
10488     return result;
10489 }
10490
10491 /* GetItemInt */
10492 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
10493     PyObject *r;
10494     if (!j) return NULL;
10495     r = PyObject_GetItem(o, j);
10496     Py_DECREF(j);
10497     return r;
10498 }
10499 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
10500                                                               CYTHON_NCP_UNUSED int wraparound,
10501                                                               CYTHON_NCP_UNUSED int boundscheck) {
10502 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10503     Py_ssize_t wrapped_i = i;
10504     if (wraparound & unlikely(i < 0)) {
10505         wrapped_i += PyList_GET_SIZE(o);
10506     }
10507     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
10508         PyObject *r = PyList_GET_ITEM(o, wrapped_i);
10509         Py_INCREF(r);
10510         return r;
10511     }
10512     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
10513 #else
10514     return PySequence_GetItem(o, i);
10515 #endif
10516 }
10517 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
10518                                                               CYTHON_NCP_UNUSED int wraparound,
10519                                                               CYTHON_NCP_UNUSED int boundscheck) {
10520 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10521     Py_ssize_t wrapped_i = i;
10522     if (wraparound & unlikely(i < 0)) {
10523         wrapped_i += PyTuple_GET_SIZE(o);
10524     }
10525     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
10526         PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
10527         Py_INCREF(r);
10528         return r;
10529     }
10530     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
10531 #else
10532     return PySequence_GetItem(o, i);
10533 #endif
10534 }
10535 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
10536                                                      CYTHON_NCP_UNUSED int wraparound,
10537                                                      CYTHON_NCP_UNUSED int boundscheck) {
10538 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
10539     if (is_list || PyList_CheckExact(o)) {
10540         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
10541         if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
10542             PyObject *r = PyList_GET_ITEM(o, n);
10543             Py_INCREF(r);
10544             return r;
10545         }
10546     }
10547     else if (PyTuple_CheckExact(o)) {
10548         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
10549         if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
10550             PyObject *r = PyTuple_GET_ITEM(o, n);
10551             Py_INCREF(r);
10552             return r;
10553         }
10554     } else {
10555         PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
10556         if (likely(m && m->sq_item)) {
10557             if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
10558                 Py_ssize_t l = m->sq_length(o);
10559                 if (likely(l >= 0)) {
10560                     i += l;
10561                 } else {
10562                     if (!PyErr_ExceptionMatches(PyExc_OverflowError))
10563                         return NULL;
10564                     PyErr_Clear();
10565                 }
10566             }
10567             return m->sq_item(o, i);
10568         }
10569     }
10570 #else
10571     if (is_list || PySequence_Check(o)) {
10572         return PySequence_GetItem(o, i);
10573     }
10574 #endif
10575     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
10576 }
10577
10578 /* BytesEquals */
10579 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
10580 #if CYTHON_COMPILING_IN_PYPY
10581     return PyObject_RichCompareBool(s1, s2, equals);
10582 #else
10583     if (s1 == s2) {
10584         return (equals == Py_EQ);
10585     } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
10586         const char *ps1, *ps2;
10587         Py_ssize_t length = PyBytes_GET_SIZE(s1);
10588         if (length != PyBytes_GET_SIZE(s2))
10589             return (equals == Py_NE);
10590         ps1 = PyBytes_AS_STRING(s1);
10591         ps2 = PyBytes_AS_STRING(s2);
10592         if (ps1[0] != ps2[0]) {
10593             return (equals == Py_NE);
10594         } else if (length == 1) {
10595             return (equals == Py_EQ);
10596         } else {
10597             int result;
10598 #if CYTHON_USE_UNICODE_INTERNALS
10599             Py_hash_t hash1, hash2;
10600             hash1 = ((PyBytesObject*)s1)->ob_shash;
10601             hash2 = ((PyBytesObject*)s2)->ob_shash;
10602             if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
10603                 return (equals == Py_NE);
10604             }
10605 #endif
10606             result = memcmp(ps1, ps2, (size_t)length);
10607             return (equals == Py_EQ) ? (result == 0) : (result != 0);
10608         }
10609     } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
10610         return (equals == Py_NE);
10611     } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
10612         return (equals == Py_NE);
10613     } else {
10614         int result;
10615         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
10616         if (!py_result)
10617             return -1;
10618         result = __Pyx_PyObject_IsTrue(py_result);
10619         Py_DECREF(py_result);
10620         return result;
10621     }
10622 #endif
10623 }
10624
10625 /* UnicodeEquals */
10626 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
10627 #if CYTHON_COMPILING_IN_PYPY
10628     return PyObject_RichCompareBool(s1, s2, equals);
10629 #else
10630 #if PY_MAJOR_VERSION < 3
10631     PyObject* owned_ref = NULL;
10632 #endif
10633     int s1_is_unicode, s2_is_unicode;
10634     if (s1 == s2) {
10635         goto return_eq;
10636     }
10637     s1_is_unicode = PyUnicode_CheckExact(s1);
10638     s2_is_unicode = PyUnicode_CheckExact(s2);
10639 #if PY_MAJOR_VERSION < 3
10640     if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
10641         owned_ref = PyUnicode_FromObject(s2);
10642         if (unlikely(!owned_ref))
10643             return -1;
10644         s2 = owned_ref;
10645         s2_is_unicode = 1;
10646     } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
10647         owned_ref = PyUnicode_FromObject(s1);
10648         if (unlikely(!owned_ref))
10649             return -1;
10650         s1 = owned_ref;
10651         s1_is_unicode = 1;
10652     } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
10653         return __Pyx_PyBytes_Equals(s1, s2, equals);
10654     }
10655 #endif
10656     if (s1_is_unicode & s2_is_unicode) {
10657         Py_ssize_t length;
10658         int kind;
10659         void *data1, *data2;
10660         if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
10661             return -1;
10662         length = __Pyx_PyUnicode_GET_LENGTH(s1);
10663         if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
10664             goto return_ne;
10665         }
10666 #if CYTHON_USE_UNICODE_INTERNALS
10667         {
10668             Py_hash_t hash1, hash2;
10669         #if CYTHON_PEP393_ENABLED
10670             hash1 = ((PyASCIIObject*)s1)->hash;
10671             hash2 = ((PyASCIIObject*)s2)->hash;
10672         #else
10673             hash1 = ((PyUnicodeObject*)s1)->hash;
10674             hash2 = ((PyUnicodeObject*)s2)->hash;
10675         #endif
10676             if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
10677                 goto return_ne;
10678             }
10679         }
10680 #endif
10681         kind = __Pyx_PyUnicode_KIND(s1);
10682         if (kind != __Pyx_PyUnicode_KIND(s2)) {
10683             goto return_ne;
10684         }
10685         data1 = __Pyx_PyUnicode_DATA(s1);
10686         data2 = __Pyx_PyUnicode_DATA(s2);
10687         if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
10688             goto return_ne;
10689         } else if (length == 1) {
10690             goto return_eq;
10691         } else {
10692             int result = memcmp(data1, data2, (size_t)(length * kind));
10693             #if PY_MAJOR_VERSION < 3
10694             Py_XDECREF(owned_ref);
10695             #endif
10696             return (equals == Py_EQ) ? (result == 0) : (result != 0);
10697         }
10698     } else if ((s1 == Py_None) & s2_is_unicode) {
10699         goto return_ne;
10700     } else if ((s2 == Py_None) & s1_is_unicode) {
10701         goto return_ne;
10702     } else {
10703         int result;
10704         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
10705         #if PY_MAJOR_VERSION < 3
10706         Py_XDECREF(owned_ref);
10707         #endif
10708         if (!py_result)
10709             return -1;
10710         result = __Pyx_PyObject_IsTrue(py_result);
10711         Py_DECREF(py_result);
10712         return result;
10713     }
10714 return_eq:
10715     #if PY_MAJOR_VERSION < 3
10716     Py_XDECREF(owned_ref);
10717     #endif
10718     return (equals == Py_EQ);
10719 return_ne:
10720     #if PY_MAJOR_VERSION < 3
10721     Py_XDECREF(owned_ref);
10722     #endif
10723     return (equals == Py_NE);
10724 #endif
10725 }
10726
10727 /* SliceObject */
10728 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
10729         Py_ssize_t cstart, Py_ssize_t cstop,
10730         PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
10731         int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
10732 #if CYTHON_USE_TYPE_SLOTS
10733     PyMappingMethods* mp;
10734 #if PY_MAJOR_VERSION < 3
10735     PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
10736     if (likely(ms && ms->sq_slice)) {
10737         if (!has_cstart) {
10738             if (_py_start && (*_py_start != Py_None)) {
10739                 cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
10740                 if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
10741             } else
10742                 cstart = 0;
10743         }
10744         if (!has_cstop) {
10745             if (_py_stop && (*_py_stop != Py_None)) {
10746                 cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
10747                 if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
10748             } else
10749                 cstop = PY_SSIZE_T_MAX;
10750         }
10751         if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
10752             Py_ssize_t l = ms->sq_length(obj);
10753             if (likely(l >= 0)) {
10754                 if (cstop < 0) {
10755                     cstop += l;
10756                     if (cstop < 0) cstop = 0;
10757                 }
10758                 if (cstart < 0) {
10759                     cstart += l;
10760                     if (cstart < 0) cstart = 0;
10761                 }
10762             } else {
10763                 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
10764                     goto bad;
10765                 PyErr_Clear();
10766             }
10767         }
10768         return ms->sq_slice(obj, cstart, cstop);
10769     }
10770 #endif
10771     mp = Py_TYPE(obj)->tp_as_mapping;
10772     if (likely(mp && mp->mp_subscript))
10773 #endif
10774     {
10775         PyObject* result;
10776         PyObject *py_slice, *py_start, *py_stop;
10777         if (_py_slice) {
10778             py_slice = *_py_slice;
10779         } else {
10780             PyObject* owned_start = NULL;
10781             PyObject* owned_stop = NULL;
10782             if (_py_start) {
10783                 py_start = *_py_start;
10784             } else {
10785                 if (has_cstart) {
10786                     owned_start = py_start = PyInt_FromSsize_t(cstart);
10787                     if (unlikely(!py_start)) goto bad;
10788                 } else
10789                     py_start = Py_None;
10790             }
10791             if (_py_stop) {
10792                 py_stop = *_py_stop;
10793             } else {
10794                 if (has_cstop) {
10795                     owned_stop = py_stop = PyInt_FromSsize_t(cstop);
10796                     if (unlikely(!py_stop)) {
10797                         Py_XDECREF(owned_start);
10798                         goto bad;
10799                     }
10800                 } else
10801                     py_stop = Py_None;
10802             }
10803             py_slice = PySlice_New(py_start, py_stop, Py_None);
10804             Py_XDECREF(owned_start);
10805             Py_XDECREF(owned_stop);
10806             if (unlikely(!py_slice)) goto bad;
10807         }
10808 #if CYTHON_USE_TYPE_SLOTS
10809         result = mp->mp_subscript(obj, py_slice);
10810 #else
10811         result = PyObject_GetItem(obj, py_slice);
10812 #endif
10813         if (!_py_slice) {
10814             Py_DECREF(py_slice);
10815         }
10816         return result;
10817     }
10818     PyErr_Format(PyExc_TypeError,
10819         "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
10820 bad:
10821     return NULL;
10822 }
10823
10824 /* PyObjectCall */
10825 #if CYTHON_COMPILING_IN_CPYTHON
10826 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
10827     PyObject *result;
10828     ternaryfunc call = func->ob_type->tp_call;
10829     if (unlikely(!call))
10830         return PyObject_Call(func, arg, kw);
10831     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
10832         return NULL;
10833     result = (*call)(func, arg, kw);
10834     Py_LeaveRecursiveCall();
10835     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
10836         PyErr_SetString(
10837             PyExc_SystemError,
10838             "NULL result without error in PyObject_Call");
10839     }
10840     return result;
10841 }
10842 #endif
10843
10844 /* RaiseDoubleKeywords */
10845 static void __Pyx_RaiseDoubleKeywordsError(
10846     const char* func_name,
10847     PyObject* kw_name)
10848 {
10849     PyErr_Format(PyExc_TypeError,
10850         #if PY_MAJOR_VERSION >= 3
10851         "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
10852         #else
10853         "%s() got multiple values for keyword argument '%s'", func_name,
10854         PyString_AsString(kw_name));
10855         #endif
10856 }
10857
10858 /* ParseKeywords */
10859 static int __Pyx_ParseOptionalKeywords(
10860     PyObject *kwds,
10861     PyObject **argnames[],
10862     PyObject *kwds2,
10863     PyObject *values[],
10864     Py_ssize_t num_pos_args,
10865     const char* function_name)
10866 {
10867     PyObject *key = 0, *value = 0;
10868     Py_ssize_t pos = 0;
10869     PyObject*** name;
10870     PyObject*** first_kw_arg = argnames + num_pos_args;
10871     while (PyDict_Next(kwds, &pos, &key, &value)) {
10872         name = first_kw_arg;
10873         while (*name && (**name != key)) name++;
10874         if (*name) {
10875             values[name-argnames] = value;
10876             continue;
10877         }
10878         name = first_kw_arg;
10879         #if PY_MAJOR_VERSION < 3
10880         if (likely(PyString_Check(key))) {
10881             while (*name) {
10882                 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
10883                         && _PyString_Eq(**name, key)) {
10884                     values[name-argnames] = value;
10885                     break;
10886                 }
10887                 name++;
10888             }
10889             if (*name) continue;
10890             else {
10891                 PyObject*** argname = argnames;
10892                 while (argname != first_kw_arg) {
10893                     if ((**argname == key) || (
10894                             (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
10895                              && _PyString_Eq(**argname, key))) {
10896                         goto arg_passed_twice;
10897                     }
10898                     argname++;
10899                 }
10900             }
10901         } else
10902         #endif
10903         if (likely(PyUnicode_Check(key))) {
10904             while (*name) {
10905                 int cmp = (**name == key) ? 0 :
10906                 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
10907                     (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
10908                 #endif
10909                     PyUnicode_Compare(**name, key);
10910                 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
10911                 if (cmp == 0) {
10912                     values[name-argnames] = value;
10913                     break;
10914                 }
10915                 name++;
10916             }
10917             if (*name) continue;
10918             else {
10919                 PyObject*** argname = argnames;
10920                 while (argname != first_kw_arg) {
10921                     int cmp = (**argname == key) ? 0 :
10922                     #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
10923                         (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
10924                     #endif
10925                         PyUnicode_Compare(**argname, key);
10926                     if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
10927                     if (cmp == 0) goto arg_passed_twice;
10928                     argname++;
10929                 }
10930             }
10931         } else
10932             goto invalid_keyword_type;
10933         if (kwds2) {
10934             if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
10935         } else {
10936             goto invalid_keyword;
10937         }
10938     }
10939     return 0;
10940 arg_passed_twice:
10941     __Pyx_RaiseDoubleKeywordsError(function_name, key);
10942     goto bad;
10943 invalid_keyword_type:
10944     PyErr_Format(PyExc_TypeError,
10945         "%.200s() keywords must be strings", function_name);
10946     goto bad;
10947 invalid_keyword:
10948     PyErr_Format(PyExc_TypeError,
10949     #if PY_MAJOR_VERSION < 3
10950         "%.200s() got an unexpected keyword argument '%.200s'",
10951         function_name, PyString_AsString(key));
10952     #else
10953         "%s() got an unexpected keyword argument '%U'",
10954         function_name, key);
10955     #endif
10956 bad:
10957     return -1;
10958 }
10959
10960 /* RaiseArgTupleInvalid */
10961 static void __Pyx_RaiseArgtupleInvalid(
10962     const char* func_name,
10963     int exact,
10964     Py_ssize_t num_min,
10965     Py_ssize_t num_max,
10966     Py_ssize_t num_found)
10967 {
10968     Py_ssize_t num_expected;
10969     const char *more_or_less;
10970     if (num_found < num_min) {
10971         num_expected = num_min;
10972         more_or_less = "at least";
10973     } else {
10974         num_expected = num_max;
10975         more_or_less = "at most";
10976     }
10977     if (exact) {
10978         more_or_less = "exactly";
10979     }
10980     PyErr_Format(PyExc_TypeError,
10981                  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
10982                  func_name, more_or_less, num_expected,
10983                  (num_expected == 1) ? "" : "s", num_found);
10984 }
10985
10986 /* PyDictVersioning */
10987 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
10988 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
10989     PyObject *dict = Py_TYPE(obj)->tp_dict;
10990     return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
10991 }
10992 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
10993     PyObject **dictptr = NULL;
10994     Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
10995     if (offset) {
10996 #if CYTHON_COMPILING_IN_CPYTHON
10997         dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
10998 #else
10999         dictptr = _PyObject_GetDictPtr(obj);
11000 #endif
11001     }
11002     return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
11003 }
11004 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
11005     PyObject *dict = Py_TYPE(obj)->tp_dict;
11006     if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
11007         return 0;
11008     return obj_dict_version == __Pyx_get_object_dict_version(obj);
11009 }
11010 #endif
11011
11012 /* GetModuleGlobalName */
11013 #if CYTHON_USE_DICT_VERSIONS
11014 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
11015 #else
11016 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
11017 #endif
11018 {
11019     PyObject *result;
11020 #if !CYTHON_AVOID_BORROWED_REFS
11021 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
11022     result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
11023     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
11024     if (likely(result)) {
11025         return __Pyx_NewRef(result);
11026     } else if (unlikely(PyErr_Occurred())) {
11027         return NULL;
11028     }
11029 #else
11030     result = PyDict_GetItem(__pyx_d, name);
11031     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
11032     if (likely(result)) {
11033         return __Pyx_NewRef(result);
11034     }
11035 #endif
11036 #else
11037     result = PyObject_GetItem(__pyx_d, name);
11038     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
11039     if (likely(result)) {
11040         return __Pyx_NewRef(result);
11041     }
11042     PyErr_Clear();
11043 #endif
11044     return __Pyx_GetBuiltinName(name);
11045 }
11046
11047 /* PyCFunctionFastCall */
11048 #if CYTHON_FAST_PYCCALL
11049 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
11050     PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
11051     PyCFunction meth = PyCFunction_GET_FUNCTION(func);
11052     PyObject *self = PyCFunction_GET_SELF(func);
11053     int flags = PyCFunction_GET_FLAGS(func);
11054     assert(PyCFunction_Check(func));
11055     assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
11056     assert(nargs >= 0);
11057     assert(nargs == 0 || args != NULL);
11058     /* _PyCFunction_FastCallDict() must not be called with an exception set,
11059        because it may clear it (directly or indirectly) and so the
11060        caller loses its exception */
11061     assert(!PyErr_Occurred());
11062     if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
11063         return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
11064     } else {
11065         return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
11066     }
11067 }
11068 #endif
11069
11070 /* PyFunctionFastCall */
11071 #if CYTHON_FAST_PYCALL
11072 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
11073                                                PyObject *globals) {
11074     PyFrameObject *f;
11075     PyThreadState *tstate = __Pyx_PyThreadState_Current;
11076     PyObject **fastlocals;
11077     Py_ssize_t i;
11078     PyObject *result;
11079     assert(globals != NULL);
11080     /* XXX Perhaps we should create a specialized
11081        PyFrame_New() that doesn't take locals, but does
11082        take builtins without sanity checking them.
11083        */
11084     assert(tstate != NULL);
11085     f = PyFrame_New(tstate, co, globals, NULL);
11086     if (f == NULL) {
11087         return NULL;
11088     }
11089     fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
11090     for (i = 0; i < na; i++) {
11091         Py_INCREF(*args);
11092         fastlocals[i] = *args++;
11093     }
11094     result = PyEval_EvalFrameEx(f,0);
11095     ++tstate->recursion_depth;
11096     Py_DECREF(f);
11097     --tstate->recursion_depth;
11098     return result;
11099 }
11100 #if 1 || PY_VERSION_HEX < 0x030600B1
11101 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
11102     PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
11103     PyObject *globals = PyFunction_GET_GLOBALS(func);
11104     PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
11105     PyObject *closure;
11106 #if PY_MAJOR_VERSION >= 3
11107     PyObject *kwdefs;
11108 #endif
11109     PyObject *kwtuple, **k;
11110     PyObject **d;
11111     Py_ssize_t nd;
11112     Py_ssize_t nk;
11113     PyObject *result;
11114     assert(kwargs == NULL || PyDict_Check(kwargs));
11115     nk = kwargs ? PyDict_Size(kwargs) : 0;
11116     if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
11117         return NULL;
11118     }
11119     if (
11120 #if PY_MAJOR_VERSION >= 3
11121             co->co_kwonlyargcount == 0 &&
11122 #endif
11123             likely(kwargs == NULL || nk == 0) &&
11124             co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
11125         if (argdefs == NULL && co->co_argcount == nargs) {
11126             result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
11127             goto done;
11128         }
11129         else if (nargs == 0 && argdefs != NULL
11130                  && co->co_argcount == Py_SIZE(argdefs)) {
11131             /* function called with no arguments, but all parameters have
11132                a default value: use default values as arguments .*/
11133             args = &PyTuple_GET_ITEM(argdefs, 0);
11134             result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
11135             goto done;
11136         }
11137     }
11138     if (kwargs != NULL) {
11139         Py_ssize_t pos, i;
11140         kwtuple = PyTuple_New(2 * nk);
11141         if (kwtuple == NULL) {
11142             result = NULL;
11143             goto done;
11144         }
11145         k = &PyTuple_GET_ITEM(kwtuple, 0);
11146         pos = i = 0;
11147         while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
11148             Py_INCREF(k[i]);
11149             Py_INCREF(k[i+1]);
11150             i += 2;
11151         }
11152         nk = i / 2;
11153     }
11154     else {
11155         kwtuple = NULL;
11156         k = NULL;
11157     }
11158     closure = PyFunction_GET_CLOSURE(func);
11159 #if PY_MAJOR_VERSION >= 3
11160     kwdefs = PyFunction_GET_KW_DEFAULTS(func);
11161 #endif
11162     if (argdefs != NULL) {
11163         d = &PyTuple_GET_ITEM(argdefs, 0);
11164         nd = Py_SIZE(argdefs);
11165     }
11166     else {
11167         d = NULL;
11168         nd = 0;
11169     }
11170 #if PY_MAJOR_VERSION >= 3
11171     result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
11172                                args, (int)nargs,
11173                                k, (int)nk,
11174                                d, (int)nd, kwdefs, closure);
11175 #else
11176     result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
11177                                args, (int)nargs,
11178                                k, (int)nk,
11179                                d, (int)nd, closure);
11180 #endif
11181     Py_XDECREF(kwtuple);
11182 done:
11183     Py_LeaveRecursiveCall();
11184     return result;
11185 }
11186 #endif
11187 #endif
11188
11189 /* PyObjectCall2Args */
11190 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
11191     PyObject *args, *result = NULL;
11192     #if CYTHON_FAST_PYCALL
11193     if (PyFunction_Check(function)) {
11194         PyObject *args[2] = {arg1, arg2};
11195         return __Pyx_PyFunction_FastCall(function, args, 2);
11196     }
11197     #endif
11198     #if CYTHON_FAST_PYCCALL
11199     if (__Pyx_PyFastCFunction_Check(function)) {
11200         PyObject *args[2] = {arg1, arg2};
11201         return __Pyx_PyCFunction_FastCall(function, args, 2);
11202     }
11203     #endif
11204     args = PyTuple_New(2);
11205     if (unlikely(!args)) goto done;
11206     Py_INCREF(arg1);
11207     PyTuple_SET_ITEM(args, 0, arg1);
11208     Py_INCREF(arg2);
11209     PyTuple_SET_ITEM(args, 1, arg2);
11210     Py_INCREF(function);
11211     result = __Pyx_PyObject_Call(function, args, NULL);
11212     Py_DECREF(args);
11213     Py_DECREF(function);
11214 done:
11215     return result;
11216 }
11217
11218 /* PyObjectCallMethO */
11219 #if CYTHON_COMPILING_IN_CPYTHON
11220 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
11221     PyObject *self, *result;
11222     PyCFunction cfunc;
11223     cfunc = PyCFunction_GET_FUNCTION(func);
11224     self = PyCFunction_GET_SELF(func);
11225     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
11226         return NULL;
11227     result = cfunc(self, arg);
11228     Py_LeaveRecursiveCall();
11229     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
11230         PyErr_SetString(
11231             PyExc_SystemError,
11232             "NULL result without error in PyObject_Call");
11233     }
11234     return result;
11235 }
11236 #endif
11237
11238 /* PyObjectCallOneArg */
11239 #if CYTHON_COMPILING_IN_CPYTHON
11240 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
11241     PyObject *result;
11242     PyObject *args = PyTuple_New(1);
11243     if (unlikely(!args)) return NULL;
11244     Py_INCREF(arg);
11245     PyTuple_SET_ITEM(args, 0, arg);
11246     result = __Pyx_PyObject_Call(func, args, NULL);
11247     Py_DECREF(args);
11248     return result;
11249 }
11250 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
11251 #if CYTHON_FAST_PYCALL
11252     if (PyFunction_Check(func)) {
11253         return __Pyx_PyFunction_FastCall(func, &arg, 1);
11254     }
11255 #endif
11256     if (likely(PyCFunction_Check(func))) {
11257         if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
11258             return __Pyx_PyObject_CallMethO(func, arg);
11259 #if CYTHON_FAST_PYCCALL
11260         } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
11261             return __Pyx_PyCFunction_FastCall(func, &arg, 1);
11262 #endif
11263         }
11264     }
11265     return __Pyx__PyObject_CallOneArg(func, arg);
11266 }
11267 #else
11268 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
11269     PyObject *result;
11270     PyObject *args = PyTuple_Pack(1, arg);
11271     if (unlikely(!args)) return NULL;
11272     result = __Pyx_PyObject_Call(func, args, NULL);
11273     Py_DECREF(args);
11274     return result;
11275 }
11276 #endif
11277
11278 /* PyObjectSetAttrStr */
11279 #if CYTHON_USE_TYPE_SLOTS
11280 static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
11281     PyTypeObject* tp = Py_TYPE(obj);
11282     if (likely(tp->tp_setattro))
11283         return tp->tp_setattro(obj, attr_name, value);
11284 #if PY_MAJOR_VERSION < 3
11285     if (likely(tp->tp_setattr))
11286         return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
11287 #endif
11288     return PyObject_SetAttr(obj, attr_name, value);
11289 }
11290 #endif
11291
11292 /* PyObjectGetMethod */
11293 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
11294     PyObject *attr;
11295 #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
11296     PyTypeObject *tp = Py_TYPE(obj);
11297     PyObject *descr;
11298     descrgetfunc f = NULL;
11299     PyObject **dictptr, *dict;
11300     int meth_found = 0;
11301     assert (*method == NULL);
11302     if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
11303         attr = __Pyx_PyObject_GetAttrStr(obj, name);
11304         goto try_unpack;
11305     }
11306     if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
11307         return 0;
11308     }
11309     descr = _PyType_Lookup(tp, name);
11310     if (likely(descr != NULL)) {
11311         Py_INCREF(descr);
11312 #if PY_MAJOR_VERSION >= 3
11313         #ifdef __Pyx_CyFunction_USED
11314         if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
11315         #else
11316         if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
11317         #endif
11318 #else
11319         #ifdef __Pyx_CyFunction_USED
11320         if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
11321         #else
11322         if (likely(PyFunction_Check(descr)))
11323         #endif
11324 #endif
11325         {
11326             meth_found = 1;
11327         } else {
11328             f = Py_TYPE(descr)->tp_descr_get;
11329             if (f != NULL && PyDescr_IsData(descr)) {
11330                 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
11331                 Py_DECREF(descr);
11332                 goto try_unpack;
11333             }
11334         }
11335     }
11336     dictptr = _PyObject_GetDictPtr(obj);
11337     if (dictptr != NULL && (dict = *dictptr) != NULL) {
11338         Py_INCREF(dict);
11339         attr = __Pyx_PyDict_GetItemStr(dict, name);
11340         if (attr != NULL) {
11341             Py_INCREF(attr);
11342             Py_DECREF(dict);
11343             Py_XDECREF(descr);
11344             goto try_unpack;
11345         }
11346         Py_DECREF(dict);
11347     }
11348     if (meth_found) {
11349         *method = descr;
11350         return 1;
11351     }
11352     if (f != NULL) {
11353         attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
11354         Py_DECREF(descr);
11355         goto try_unpack;
11356     }
11357     if (descr != NULL) {
11358         *method = descr;
11359         return 0;
11360     }
11361     PyErr_Format(PyExc_AttributeError,
11362 #if PY_MAJOR_VERSION >= 3
11363                  "'%.50s' object has no attribute '%U'",
11364                  tp->tp_name, name);
11365 #else
11366                  "'%.50s' object has no attribute '%.400s'",
11367                  tp->tp_name, PyString_AS_STRING(name));
11368 #endif
11369     return 0;
11370 #else
11371     attr = __Pyx_PyObject_GetAttrStr(obj, name);
11372     goto try_unpack;
11373 #endif
11374 try_unpack:
11375 #if CYTHON_UNPACK_METHODS
11376     if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
11377         PyObject *function = PyMethod_GET_FUNCTION(attr);
11378         Py_INCREF(function);
11379         Py_DECREF(attr);
11380         *method = function;
11381         return 1;
11382     }
11383 #endif
11384     *method = attr;
11385     return 0;
11386 }
11387
11388 /* PyObjectCallMethod1 */
11389 static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
11390     PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
11391     Py_DECREF(method);
11392     return result;
11393 }
11394 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
11395     PyObject *method = NULL, *result;
11396     int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
11397     if (likely(is_method)) {
11398         result = __Pyx_PyObject_Call2Args(method, obj, arg);
11399         Py_DECREF(method);
11400         return result;
11401     }
11402     if (unlikely(!method)) return NULL;
11403     return __Pyx__PyObject_CallMethod1(method, arg);
11404 }
11405
11406 /* append */
11407 static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
11408     if (likely(PyList_CheckExact(L))) {
11409         if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
11410     } else {
11411         PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x);
11412         if (unlikely(!retval))
11413             return -1;
11414         Py_DECREF(retval);
11415     }
11416     return 0;
11417 }
11418
11419 /* ObjectGetItem */
11420 #if CYTHON_USE_TYPE_SLOTS
11421 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
11422     PyObject *runerr;
11423     Py_ssize_t key_value;
11424     PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
11425     if (unlikely(!(m && m->sq_item))) {
11426         PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
11427         return NULL;
11428     }
11429     key_value = __Pyx_PyIndex_AsSsize_t(index);
11430     if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
11431         return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
11432     }
11433     if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
11434         PyErr_Clear();
11435         PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
11436     }
11437     return NULL;
11438 }
11439 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
11440     PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
11441     if (likely(m && m->mp_subscript)) {
11442         return m->mp_subscript(obj, key);
11443     }
11444     return __Pyx_PyObject_GetIndex(obj, key);
11445 }
11446 #endif
11447
11448 /* GetTopmostException */
11449 #if CYTHON_USE_EXC_INFO_STACK
11450 static _PyErr_StackItem *
11451 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
11452 {
11453     _PyErr_StackItem *exc_info = tstate->exc_info;
11454     while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
11455            exc_info->previous_item != NULL)
11456     {
11457         exc_info = exc_info->previous_item;
11458     }
11459     return exc_info;
11460 }
11461 #endif
11462
11463 /* SaveResetException */
11464 #if CYTHON_FAST_THREAD_STATE
11465 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
11466     #if CYTHON_USE_EXC_INFO_STACK
11467     _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
11468     *type = exc_info->exc_type;
11469     *value = exc_info->exc_value;
11470     *tb = exc_info->exc_traceback;
11471     #else
11472     *type = tstate->exc_type;
11473     *value = tstate->exc_value;
11474     *tb = tstate->exc_traceback;
11475     #endif
11476     Py_XINCREF(*type);
11477     Py_XINCREF(*value);
11478     Py_XINCREF(*tb);
11479 }
11480 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
11481     PyObject *tmp_type, *tmp_value, *tmp_tb;
11482     #if CYTHON_USE_EXC_INFO_STACK
11483     _PyErr_StackItem *exc_info = tstate->exc_info;
11484     tmp_type = exc_info->exc_type;
11485     tmp_value = exc_info->exc_value;
11486     tmp_tb = exc_info->exc_traceback;
11487     exc_info->exc_type = type;
11488     exc_info->exc_value = value;
11489     exc_info->exc_traceback = tb;
11490     #else
11491     tmp_type = tstate->exc_type;
11492     tmp_value = tstate->exc_value;
11493     tmp_tb = tstate->exc_traceback;
11494     tstate->exc_type = type;
11495     tstate->exc_value = value;
11496     tstate->exc_traceback = tb;
11497     #endif
11498     Py_XDECREF(tmp_type);
11499     Py_XDECREF(tmp_value);
11500     Py_XDECREF(tmp_tb);
11501 }
11502 #endif
11503
11504 /* PyErrExceptionMatches */
11505 #if CYTHON_FAST_THREAD_STATE
11506 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
11507     Py_ssize_t i, n;
11508     n = PyTuple_GET_SIZE(tuple);
11509 #if PY_MAJOR_VERSION >= 3
11510     for (i=0; i<n; i++) {
11511         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
11512     }
11513 #endif
11514     for (i=0; i<n; i++) {
11515         if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
11516     }
11517     return 0;
11518 }
11519 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
11520     PyObject *exc_type = tstate->curexc_type;
11521     if (exc_type == err) return 1;
11522     if (unlikely(!exc_type)) return 0;
11523     if (unlikely(PyTuple_Check(err)))
11524         return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
11525     return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
11526 }
11527 #endif
11528
11529 /* GetException */
11530 #if CYTHON_FAST_THREAD_STATE
11531 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
11532 #else
11533 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
11534 #endif
11535 {
11536     PyObject *local_type, *local_value, *local_tb;
11537 #if CYTHON_FAST_THREAD_STATE
11538     PyObject *tmp_type, *tmp_value, *tmp_tb;
11539     local_type = tstate->curexc_type;
11540     local_value = tstate->curexc_value;
11541     local_tb = tstate->curexc_traceback;
11542     tstate->curexc_type = 0;
11543     tstate->curexc_value = 0;
11544     tstate->curexc_traceback = 0;
11545 #else
11546     PyErr_Fetch(&local_type, &local_value, &local_tb);
11547 #endif
11548     PyErr_NormalizeException(&local_type, &local_value, &local_tb);
11549 #if CYTHON_FAST_THREAD_STATE
11550     if (unlikely(tstate->curexc_type))
11551 #else
11552     if (unlikely(PyErr_Occurred()))
11553 #endif
11554         goto bad;
11555     #if PY_MAJOR_VERSION >= 3
11556     if (local_tb) {
11557         if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
11558             goto bad;
11559     }
11560     #endif
11561     Py_XINCREF(local_tb);
11562     Py_XINCREF(local_type);
11563     Py_XINCREF(local_value);
11564     *type = local_type;
11565     *value = local_value;
11566     *tb = local_tb;
11567 #if CYTHON_FAST_THREAD_STATE
11568     #if CYTHON_USE_EXC_INFO_STACK
11569     {
11570         _PyErr_StackItem *exc_info = tstate->exc_info;
11571         tmp_type = exc_info->exc_type;
11572         tmp_value = exc_info->exc_value;
11573         tmp_tb = exc_info->exc_traceback;
11574         exc_info->exc_type = local_type;
11575         exc_info->exc_value = local_value;
11576         exc_info->exc_traceback = local_tb;
11577     }
11578     #else
11579     tmp_type = tstate->exc_type;
11580     tmp_value = tstate->exc_value;
11581     tmp_tb = tstate->exc_traceback;
11582     tstate->exc_type = local_type;
11583     tstate->exc_value = local_value;
11584     tstate->exc_traceback = local_tb;
11585     #endif
11586     Py_XDECREF(tmp_type);
11587     Py_XDECREF(tmp_value);
11588     Py_XDECREF(tmp_tb);
11589 #else
11590     PyErr_SetExcInfo(local_type, local_value, local_tb);
11591 #endif
11592     return 0;
11593 bad:
11594     *type = 0;
11595     *value = 0;
11596     *tb = 0;
11597     Py_XDECREF(local_type);
11598     Py_XDECREF(local_value);
11599     Py_XDECREF(local_tb);
11600     return -1;
11601 }
11602
11603 /* PyObjectCallNoArg */
11604 #if CYTHON_COMPILING_IN_CPYTHON
11605 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
11606 #if CYTHON_FAST_PYCALL
11607     if (PyFunction_Check(func)) {
11608         return __Pyx_PyFunction_FastCall(func, NULL, 0);
11609     }
11610 #endif
11611 #ifdef __Pyx_CyFunction_USED
11612     if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
11613 #else
11614     if (likely(PyCFunction_Check(func)))
11615 #endif
11616     {
11617         if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
11618             return __Pyx_PyObject_CallMethO(func, NULL);
11619         }
11620     }
11621     return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
11622 }
11623 #endif
11624
11625 /* PyObjectCallMethod0 */
11626 static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
11627     PyObject *method = NULL, *result = NULL;
11628     int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
11629     if (likely(is_method)) {
11630         result = __Pyx_PyObject_CallOneArg(method, obj);
11631         Py_DECREF(method);
11632         return result;
11633     }
11634     if (unlikely(!method)) goto bad;
11635     result = __Pyx_PyObject_CallNoArg(method);
11636     Py_DECREF(method);
11637 bad:
11638     return result;
11639 }
11640
11641 /* UnpackUnboundCMethod */
11642 static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
11643     PyObject *method;
11644     method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
11645     if (unlikely(!method))
11646         return -1;
11647     target->method = method;
11648 #if CYTHON_COMPILING_IN_CPYTHON
11649     #if PY_MAJOR_VERSION >= 3
11650     if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
11651     #endif
11652     {
11653         PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
11654         target->func = descr->d_method->ml_meth;
11655         target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
11656     }
11657 #endif
11658     return 0;
11659 }
11660
11661 /* CallUnboundCMethod0 */
11662 static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
11663     PyObject *args, *result = NULL;
11664     if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
11665 #if CYTHON_ASSUME_SAFE_MACROS
11666     args = PyTuple_New(1);
11667     if (unlikely(!args)) goto bad;
11668     Py_INCREF(self);
11669     PyTuple_SET_ITEM(args, 0, self);
11670 #else
11671     args = PyTuple_Pack(1, self);
11672     if (unlikely(!args)) goto bad;
11673 #endif
11674     result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
11675     Py_DECREF(args);
11676 bad:
11677     return result;
11678 }
11679
11680 /* pop */
11681 static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L) {
11682     if (Py_TYPE(L) == &PySet_Type) {
11683         return PySet_Pop(L);
11684     }
11685     return __Pyx_PyObject_CallMethod0(L, __pyx_n_s_pop);
11686 }
11687 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
11688 static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L) {
11689     if (likely(PyList_GET_SIZE(L) > (((PyListObject*)L)->allocated >> 1))) {
11690         Py_SIZE(L) -= 1;
11691         return PyList_GET_ITEM(L, PyList_GET_SIZE(L));
11692     }
11693     return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyList_Type_pop, L);
11694 }
11695 #endif
11696
11697 /* RaiseTooManyValuesToUnpack */
11698 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
11699     PyErr_Format(PyExc_ValueError,
11700                  "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
11701 }
11702
11703 /* RaiseNeedMoreValuesToUnpack */
11704 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
11705     PyErr_Format(PyExc_ValueError,
11706                  "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
11707                  index, (index == 1) ? "" : "s");
11708 }
11709
11710 /* IterFinish */
11711 static CYTHON_INLINE int __Pyx_IterFinish(void) {
11712 #if CYTHON_FAST_THREAD_STATE
11713     PyThreadState *tstate = __Pyx_PyThreadState_Current;
11714     PyObject* exc_type = tstate->curexc_type;
11715     if (unlikely(exc_type)) {
11716         if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
11717             PyObject *exc_value, *exc_tb;
11718             exc_value = tstate->curexc_value;
11719             exc_tb = tstate->curexc_traceback;
11720             tstate->curexc_type = 0;
11721             tstate->curexc_value = 0;
11722             tstate->curexc_traceback = 0;
11723             Py_DECREF(exc_type);
11724             Py_XDECREF(exc_value);
11725             Py_XDECREF(exc_tb);
11726             return 0;
11727         } else {
11728             return -1;
11729         }
11730     }
11731     return 0;
11732 #else
11733     if (unlikely(PyErr_Occurred())) {
11734         if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
11735             PyErr_Clear();
11736             return 0;
11737         } else {
11738             return -1;
11739         }
11740     }
11741     return 0;
11742 #endif
11743 }
11744
11745 /* UnpackItemEndCheck */
11746 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
11747     if (unlikely(retval)) {
11748         Py_DECREF(retval);
11749         __Pyx_RaiseTooManyValuesError(expected);
11750         return -1;
11751     } else {
11752         return __Pyx_IterFinish();
11753     }
11754     return 0;
11755 }
11756
11757 /* GetAttr */
11758 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
11759 #if CYTHON_USE_TYPE_SLOTS
11760 #if PY_MAJOR_VERSION >= 3
11761     if (likely(PyUnicode_Check(n)))
11762 #else
11763     if (likely(PyString_Check(n)))
11764 #endif
11765         return __Pyx_PyObject_GetAttrStr(o, n);
11766 #endif
11767     return PyObject_GetAttr(o, n);
11768 }
11769
11770 /* HasAttr */
11771 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
11772     PyObject *r;
11773     if (unlikely(!__Pyx_PyBaseString_Check(n))) {
11774         PyErr_SetString(PyExc_TypeError,
11775                         "hasattr(): attribute name must be string");
11776         return -1;
11777     }
11778     r = __Pyx_GetAttr(o, n);
11779     if (unlikely(!r)) {
11780         PyErr_Clear();
11781         return 0;
11782     } else {
11783         Py_DECREF(r);
11784         return 1;
11785     }
11786 }
11787
11788 /* SliceObject */
11789 static CYTHON_INLINE int __Pyx_PyObject_SetSlice(PyObject* obj, PyObject* value,
11790         Py_ssize_t cstart, Py_ssize_t cstop,
11791         PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
11792         int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
11793 #if CYTHON_USE_TYPE_SLOTS
11794     PyMappingMethods* mp;
11795 #if PY_MAJOR_VERSION < 3
11796     PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
11797     if (likely(ms && ms->sq_ass_slice)) {
11798         if (!has_cstart) {
11799             if (_py_start && (*_py_start != Py_None)) {
11800                 cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
11801                 if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
11802             } else
11803                 cstart = 0;
11804         }
11805         if (!has_cstop) {
11806             if (_py_stop && (*_py_stop != Py_None)) {
11807                 cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
11808                 if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
11809             } else
11810                 cstop = PY_SSIZE_T_MAX;
11811         }
11812         if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
11813             Py_ssize_t l = ms->sq_length(obj);
11814             if (likely(l >= 0)) {
11815                 if (cstop < 0) {
11816                     cstop += l;
11817                     if (cstop < 0) cstop = 0;
11818                 }
11819                 if (cstart < 0) {
11820                     cstart += l;
11821                     if (cstart < 0) cstart = 0;
11822                 }
11823             } else {
11824                 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
11825                     goto bad;
11826                 PyErr_Clear();
11827             }
11828         }
11829         return ms->sq_ass_slice(obj, cstart, cstop, value);
11830     }
11831 #endif
11832     mp = Py_TYPE(obj)->tp_as_mapping;
11833     if (likely(mp && mp->mp_ass_subscript))
11834 #endif
11835     {
11836         int result;
11837         PyObject *py_slice, *py_start, *py_stop;
11838         if (_py_slice) {
11839             py_slice = *_py_slice;
11840         } else {
11841             PyObject* owned_start = NULL;
11842             PyObject* owned_stop = NULL;
11843             if (_py_start) {
11844                 py_start = *_py_start;
11845             } else {
11846                 if (has_cstart) {
11847                     owned_start = py_start = PyInt_FromSsize_t(cstart);
11848                     if (unlikely(!py_start)) goto bad;
11849                 } else
11850                     py_start = Py_None;
11851             }
11852             if (_py_stop) {
11853                 py_stop = *_py_stop;
11854             } else {
11855                 if (has_cstop) {
11856                     owned_stop = py_stop = PyInt_FromSsize_t(cstop);
11857                     if (unlikely(!py_stop)) {
11858                         Py_XDECREF(owned_start);
11859                         goto bad;
11860                     }
11861                 } else
11862                     py_stop = Py_None;
11863             }
11864             py_slice = PySlice_New(py_start, py_stop, Py_None);
11865             Py_XDECREF(owned_start);
11866             Py_XDECREF(owned_stop);
11867             if (unlikely(!py_slice)) goto bad;
11868         }
11869 #if CYTHON_USE_TYPE_SLOTS
11870         result = mp->mp_ass_subscript(obj, py_slice, value);
11871 #else
11872         result = value ? PyObject_SetItem(obj, py_slice, value) : PyObject_DelItem(obj, py_slice);
11873 #endif
11874         if (!_py_slice) {
11875             Py_DECREF(py_slice);
11876         }
11877         return result;
11878     }
11879     PyErr_Format(PyExc_TypeError,
11880         "'%.200s' object does not support slice %.10s",
11881         Py_TYPE(obj)->tp_name, value ? "assignment" : "deletion");
11882 bad:
11883     return -1;
11884 }
11885
11886 /* PyErrFetchRestore */
11887 #if CYTHON_FAST_THREAD_STATE
11888 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
11889     PyObject *tmp_type, *tmp_value, *tmp_tb;
11890     tmp_type = tstate->curexc_type;
11891     tmp_value = tstate->curexc_value;
11892     tmp_tb = tstate->curexc_traceback;
11893     tstate->curexc_type = type;
11894     tstate->curexc_value = value;
11895     tstate->curexc_traceback = tb;
11896     Py_XDECREF(tmp_type);
11897     Py_XDECREF(tmp_value);
11898     Py_XDECREF(tmp_tb);
11899 }
11900 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
11901     *type = tstate->curexc_type;
11902     *value = tstate->curexc_value;
11903     *tb = tstate->curexc_traceback;
11904     tstate->curexc_type = 0;
11905     tstate->curexc_value = 0;
11906     tstate->curexc_traceback = 0;
11907 }
11908 #endif
11909
11910 /* RaiseException */
11911 #if PY_MAJOR_VERSION < 3
11912 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
11913                         CYTHON_UNUSED PyObject *cause) {
11914     __Pyx_PyThreadState_declare
11915     Py_XINCREF(type);
11916     if (!value || value == Py_None)
11917         value = NULL;
11918     else
11919         Py_INCREF(value);
11920     if (!tb || tb == Py_None)
11921         tb = NULL;
11922     else {
11923         Py_INCREF(tb);
11924         if (!PyTraceBack_Check(tb)) {
11925             PyErr_SetString(PyExc_TypeError,
11926                 "raise: arg 3 must be a traceback or None");
11927             goto raise_error;
11928         }
11929     }
11930     if (PyType_Check(type)) {
11931 #if CYTHON_COMPILING_IN_PYPY
11932         if (!value) {
11933             Py_INCREF(Py_None);
11934             value = Py_None;
11935         }
11936 #endif
11937         PyErr_NormalizeException(&type, &value, &tb);
11938     } else {
11939         if (value) {
11940             PyErr_SetString(PyExc_TypeError,
11941                 "instance exception may not have a separate value");
11942             goto raise_error;
11943         }
11944         value = type;
11945         type = (PyObject*) Py_TYPE(type);
11946         Py_INCREF(type);
11947         if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
11948             PyErr_SetString(PyExc_TypeError,
11949                 "raise: exception class must be a subclass of BaseException");
11950             goto raise_error;
11951         }
11952     }
11953     __Pyx_PyThreadState_assign
11954     __Pyx_ErrRestore(type, value, tb);
11955     return;
11956 raise_error:
11957     Py_XDECREF(value);
11958     Py_XDECREF(type);
11959     Py_XDECREF(tb);
11960     return;
11961 }
11962 #else
11963 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
11964     PyObject* owned_instance = NULL;
11965     if (tb == Py_None) {
11966         tb = 0;
11967     } else if (tb && !PyTraceBack_Check(tb)) {
11968         PyErr_SetString(PyExc_TypeError,
11969             "raise: arg 3 must be a traceback or None");
11970         goto bad;
11971     }
11972     if (value == Py_None)
11973         value = 0;
11974     if (PyExceptionInstance_Check(type)) {
11975         if (value) {
11976             PyErr_SetString(PyExc_TypeError,
11977                 "instance exception may not have a separate value");
11978             goto bad;
11979         }
11980         value = type;
11981         type = (PyObject*) Py_TYPE(value);
11982     } else if (PyExceptionClass_Check(type)) {
11983         PyObject *instance_class = NULL;
11984         if (value && PyExceptionInstance_Check(value)) {
11985             instance_class = (PyObject*) Py_TYPE(value);
11986             if (instance_class != type) {
11987                 int is_subclass = PyObject_IsSubclass(instance_class, type);
11988                 if (!is_subclass) {
11989                     instance_class = NULL;
11990                 } else if (unlikely(is_subclass == -1)) {
11991                     goto bad;
11992                 } else {
11993                     type = instance_class;
11994                 }
11995             }
11996         }
11997         if (!instance_class) {
11998             PyObject *args;
11999             if (!value)
12000                 args = PyTuple_New(0);
12001             else if (PyTuple_Check(value)) {
12002                 Py_INCREF(value);
12003                 args = value;
12004             } else
12005                 args = PyTuple_Pack(1, value);
12006             if (!args)
12007                 goto bad;
12008             owned_instance = PyObject_Call(type, args, NULL);
12009             Py_DECREF(args);
12010             if (!owned_instance)
12011                 goto bad;
12012             value = owned_instance;
12013             if (!PyExceptionInstance_Check(value)) {
12014                 PyErr_Format(PyExc_TypeError,
12015                              "calling %R should have returned an instance of "
12016                              "BaseException, not %R",
12017                              type, Py_TYPE(value));
12018                 goto bad;
12019             }
12020         }
12021     } else {
12022         PyErr_SetString(PyExc_TypeError,
12023             "raise: exception class must be a subclass of BaseException");
12024         goto bad;
12025     }
12026     if (cause) {
12027         PyObject *fixed_cause;
12028         if (cause == Py_None) {
12029             fixed_cause = NULL;
12030         } else if (PyExceptionClass_Check(cause)) {
12031             fixed_cause = PyObject_CallObject(cause, NULL);
12032             if (fixed_cause == NULL)
12033                 goto bad;
12034         } else if (PyExceptionInstance_Check(cause)) {
12035             fixed_cause = cause;
12036             Py_INCREF(fixed_cause);
12037         } else {
12038             PyErr_SetString(PyExc_TypeError,
12039                             "exception causes must derive from "
12040                             "BaseException");
12041             goto bad;
12042         }
12043         PyException_SetCause(value, fixed_cause);
12044     }
12045     PyErr_SetObject(type, value);
12046     if (tb) {
12047 #if CYTHON_COMPILING_IN_PYPY
12048         PyObject *tmp_type, *tmp_value, *tmp_tb;
12049         PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
12050         Py_INCREF(tb);
12051         PyErr_Restore(tmp_type, tmp_value, tb);
12052         Py_XDECREF(tmp_tb);
12053 #else
12054         PyThreadState *tstate = __Pyx_PyThreadState_Current;
12055         PyObject* tmp_tb = tstate->curexc_traceback;
12056         if (tb != tmp_tb) {
12057             Py_INCREF(tb);
12058             tstate->curexc_traceback = tb;
12059             Py_XDECREF(tmp_tb);
12060         }
12061 #endif
12062     }
12063 bad:
12064     Py_XDECREF(owned_instance);
12065     return;
12066 }
12067 #endif
12068
12069 /* Import */
12070 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
12071     PyObject *empty_list = 0;
12072     PyObject *module = 0;
12073     PyObject *global_dict = 0;
12074     PyObject *empty_dict = 0;
12075     PyObject *list;
12076     #if PY_MAJOR_VERSION < 3
12077     PyObject *py_import;
12078     py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
12079     if (!py_import)
12080         goto bad;
12081     #endif
12082     if (from_list)
12083         list = from_list;
12084     else {
12085         empty_list = PyList_New(0);
12086         if (!empty_list)
12087             goto bad;
12088         list = empty_list;
12089     }
12090     global_dict = PyModule_GetDict(__pyx_m);
12091     if (!global_dict)
12092         goto bad;
12093     empty_dict = PyDict_New();
12094     if (!empty_dict)
12095         goto bad;
12096     {
12097         #if PY_MAJOR_VERSION >= 3
12098         if (level == -1) {
12099             if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
12100                 module = PyImport_ImportModuleLevelObject(
12101                     name, global_dict, empty_dict, list, 1);
12102                 if (!module) {
12103                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
12104                         goto bad;
12105                     PyErr_Clear();
12106                 }
12107             }
12108             level = 0;
12109         }
12110         #endif
12111         if (!module) {
12112             #if PY_MAJOR_VERSION < 3
12113             PyObject *py_level = PyInt_FromLong(level);
12114             if (!py_level)
12115                 goto bad;
12116             module = PyObject_CallFunctionObjArgs(py_import,
12117                 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
12118             Py_DECREF(py_level);
12119             #else
12120             module = PyImport_ImportModuleLevelObject(
12121                 name, global_dict, empty_dict, list, level);
12122             #endif
12123         }
12124     }
12125 bad:
12126     #if PY_MAJOR_VERSION < 3
12127     Py_XDECREF(py_import);
12128     #endif
12129     Py_XDECREF(empty_list);
12130     Py_XDECREF(empty_dict);
12131     return module;
12132 }
12133
12134 /* ImportFrom */
12135 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
12136     PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
12137     if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
12138         PyErr_Format(PyExc_ImportError,
12139         #if PY_MAJOR_VERSION < 3
12140             "cannot import name %.230s", PyString_AS_STRING(name));
12141         #else
12142             "cannot import name %S", name);
12143         #endif
12144     }
12145     return value;
12146 }
12147
12148 /* GetAttr3 */
12149 static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
12150     __Pyx_PyThreadState_declare
12151     __Pyx_PyThreadState_assign
12152     if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
12153         return NULL;
12154     __Pyx_PyErr_Clear();
12155     Py_INCREF(d);
12156     return d;
12157 }
12158 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
12159     PyObject *r = __Pyx_GetAttr(o, n);
12160     return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
12161 }
12162
12163 /* py_dict_items */
12164 static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) {
12165     if (PY_MAJOR_VERSION >= 3)
12166         return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyDict_Type_items, d);
12167     else
12168         return PyDict_Items(d);
12169 }
12170
12171 /* CallUnboundCMethod1 */
12172 #if CYTHON_COMPILING_IN_CPYTHON
12173 static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) {
12174     if (likely(cfunc->func)) {
12175         int flag = cfunc->flag;
12176         if (flag == METH_O) {
12177             return (*(cfunc->func))(self, arg);
12178         } else if (PY_VERSION_HEX >= 0x030600B1 && flag == METH_FASTCALL) {
12179             if (PY_VERSION_HEX >= 0x030700A0) {
12180                 return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, &arg, 1);
12181             } else {
12182                 return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
12183             }
12184         } else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) {
12185             return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
12186         }
12187     }
12188     return __Pyx__CallUnboundCMethod1(cfunc, self, arg);
12189 }
12190 #endif
12191 static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){
12192     PyObject *args, *result = NULL;
12193     if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
12194 #if CYTHON_COMPILING_IN_CPYTHON
12195     if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
12196         args = PyTuple_New(1);
12197         if (unlikely(!args)) goto bad;
12198         Py_INCREF(arg);
12199         PyTuple_SET_ITEM(args, 0, arg);
12200         if (cfunc->flag & METH_KEYWORDS)
12201             result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
12202         else
12203             result = (*cfunc->func)(self, args);
12204     } else {
12205         args = PyTuple_New(2);
12206         if (unlikely(!args)) goto bad;
12207         Py_INCREF(self);
12208         PyTuple_SET_ITEM(args, 0, self);
12209         Py_INCREF(arg);
12210         PyTuple_SET_ITEM(args, 1, arg);
12211         result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
12212     }
12213 #else
12214     args = PyTuple_Pack(2, self, arg);
12215     if (unlikely(!args)) goto bad;
12216     result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
12217 #endif
12218 bad:
12219     Py_XDECREF(args);
12220     return result;
12221 }
12222
12223 /* CallUnboundCMethod2 */
12224 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1
12225 static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) {
12226     if (likely(cfunc->func)) {
12227         PyObject *args[2] = {arg1, arg2};
12228         if (cfunc->flag == METH_FASTCALL) {
12229             #if PY_VERSION_HEX >= 0x030700A0
12230             return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, args, 2);
12231             #else
12232             return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL);
12233             #endif
12234         }
12235         #if PY_VERSION_HEX >= 0x030700A0
12236         if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
12237             return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL);
12238         #endif
12239     }
12240     return __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2);
12241 }
12242 #endif
12243 static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){
12244     PyObject *args, *result = NULL;
12245     if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
12246 #if CYTHON_COMPILING_IN_CPYTHON
12247     if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
12248         args = PyTuple_New(2);
12249         if (unlikely(!args)) goto bad;
12250         Py_INCREF(arg1);
12251         PyTuple_SET_ITEM(args, 0, arg1);
12252         Py_INCREF(arg2);
12253         PyTuple_SET_ITEM(args, 1, arg2);
12254         if (cfunc->flag & METH_KEYWORDS)
12255             result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
12256         else
12257             result = (*cfunc->func)(self, args);
12258     } else {
12259         args = PyTuple_New(3);
12260         if (unlikely(!args)) goto bad;
12261         Py_INCREF(self);
12262         PyTuple_SET_ITEM(args, 0, self);
12263         Py_INCREF(arg1);
12264         PyTuple_SET_ITEM(args, 1, arg1);
12265         Py_INCREF(arg2);
12266         PyTuple_SET_ITEM(args, 2, arg2);
12267         result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
12268     }
12269 #else
12270     args = PyTuple_Pack(3, self, arg1, arg2);
12271     if (unlikely(!args)) goto bad;
12272     result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
12273 #endif
12274 bad:
12275     Py_XDECREF(args);
12276     return result;
12277 }
12278
12279 /* dict_getitem_default */
12280 static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) {
12281     PyObject* value;
12282 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
12283     value = PyDict_GetItemWithError(d, key);
12284     if (unlikely(!value)) {
12285         if (unlikely(PyErr_Occurred()))
12286             return NULL;
12287         value = default_value;
12288     }
12289     Py_INCREF(value);
12290     if ((1));
12291 #else
12292     if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) {
12293         value = PyDict_GetItem(d, key);
12294         if (unlikely(!value)) {
12295             value = default_value;
12296         }
12297         Py_INCREF(value);
12298     }
12299 #endif
12300     else {
12301         if (default_value == Py_None)
12302             value = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_get, d, key);
12303         else
12304             value = __Pyx_CallUnboundCMethod2(&__pyx_umethod_PyDict_Type_get, d, key, default_value);
12305     }
12306     return value;
12307 }
12308
12309 /* RaiseNoneIterError */
12310 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
12311     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
12312 }
12313
12314 /* PyObject_GenericGetAttrNoDict */
12315 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
12316 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
12317     PyErr_Format(PyExc_AttributeError,
12318 #if PY_MAJOR_VERSION >= 3
12319                  "'%.50s' object has no attribute '%U'",
12320                  tp->tp_name, attr_name);
12321 #else
12322                  "'%.50s' object has no attribute '%.400s'",
12323                  tp->tp_name, PyString_AS_STRING(attr_name));
12324 #endif
12325     return NULL;
12326 }
12327 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
12328     PyObject *descr;
12329     PyTypeObject *tp = Py_TYPE(obj);
12330     if (unlikely(!PyString_Check(attr_name))) {
12331         return PyObject_GenericGetAttr(obj, attr_name);
12332     }
12333     assert(!tp->tp_dictoffset);
12334     descr = _PyType_Lookup(tp, attr_name);
12335     if (unlikely(!descr)) {
12336         return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
12337     }
12338     Py_INCREF(descr);
12339     #if PY_MAJOR_VERSION < 3
12340     if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
12341     #endif
12342     {
12343         descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
12344         if (unlikely(f)) {
12345             PyObject *res = f(descr, obj, (PyObject *)tp);
12346             Py_DECREF(descr);
12347             return res;
12348         }
12349     }
12350     return descr;
12351 }
12352 #endif
12353
12354 /* PyObject_GenericGetAttr */
12355 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
12356 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
12357     if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
12358         return PyObject_GenericGetAttr(obj, attr_name);
12359     }
12360     return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
12361 }
12362 #endif
12363
12364 /* SetVTable */
12365 static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
12366 #if PY_VERSION_HEX >= 0x02070000
12367     PyObject *ob = PyCapsule_New(vtable, 0, 0);
12368 #else
12369     PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
12370 #endif
12371     if (!ob)
12372         goto bad;
12373     if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
12374         goto bad;
12375     Py_DECREF(ob);
12376     return 0;
12377 bad:
12378     Py_XDECREF(ob);
12379     return -1;
12380 }
12381
12382 /* PyObjectGetAttrStrNoError */
12383 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
12384     __Pyx_PyThreadState_declare
12385     __Pyx_PyThreadState_assign
12386     if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
12387         __Pyx_PyErr_Clear();
12388 }
12389 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
12390     PyObject *result;
12391 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
12392     PyTypeObject* tp = Py_TYPE(obj);
12393     if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
12394         return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
12395     }
12396 #endif
12397     result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
12398     if (unlikely(!result)) {
12399         __Pyx_PyObject_GetAttrStr_ClearAttributeError();
12400     }
12401     return result;
12402 }
12403
12404 /* SetupReduce */
12405 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
12406   int ret;
12407   PyObject *name_attr;
12408   name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
12409   if (likely(name_attr)) {
12410       ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
12411   } else {
12412       ret = -1;
12413   }
12414   if (unlikely(ret < 0)) {
12415       PyErr_Clear();
12416       ret = 0;
12417   }
12418   Py_XDECREF(name_attr);
12419   return ret;
12420 }
12421 static int __Pyx_setup_reduce(PyObject* type_obj) {
12422     int ret = 0;
12423     PyObject *object_reduce = NULL;
12424     PyObject *object_reduce_ex = NULL;
12425     PyObject *reduce = NULL;
12426     PyObject *reduce_ex = NULL;
12427     PyObject *reduce_cython = NULL;
12428     PyObject *setstate = NULL;
12429     PyObject *setstate_cython = NULL;
12430 #if CYTHON_USE_PYTYPE_LOOKUP
12431     if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
12432 #else
12433     if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
12434 #endif
12435 #if CYTHON_USE_PYTYPE_LOOKUP
12436     object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
12437 #else
12438     object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
12439 #endif
12440     reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
12441     if (reduce_ex == object_reduce_ex) {
12442 #if CYTHON_USE_PYTYPE_LOOKUP
12443         object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
12444 #else
12445         object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
12446 #endif
12447         reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
12448         if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
12449             reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
12450             if (likely(reduce_cython)) {
12451                 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
12452                 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
12453             } else if (reduce == object_reduce || PyErr_Occurred()) {
12454                 goto __PYX_BAD;
12455             }
12456             setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
12457             if (!setstate) PyErr_Clear();
12458             if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
12459                 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
12460                 if (likely(setstate_cython)) {
12461                     ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
12462                     ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
12463                 } else if (!setstate || PyErr_Occurred()) {
12464                     goto __PYX_BAD;
12465                 }
12466             }
12467             PyType_Modified((PyTypeObject*)type_obj);
12468         }
12469     }
12470     goto __PYX_GOOD;
12471 __PYX_BAD:
12472     if (!PyErr_Occurred())
12473         PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
12474     ret = -1;
12475 __PYX_GOOD:
12476 #if !CYTHON_USE_PYTYPE_LOOKUP
12477     Py_XDECREF(object_reduce);
12478     Py_XDECREF(object_reduce_ex);
12479 #endif
12480     Py_XDECREF(reduce);
12481     Py_XDECREF(reduce_ex);
12482     Py_XDECREF(reduce_cython);
12483     Py_XDECREF(setstate);
12484     Py_XDECREF(setstate_cython);
12485     return ret;
12486 }
12487
12488 /* CalculateMetaclass */
12489 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
12490     Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
12491     for (i=0; i < nbases; i++) {
12492         PyTypeObject *tmptype;
12493         PyObject *tmp = PyTuple_GET_ITEM(bases, i);
12494         tmptype = Py_TYPE(tmp);
12495 #if PY_MAJOR_VERSION < 3
12496         if (tmptype == &PyClass_Type)
12497             continue;
12498 #endif
12499         if (!metaclass) {
12500             metaclass = tmptype;
12501             continue;
12502         }
12503         if (PyType_IsSubtype(metaclass, tmptype))
12504             continue;
12505         if (PyType_IsSubtype(tmptype, metaclass)) {
12506             metaclass = tmptype;
12507             continue;
12508         }
12509         PyErr_SetString(PyExc_TypeError,
12510                         "metaclass conflict: "
12511                         "the metaclass of a derived class "
12512                         "must be a (non-strict) subclass "
12513                         "of the metaclasses of all its bases");
12514         return NULL;
12515     }
12516     if (!metaclass) {
12517 #if PY_MAJOR_VERSION < 3
12518         metaclass = &PyClass_Type;
12519 #else
12520         metaclass = &PyType_Type;
12521 #endif
12522     }
12523     Py_INCREF((PyObject*) metaclass);
12524     return (PyObject*) metaclass;
12525 }
12526
12527 /* Py3ClassCreate */
12528 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
12529                                            PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
12530     PyObject *ns;
12531     if (metaclass) {
12532         PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
12533         if (prep) {
12534             PyObject *pargs = PyTuple_Pack(2, name, bases);
12535             if (unlikely(!pargs)) {
12536                 Py_DECREF(prep);
12537                 return NULL;
12538             }
12539             ns = PyObject_Call(prep, pargs, mkw);
12540             Py_DECREF(prep);
12541             Py_DECREF(pargs);
12542         } else {
12543             if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
12544                 return NULL;
12545             PyErr_Clear();
12546             ns = PyDict_New();
12547         }
12548     } else {
12549         ns = PyDict_New();
12550     }
12551     if (unlikely(!ns))
12552         return NULL;
12553     if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
12554     if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
12555     if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
12556     return ns;
12557 bad:
12558     Py_DECREF(ns);
12559     return NULL;
12560 }
12561 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
12562                                       PyObject *dict, PyObject *mkw,
12563                                       int calculate_metaclass, int allow_py2_metaclass) {
12564     PyObject *result, *margs;
12565     PyObject *owned_metaclass = NULL;
12566     if (allow_py2_metaclass) {
12567         owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
12568         if (owned_metaclass) {
12569             metaclass = owned_metaclass;
12570         } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
12571             PyErr_Clear();
12572         } else {
12573             return NULL;
12574         }
12575     }
12576     if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
12577         metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
12578         Py_XDECREF(owned_metaclass);
12579         if (unlikely(!metaclass))
12580             return NULL;
12581         owned_metaclass = metaclass;
12582     }
12583     margs = PyTuple_Pack(3, name, bases, dict);
12584     if (unlikely(!margs)) {
12585         result = NULL;
12586     } else {
12587         result = PyObject_Call(metaclass, margs, mkw);
12588         Py_DECREF(margs);
12589     }
12590     Py_XDECREF(owned_metaclass);
12591     return result;
12592 }
12593
12594 /* FetchCommonType */
12595 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
12596     PyObject* fake_module;
12597     PyTypeObject* cached_type = NULL;
12598     fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
12599     if (!fake_module) return NULL;
12600     Py_INCREF(fake_module);
12601     cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
12602     if (cached_type) {
12603         if (!PyType_Check((PyObject*)cached_type)) {
12604             PyErr_Format(PyExc_TypeError,
12605                 "Shared Cython type %.200s is not a type object",
12606                 type->tp_name);
12607             goto bad;
12608         }
12609         if (cached_type->tp_basicsize != type->tp_basicsize) {
12610             PyErr_Format(PyExc_TypeError,
12611                 "Shared Cython type %.200s has the wrong size, try recompiling",
12612                 type->tp_name);
12613             goto bad;
12614         }
12615     } else {
12616         if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
12617         PyErr_Clear();
12618         if (PyType_Ready(type) < 0) goto bad;
12619         if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
12620             goto bad;
12621         Py_INCREF(type);
12622         cached_type = type;
12623     }
12624 done:
12625     Py_DECREF(fake_module);
12626     return cached_type;
12627 bad:
12628     Py_XDECREF(cached_type);
12629     cached_type = NULL;
12630     goto done;
12631 }
12632
12633 /* CythonFunctionShared */
12634 #include <structmember.h>
12635 static PyObject *
12636 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
12637 {
12638     if (unlikely(op->func_doc == NULL)) {
12639         if (op->func.m_ml->ml_doc) {
12640 #if PY_MAJOR_VERSION >= 3
12641             op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
12642 #else
12643             op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
12644 #endif
12645             if (unlikely(op->func_doc == NULL))
12646                 return NULL;
12647         } else {
12648             Py_INCREF(Py_None);
12649             return Py_None;
12650         }
12651     }
12652     Py_INCREF(op->func_doc);
12653     return op->func_doc;
12654 }
12655 static int
12656 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
12657 {
12658     PyObject *tmp = op->func_doc;
12659     if (value == NULL) {
12660         value = Py_None;
12661     }
12662     Py_INCREF(value);
12663     op->func_doc = value;
12664     Py_XDECREF(tmp);
12665     return 0;
12666 }
12667 static PyObject *
12668 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
12669 {
12670     if (unlikely(op->func_name == NULL)) {
12671 #if PY_MAJOR_VERSION >= 3
12672         op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
12673 #else
12674         op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
12675 #endif
12676         if (unlikely(op->func_name == NULL))
12677             return NULL;
12678     }
12679     Py_INCREF(op->func_name);
12680     return op->func_name;
12681 }
12682 static int
12683 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
12684 {
12685     PyObject *tmp;
12686 #if PY_MAJOR_VERSION >= 3
12687     if (unlikely(value == NULL || !PyUnicode_Check(value)))
12688 #else
12689     if (unlikely(value == NULL || !PyString_Check(value)))
12690 #endif
12691     {
12692         PyErr_SetString(PyExc_TypeError,
12693                         "__name__ must be set to a string object");
12694         return -1;
12695     }
12696     tmp = op->func_name;
12697     Py_INCREF(value);
12698     op->func_name = value;
12699     Py_XDECREF(tmp);
12700     return 0;
12701 }
12702 static PyObject *
12703 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
12704 {
12705     Py_INCREF(op->func_qualname);
12706     return op->func_qualname;
12707 }
12708 static int
12709 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
12710 {
12711     PyObject *tmp;
12712 #if PY_MAJOR_VERSION >= 3
12713     if (unlikely(value == NULL || !PyUnicode_Check(value)))
12714 #else
12715     if (unlikely(value == NULL || !PyString_Check(value)))
12716 #endif
12717     {
12718         PyErr_SetString(PyExc_TypeError,
12719                         "__qualname__ must be set to a string object");
12720         return -1;
12721     }
12722     tmp = op->func_qualname;
12723     Py_INCREF(value);
12724     op->func_qualname = value;
12725     Py_XDECREF(tmp);
12726     return 0;
12727 }
12728 static PyObject *
12729 __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
12730 {
12731     PyObject *self;
12732     self = m->func_closure;
12733     if (self == NULL)
12734         self = Py_None;
12735     Py_INCREF(self);
12736     return self;
12737 }
12738 static PyObject *
12739 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
12740 {
12741     if (unlikely(op->func_dict == NULL)) {
12742         op->func_dict = PyDict_New();
12743         if (unlikely(op->func_dict == NULL))
12744             return NULL;
12745     }
12746     Py_INCREF(op->func_dict);
12747     return op->func_dict;
12748 }
12749 static int
12750 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
12751 {
12752     PyObject *tmp;
12753     if (unlikely(value == NULL)) {
12754         PyErr_SetString(PyExc_TypeError,
12755                "function's dictionary may not be deleted");
12756         return -1;
12757     }
12758     if (unlikely(!PyDict_Check(value))) {
12759         PyErr_SetString(PyExc_TypeError,
12760                "setting function's dictionary to a non-dict");
12761         return -1;
12762     }
12763     tmp = op->func_dict;
12764     Py_INCREF(value);
12765     op->func_dict = value;
12766     Py_XDECREF(tmp);
12767     return 0;
12768 }
12769 static PyObject *
12770 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
12771 {
12772     Py_INCREF(op->func_globals);
12773     return op->func_globals;
12774 }
12775 static PyObject *
12776 __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
12777 {
12778     Py_INCREF(Py_None);
12779     return Py_None;
12780 }
12781 static PyObject *
12782 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
12783 {
12784     PyObject* result = (op->func_code) ? op->func_code : Py_None;
12785     Py_INCREF(result);
12786     return result;
12787 }
12788 static int
12789 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
12790     int result = 0;
12791     PyObject *res = op->defaults_getter((PyObject *) op);
12792     if (unlikely(!res))
12793         return -1;
12794     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12795     op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
12796     Py_INCREF(op->defaults_tuple);
12797     op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
12798     Py_INCREF(op->defaults_kwdict);
12799     #else
12800     op->defaults_tuple = PySequence_ITEM(res, 0);
12801     if (unlikely(!op->defaults_tuple)) result = -1;
12802     else {
12803         op->defaults_kwdict = PySequence_ITEM(res, 1);
12804         if (unlikely(!op->defaults_kwdict)) result = -1;
12805     }
12806     #endif
12807     Py_DECREF(res);
12808     return result;
12809 }
12810 static int
12811 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
12812     PyObject* tmp;
12813     if (!value) {
12814         value = Py_None;
12815     } else if (value != Py_None && !PyTuple_Check(value)) {
12816         PyErr_SetString(PyExc_TypeError,
12817                         "__defaults__ must be set to a tuple object");
12818         return -1;
12819     }
12820     Py_INCREF(value);
12821     tmp = op->defaults_tuple;
12822     op->defaults_tuple = value;
12823     Py_XDECREF(tmp);
12824     return 0;
12825 }
12826 static PyObject *
12827 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
12828     PyObject* result = op->defaults_tuple;
12829     if (unlikely(!result)) {
12830         if (op->defaults_getter) {
12831             if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
12832             result = op->defaults_tuple;
12833         } else {
12834             result = Py_None;
12835         }
12836     }
12837     Py_INCREF(result);
12838     return result;
12839 }
12840 static int
12841 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
12842     PyObject* tmp;
12843     if (!value) {
12844         value = Py_None;
12845     } else if (value != Py_None && !PyDict_Check(value)) {
12846         PyErr_SetString(PyExc_TypeError,
12847                         "__kwdefaults__ must be set to a dict object");
12848         return -1;
12849     }
12850     Py_INCREF(value);
12851     tmp = op->defaults_kwdict;
12852     op->defaults_kwdict = value;
12853     Py_XDECREF(tmp);
12854     return 0;
12855 }
12856 static PyObject *
12857 __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
12858     PyObject* result = op->defaults_kwdict;
12859     if (unlikely(!result)) {
12860         if (op->defaults_getter) {
12861             if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
12862             result = op->defaults_kwdict;
12863         } else {
12864             result = Py_None;
12865         }
12866     }
12867     Py_INCREF(result);
12868     return result;
12869 }
12870 static int
12871 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
12872     PyObject* tmp;
12873     if (!value || value == Py_None) {
12874         value = NULL;
12875     } else if (!PyDict_Check(value)) {
12876         PyErr_SetString(PyExc_TypeError,
12877                         "__annotations__ must be set to a dict object");
12878         return -1;
12879     }
12880     Py_XINCREF(value);
12881     tmp = op->func_annotations;
12882     op->func_annotations = value;
12883     Py_XDECREF(tmp);
12884     return 0;
12885 }
12886 static PyObject *
12887 __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
12888     PyObject* result = op->func_annotations;
12889     if (unlikely(!result)) {
12890         result = PyDict_New();
12891         if (unlikely(!result)) return NULL;
12892         op->func_annotations = result;
12893     }
12894     Py_INCREF(result);
12895     return result;
12896 }
12897 static PyGetSetDef __pyx_CyFunction_getsets[] = {
12898     {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
12899     {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
12900     {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
12901     {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
12902     {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
12903     {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
12904     {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
12905     {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
12906     {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
12907     {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
12908     {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
12909     {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
12910     {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
12911     {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
12912     {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
12913     {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
12914     {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
12915     {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
12916     {0, 0, 0, 0, 0}
12917 };
12918 static PyMemberDef __pyx_CyFunction_members[] = {
12919     {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
12920     {0, 0, 0,  0, 0}
12921 };
12922 static PyObject *
12923 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
12924 {
12925 #if PY_MAJOR_VERSION >= 3
12926     return PyUnicode_FromString(m->func.m_ml->ml_name);
12927 #else
12928     return PyString_FromString(m->func.m_ml->ml_name);
12929 #endif
12930 }
12931 static PyMethodDef __pyx_CyFunction_methods[] = {
12932     {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
12933     {0, 0, 0, 0}
12934 };
12935 #if PY_VERSION_HEX < 0x030500A0
12936 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
12937 #else
12938 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
12939 #endif
12940 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
12941                                        PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
12942     if (unlikely(op == NULL))
12943         return NULL;
12944     op->flags = flags;
12945     __Pyx_CyFunction_weakreflist(op) = NULL;
12946     op->func.m_ml = ml;
12947     op->func.m_self = (PyObject *) op;
12948     Py_XINCREF(closure);
12949     op->func_closure = closure;
12950     Py_XINCREF(module);
12951     op->func.m_module = module;
12952     op->func_dict = NULL;
12953     op->func_name = NULL;
12954     Py_INCREF(qualname);
12955     op->func_qualname = qualname;
12956     op->func_doc = NULL;
12957     op->func_classobj = NULL;
12958     op->func_globals = globals;
12959     Py_INCREF(op->func_globals);
12960     Py_XINCREF(code);
12961     op->func_code = code;
12962     op->defaults_pyobjects = 0;
12963     op->defaults_size = 0;
12964     op->defaults = NULL;
12965     op->defaults_tuple = NULL;
12966     op->defaults_kwdict = NULL;
12967     op->defaults_getter = NULL;
12968     op->func_annotations = NULL;
12969     return (PyObject *) op;
12970 }
12971 static int
12972 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
12973 {
12974     Py_CLEAR(m->func_closure);
12975     Py_CLEAR(m->func.m_module);
12976     Py_CLEAR(m->func_dict);
12977     Py_CLEAR(m->func_name);
12978     Py_CLEAR(m->func_qualname);
12979     Py_CLEAR(m->func_doc);
12980     Py_CLEAR(m->func_globals);
12981     Py_CLEAR(m->func_code);
12982     Py_CLEAR(m->func_classobj);
12983     Py_CLEAR(m->defaults_tuple);
12984     Py_CLEAR(m->defaults_kwdict);
12985     Py_CLEAR(m->func_annotations);
12986     if (m->defaults) {
12987         PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
12988         int i;
12989         for (i = 0; i < m->defaults_pyobjects; i++)
12990             Py_XDECREF(pydefaults[i]);
12991         PyObject_Free(m->defaults);
12992         m->defaults = NULL;
12993     }
12994     return 0;
12995 }
12996 static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
12997 {
12998     if (__Pyx_CyFunction_weakreflist(m) != NULL)
12999         PyObject_ClearWeakRefs((PyObject *) m);
13000     __Pyx_CyFunction_clear(m);
13001     PyObject_GC_Del(m);
13002 }
13003 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
13004 {
13005     PyObject_GC_UnTrack(m);
13006     __Pyx__CyFunction_dealloc(m);
13007 }
13008 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
13009 {
13010     Py_VISIT(m->func_closure);
13011     Py_VISIT(m->func.m_module);
13012     Py_VISIT(m->func_dict);
13013     Py_VISIT(m->func_name);
13014     Py_VISIT(m->func_qualname);
13015     Py_VISIT(m->func_doc);
13016     Py_VISIT(m->func_globals);
13017     Py_VISIT(m->func_code);
13018     Py_VISIT(m->func_classobj);
13019     Py_VISIT(m->defaults_tuple);
13020     Py_VISIT(m->defaults_kwdict);
13021     if (m->defaults) {
13022         PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
13023         int i;
13024         for (i = 0; i < m->defaults_pyobjects; i++)
13025             Py_VISIT(pydefaults[i]);
13026     }
13027     return 0;
13028 }
13029 static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
13030 {
13031     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
13032     if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
13033         Py_INCREF(func);
13034         return func;
13035     }
13036     if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
13037         if (type == NULL)
13038             type = (PyObject *)(Py_TYPE(obj));
13039         return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
13040     }
13041     if (obj == Py_None)
13042         obj = NULL;
13043     return __Pyx_PyMethod_New(func, obj, type);
13044 }
13045 static PyObject*
13046 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
13047 {
13048 #if PY_MAJOR_VERSION >= 3
13049     return PyUnicode_FromFormat("<cyfunction %U at %p>",
13050                                 op->func_qualname, (void *)op);
13051 #else
13052     return PyString_FromFormat("<cyfunction %s at %p>",
13053                                PyString_AsString(op->func_qualname), (void *)op);
13054 #endif
13055 }
13056 static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
13057     PyCFunctionObject* f = (PyCFunctionObject*)func;
13058     PyCFunction meth = f->m_ml->ml_meth;
13059     Py_ssize_t size;
13060     switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
13061     case METH_VARARGS:
13062         if (likely(kw == NULL || PyDict_Size(kw) == 0))
13063             return (*meth)(self, arg);
13064         break;
13065     case METH_VARARGS | METH_KEYWORDS:
13066         return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
13067     case METH_NOARGS:
13068         if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
13069             size = PyTuple_GET_SIZE(arg);
13070             if (likely(size == 0))
13071                 return (*meth)(self, NULL);
13072             PyErr_Format(PyExc_TypeError,
13073                 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
13074                 f->m_ml->ml_name, size);
13075             return NULL;
13076         }
13077         break;
13078     case METH_O:
13079         if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
13080             size = PyTuple_GET_SIZE(arg);
13081             if (likely(size == 1)) {
13082                 PyObject *result, *arg0;
13083                 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13084                 arg0 = PyTuple_GET_ITEM(arg, 0);
13085                 #else
13086                 arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
13087                 #endif
13088                 result = (*meth)(self, arg0);
13089                 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
13090                 Py_DECREF(arg0);
13091                 #endif
13092                 return result;
13093             }
13094             PyErr_Format(PyExc_TypeError,
13095                 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
13096                 f->m_ml->ml_name, size);
13097             return NULL;
13098         }
13099         break;
13100     default:
13101         PyErr_SetString(PyExc_SystemError, "Bad call flags in "
13102                         "__Pyx_CyFunction_Call. METH_OLDARGS is no "
13103                         "longer supported!");
13104         return NULL;
13105     }
13106     PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
13107                  f->m_ml->ml_name);
13108     return NULL;
13109 }
13110 static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
13111     return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
13112 }
13113 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
13114     PyObject *result;
13115     __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
13116     if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
13117         Py_ssize_t argc;
13118         PyObject *new_args;
13119         PyObject *self;
13120         argc = PyTuple_GET_SIZE(args);
13121         new_args = PyTuple_GetSlice(args, 1, argc);
13122         if (unlikely(!new_args))
13123             return NULL;
13124         self = PyTuple_GetItem(args, 0);
13125         if (unlikely(!self)) {
13126             Py_DECREF(new_args);
13127             return NULL;
13128         }
13129         result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
13130         Py_DECREF(new_args);
13131     } else {
13132         result = __Pyx_CyFunction_Call(func, args, kw);
13133     }
13134     return result;
13135 }
13136 static PyTypeObject __pyx_CyFunctionType_type = {
13137     PyVarObject_HEAD_INIT(0, 0)
13138     "cython_function_or_method",
13139     sizeof(__pyx_CyFunctionObject),
13140     0,
13141     (destructor) __Pyx_CyFunction_dealloc,
13142     0,
13143     0,
13144     0,
13145 #if PY_MAJOR_VERSION < 3
13146     0,
13147 #else
13148     0,
13149 #endif
13150     (reprfunc) __Pyx_CyFunction_repr,
13151     0,
13152     0,
13153     0,
13154     0,
13155     __Pyx_CyFunction_CallAsMethod,
13156     0,
13157     0,
13158     0,
13159     0,
13160     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
13161     0,
13162     (traverseproc) __Pyx_CyFunction_traverse,
13163     (inquiry) __Pyx_CyFunction_clear,
13164     0,
13165 #if PY_VERSION_HEX < 0x030500A0
13166     offsetof(__pyx_CyFunctionObject, func_weakreflist),
13167 #else
13168     offsetof(PyCFunctionObject, m_weakreflist),
13169 #endif
13170     0,
13171     0,
13172     __pyx_CyFunction_methods,
13173     __pyx_CyFunction_members,
13174     __pyx_CyFunction_getsets,
13175     0,
13176     0,
13177     __Pyx_CyFunction_descr_get,
13178     0,
13179     offsetof(__pyx_CyFunctionObject, func_dict),
13180     0,
13181     0,
13182     0,
13183     0,
13184     0,
13185     0,
13186     0,
13187     0,
13188     0,
13189     0,
13190     0,
13191     0,
13192 #if PY_VERSION_HEX >= 0x030400a1
13193     0,
13194 #endif
13195 #if PY_VERSION_HEX >= 0x030800b1
13196     0,
13197 #endif
13198 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
13199     0,
13200 #endif
13201 };
13202 static int __pyx_CyFunction_init(void) {
13203     __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
13204     if (unlikely(__pyx_CyFunctionType == NULL)) {
13205         return -1;
13206     }
13207     return 0;
13208 }
13209 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
13210     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
13211     m->defaults = PyObject_Malloc(size);
13212     if (unlikely(!m->defaults))
13213         return PyErr_NoMemory();
13214     memset(m->defaults, 0, size);
13215     m->defaults_pyobjects = pyobjects;
13216     m->defaults_size = size;
13217     return m->defaults;
13218 }
13219 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
13220     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
13221     m->defaults_tuple = tuple;
13222     Py_INCREF(tuple);
13223 }
13224 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
13225     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
13226     m->defaults_kwdict = dict;
13227     Py_INCREF(dict);
13228 }
13229 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
13230     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
13231     m->func_annotations = dict;
13232     Py_INCREF(dict);
13233 }
13234
13235 /* CythonFunction */
13236 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
13237                                       PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
13238     PyObject *op = __Pyx_CyFunction_Init(
13239         PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
13240         ml, flags, qualname, closure, module, globals, code
13241     );
13242     if (likely(op)) {
13243         PyObject_GC_Track(op);
13244     }
13245     return op;
13246 }
13247
13248 /* RegisterModuleCleanup */
13249 #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
13250 static PyObject* __pyx_module_cleanup_atexit(PyObject *module, CYTHON_UNUSED PyObject *unused) {
13251     __pyx_module_cleanup(module);
13252     Py_INCREF(Py_None); return Py_None;
13253 }
13254 static int __Pyx_RegisterCleanup(void) {
13255     static PyMethodDef cleanup_def = {
13256         "__cleanup", (PyCFunction)__pyx_module_cleanup_atexit, METH_NOARGS, 0};
13257     PyObject *cleanup_func = 0;
13258     PyObject *atexit = 0;
13259     PyObject *reg = 0;
13260     PyObject *args = 0;
13261     PyObject *res = 0;
13262     int ret = -1;
13263     cleanup_func = PyCFunction_New(&cleanup_def, 0);
13264     if (!cleanup_func)
13265         goto bad;
13266     atexit = PyImport_ImportModule("atexit");
13267     if (!atexit)
13268         goto bad;
13269     reg = PyObject_GetAttrString(atexit, "_exithandlers");
13270     if (reg && PyList_Check(reg)) {
13271         PyObject *a, *kw;
13272         a = PyTuple_New(0);
13273         kw = PyDict_New();
13274         if (!a || !kw) {
13275             Py_XDECREF(a);
13276             Py_XDECREF(kw);
13277             goto bad;
13278         }
13279         args = PyTuple_Pack(3, cleanup_func, a, kw);
13280         Py_DECREF(a);
13281         Py_DECREF(kw);
13282         if (!args)
13283             goto bad;
13284         ret = PyList_Insert(reg, 0, args);
13285     } else {
13286         if (!reg)
13287             PyErr_Clear();
13288         Py_XDECREF(reg);
13289         reg = PyObject_GetAttrString(atexit, "register");
13290         if (!reg)
13291             goto bad;
13292         args = PyTuple_Pack(1, cleanup_func);
13293         if (!args)
13294             goto bad;
13295         res = PyObject_CallObject(reg, args);
13296         if (!res)
13297             goto bad;
13298         ret = 0;
13299     }
13300 bad:
13301     Py_XDECREF(cleanup_func);
13302     Py_XDECREF(atexit);
13303     Py_XDECREF(reg);
13304     Py_XDECREF(args);
13305     Py_XDECREF(res);
13306     return ret;
13307 }
13308 #endif
13309
13310 /* CLineInTraceback */
13311 #ifndef CYTHON_CLINE_IN_TRACEBACK
13312 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
13313     PyObject *use_cline;
13314     PyObject *ptype, *pvalue, *ptraceback;
13315 #if CYTHON_COMPILING_IN_CPYTHON
13316     PyObject **cython_runtime_dict;
13317 #endif
13318     if (unlikely(!__pyx_cython_runtime)) {
13319         return c_line;
13320     }
13321     __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
13322 #if CYTHON_COMPILING_IN_CPYTHON
13323     cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
13324     if (likely(cython_runtime_dict)) {
13325         __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
13326             use_cline, *cython_runtime_dict,
13327             __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
13328     } else
13329 #endif
13330     {
13331       PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
13332       if (use_cline_obj) {
13333         use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
13334         Py_DECREF(use_cline_obj);
13335       } else {
13336         PyErr_Clear();
13337         use_cline = NULL;
13338       }
13339     }
13340     if (!use_cline) {
13341         c_line = 0;
13342         PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
13343     }
13344     else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
13345         c_line = 0;
13346     }
13347     __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
13348     return c_line;
13349 }
13350 #endif
13351
13352 /* CodeObjectCache */
13353 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
13354     int start = 0, mid = 0, end = count - 1;
13355     if (end >= 0 && code_line > entries[end].code_line) {
13356         return count;
13357     }
13358     while (start < end) {
13359         mid = start + (end - start) / 2;
13360         if (code_line < entries[mid].code_line) {
13361             end = mid;
13362         } else if (code_line > entries[mid].code_line) {
13363              start = mid + 1;
13364         } else {
13365             return mid;
13366         }
13367     }
13368     if (code_line <= entries[mid].code_line) {
13369         return mid;
13370     } else {
13371         return mid + 1;
13372     }
13373 }
13374 static PyCodeObject *__pyx_find_code_object(int code_line) {
13375     PyCodeObject* code_object;
13376     int pos;
13377     if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
13378         return NULL;
13379     }
13380     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
13381     if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
13382         return NULL;
13383     }
13384     code_object = __pyx_code_cache.entries[pos].code_object;
13385     Py_INCREF(code_object);
13386     return code_object;
13387 }
13388 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
13389     int pos, i;
13390     __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
13391     if (unlikely(!code_line)) {
13392         return;
13393     }
13394     if (unlikely(!entries)) {
13395         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
13396         if (likely(entries)) {
13397             __pyx_code_cache.entries = entries;
13398             __pyx_code_cache.max_count = 64;
13399             __pyx_code_cache.count = 1;
13400             entries[0].code_line = code_line;
13401             entries[0].code_object = code_object;
13402             Py_INCREF(code_object);
13403         }
13404         return;
13405     }
13406     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
13407     if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
13408         PyCodeObject* tmp = entries[pos].code_object;
13409         entries[pos].code_object = code_object;
13410         Py_DECREF(tmp);
13411         return;
13412     }
13413     if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
13414         int new_max = __pyx_code_cache.max_count + 64;
13415         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
13416             __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
13417         if (unlikely(!entries)) {
13418             return;
13419         }
13420         __pyx_code_cache.entries = entries;
13421         __pyx_code_cache.max_count = new_max;
13422     }
13423     for (i=__pyx_code_cache.count; i>pos; i--) {
13424         entries[i] = entries[i-1];
13425     }
13426     entries[pos].code_line = code_line;
13427     entries[pos].code_object = code_object;
13428     __pyx_code_cache.count++;
13429     Py_INCREF(code_object);
13430 }
13431
13432 /* AddTraceback */
13433 #include "compile.h"
13434 #include "frameobject.h"
13435 #include "traceback.h"
13436 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
13437             const char *funcname, int c_line,
13438             int py_line, const char *filename) {
13439     PyCodeObject *py_code = 0;
13440     PyObject *py_srcfile = 0;
13441     PyObject *py_funcname = 0;
13442     #if PY_MAJOR_VERSION < 3
13443     py_srcfile = PyString_FromString(filename);
13444     #else
13445     py_srcfile = PyUnicode_FromString(filename);
13446     #endif
13447     if (!py_srcfile) goto bad;
13448     if (c_line) {
13449         #if PY_MAJOR_VERSION < 3
13450         py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
13451         #else
13452         py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
13453         #endif
13454     }
13455     else {
13456         #if PY_MAJOR_VERSION < 3
13457         py_funcname = PyString_FromString(funcname);
13458         #else
13459         py_funcname = PyUnicode_FromString(funcname);
13460         #endif
13461     }
13462     if (!py_funcname) goto bad;
13463     py_code = __Pyx_PyCode_New(
13464         0,
13465         0,
13466         0,
13467         0,
13468         0,
13469         __pyx_empty_bytes, /*PyObject *code,*/
13470         __pyx_empty_tuple, /*PyObject *consts,*/
13471         __pyx_empty_tuple, /*PyObject *names,*/
13472         __pyx_empty_tuple, /*PyObject *varnames,*/
13473         __pyx_empty_tuple, /*PyObject *freevars,*/
13474         __pyx_empty_tuple, /*PyObject *cellvars,*/
13475         py_srcfile,   /*PyObject *filename,*/
13476         py_funcname,  /*PyObject *name,*/
13477         py_line,
13478         __pyx_empty_bytes  /*PyObject *lnotab*/
13479     );
13480     Py_DECREF(py_srcfile);
13481     Py_DECREF(py_funcname);
13482     return py_code;
13483 bad:
13484     Py_XDECREF(py_srcfile);
13485     Py_XDECREF(py_funcname);
13486     return NULL;
13487 }
13488 static void __Pyx_AddTraceback(const char *funcname, int c_line,
13489                                int py_line, const char *filename) {
13490     PyCodeObject *py_code = 0;
13491     PyFrameObject *py_frame = 0;
13492     PyThreadState *tstate = __Pyx_PyThreadState_Current;
13493     if (c_line) {
13494         c_line = __Pyx_CLineForTraceback(tstate, c_line);
13495     }
13496     py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
13497     if (!py_code) {
13498         py_code = __Pyx_CreateCodeObjectForTraceback(
13499             funcname, c_line, py_line, filename);
13500         if (!py_code) goto bad;
13501         __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
13502     }
13503     py_frame = PyFrame_New(
13504         tstate,            /*PyThreadState *tstate,*/
13505         py_code,           /*PyCodeObject *code,*/
13506         __pyx_d,    /*PyObject *globals,*/
13507         0                  /*PyObject *locals*/
13508     );
13509     if (!py_frame) goto bad;
13510     __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
13511     PyTraceBack_Here(py_frame);
13512 bad:
13513     Py_XDECREF(py_code);
13514     Py_XDECREF(py_frame);
13515 }
13516
13517 /* CIntFromPyVerify */
13518 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
13519     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
13520 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
13521     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
13522 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
13523     {\
13524         func_type value = func_value;\
13525         if (sizeof(target_type) < sizeof(func_type)) {\
13526             if (unlikely(value != (func_type) (target_type) value)) {\
13527                 func_type zero = 0;\
13528                 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
13529                     return (target_type) -1;\
13530                 if (is_unsigned && unlikely(value < zero))\
13531                     goto raise_neg_overflow;\
13532                 else\
13533                     goto raise_overflow;\
13534             }\
13535         }\
13536         return (target_type) value;\
13537     }
13538
13539 /* CIntToPy */
13540 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
13541     const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
13542     const int is_unsigned = neg_one > const_zero;
13543     if (is_unsigned) {
13544         if (sizeof(long) < sizeof(long)) {
13545             return PyInt_FromLong((long) value);
13546         } else if (sizeof(long) <= sizeof(unsigned long)) {
13547             return PyLong_FromUnsignedLong((unsigned long) value);
13548 #ifdef HAVE_LONG_LONG
13549         } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
13550             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
13551 #endif
13552         }
13553     } else {
13554         if (sizeof(long) <= sizeof(long)) {
13555             return PyInt_FromLong((long) value);
13556 #ifdef HAVE_LONG_LONG
13557         } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
13558             return PyLong_FromLongLong((PY_LONG_LONG) value);
13559 #endif
13560         }
13561     }
13562     {
13563         int one = 1; int little = (int)*(unsigned char *)&one;
13564         unsigned char *bytes = (unsigned char *)&value;
13565         return _PyLong_FromByteArray(bytes, sizeof(long),
13566                                      little, !is_unsigned);
13567     }
13568 }
13569
13570 /* CIntFromPy */
13571 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
13572     const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
13573     const int is_unsigned = neg_one > const_zero;
13574 #if PY_MAJOR_VERSION < 3
13575     if (likely(PyInt_Check(x))) {
13576         if (sizeof(long) < sizeof(long)) {
13577             __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
13578         } else {
13579             long val = PyInt_AS_LONG(x);
13580             if (is_unsigned && unlikely(val < 0)) {
13581                 goto raise_neg_overflow;
13582             }
13583             return (long) val;
13584         }
13585     } else
13586 #endif
13587     if (likely(PyLong_Check(x))) {
13588         if (is_unsigned) {
13589 #if CYTHON_USE_PYLONG_INTERNALS
13590             const digit* digits = ((PyLongObject*)x)->ob_digit;
13591             switch (Py_SIZE(x)) {
13592                 case  0: return (long) 0;
13593                 case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
13594                 case 2:
13595                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
13596                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13597                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13598                         } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
13599                             return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
13600                         }
13601                     }
13602                     break;
13603                 case 3:
13604                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
13605                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13606                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13607                         } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
13608                             return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
13609                         }
13610                     }
13611                     break;
13612                 case 4:
13613                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
13614                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13615                             __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])))
13616                         } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
13617                             return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
13618                         }
13619                     }
13620                     break;
13621             }
13622 #endif
13623 #if CYTHON_COMPILING_IN_CPYTHON
13624             if (unlikely(Py_SIZE(x) < 0)) {
13625                 goto raise_neg_overflow;
13626             }
13627 #else
13628             {
13629                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
13630                 if (unlikely(result < 0))
13631                     return (long) -1;
13632                 if (unlikely(result == 1))
13633                     goto raise_neg_overflow;
13634             }
13635 #endif
13636             if (sizeof(long) <= sizeof(unsigned long)) {
13637                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
13638 #ifdef HAVE_LONG_LONG
13639             } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
13640                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
13641 #endif
13642             }
13643         } else {
13644 #if CYTHON_USE_PYLONG_INTERNALS
13645             const digit* digits = ((PyLongObject*)x)->ob_digit;
13646             switch (Py_SIZE(x)) {
13647                 case  0: return (long) 0;
13648                 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
13649                 case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
13650                 case -2:
13651                     if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
13652                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13653                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13654                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
13655                             return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
13656                         }
13657                     }
13658                     break;
13659                 case 2:
13660                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
13661                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13662                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13663                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
13664                             return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
13665                         }
13666                     }
13667                     break;
13668                 case -3:
13669                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
13670                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13671                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13672                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
13673                             return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
13674                         }
13675                     }
13676                     break;
13677                 case 3:
13678                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
13679                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13680                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13681                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
13682                             return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
13683                         }
13684                     }
13685                     break;
13686                 case -4:
13687                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
13688                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13689                             __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])))
13690                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
13691                             return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
13692                         }
13693                     }
13694                     break;
13695                 case 4:
13696                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
13697                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13698                             __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])))
13699                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
13700                             return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
13701                         }
13702                     }
13703                     break;
13704             }
13705 #endif
13706             if (sizeof(long) <= sizeof(long)) {
13707                 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
13708 #ifdef HAVE_LONG_LONG
13709             } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
13710                 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
13711 #endif
13712             }
13713         }
13714         {
13715 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
13716             PyErr_SetString(PyExc_RuntimeError,
13717                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
13718 #else
13719             long val;
13720             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
13721  #if PY_MAJOR_VERSION < 3
13722             if (likely(v) && !PyLong_Check(v)) {
13723                 PyObject *tmp = v;
13724                 v = PyNumber_Long(tmp);
13725                 Py_DECREF(tmp);
13726             }
13727  #endif
13728             if (likely(v)) {
13729                 int one = 1; int is_little = (int)*(unsigned char *)&one;
13730                 unsigned char *bytes = (unsigned char *)&val;
13731                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
13732                                               bytes, sizeof(val),
13733                                               is_little, !is_unsigned);
13734                 Py_DECREF(v);
13735                 if (likely(!ret))
13736                     return val;
13737             }
13738 #endif
13739             return (long) -1;
13740         }
13741     } else {
13742         long val;
13743         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
13744         if (!tmp) return (long) -1;
13745         val = __Pyx_PyInt_As_long(tmp);
13746         Py_DECREF(tmp);
13747         return val;
13748     }
13749 raise_overflow:
13750     PyErr_SetString(PyExc_OverflowError,
13751         "value too large to convert to long");
13752     return (long) -1;
13753 raise_neg_overflow:
13754     PyErr_SetString(PyExc_OverflowError,
13755         "can't convert negative value to long");
13756     return (long) -1;
13757 }
13758
13759 /* CIntFromPy */
13760 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
13761     const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
13762     const int is_unsigned = neg_one > const_zero;
13763 #if PY_MAJOR_VERSION < 3
13764     if (likely(PyInt_Check(x))) {
13765         if (sizeof(int) < sizeof(long)) {
13766             __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
13767         } else {
13768             long val = PyInt_AS_LONG(x);
13769             if (is_unsigned && unlikely(val < 0)) {
13770                 goto raise_neg_overflow;
13771             }
13772             return (int) val;
13773         }
13774     } else
13775 #endif
13776     if (likely(PyLong_Check(x))) {
13777         if (is_unsigned) {
13778 #if CYTHON_USE_PYLONG_INTERNALS
13779             const digit* digits = ((PyLongObject*)x)->ob_digit;
13780             switch (Py_SIZE(x)) {
13781                 case  0: return (int) 0;
13782                 case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
13783                 case 2:
13784                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
13785                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13786                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13787                         } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
13788                             return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
13789                         }
13790                     }
13791                     break;
13792                 case 3:
13793                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
13794                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13795                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13796                         } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
13797                             return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
13798                         }
13799                     }
13800                     break;
13801                 case 4:
13802                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
13803                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13804                             __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])))
13805                         } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
13806                             return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
13807                         }
13808                     }
13809                     break;
13810             }
13811 #endif
13812 #if CYTHON_COMPILING_IN_CPYTHON
13813             if (unlikely(Py_SIZE(x) < 0)) {
13814                 goto raise_neg_overflow;
13815             }
13816 #else
13817             {
13818                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
13819                 if (unlikely(result < 0))
13820                     return (int) -1;
13821                 if (unlikely(result == 1))
13822                     goto raise_neg_overflow;
13823             }
13824 #endif
13825             if (sizeof(int) <= sizeof(unsigned long)) {
13826                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
13827 #ifdef HAVE_LONG_LONG
13828             } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
13829                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
13830 #endif
13831             }
13832         } else {
13833 #if CYTHON_USE_PYLONG_INTERNALS
13834             const digit* digits = ((PyLongObject*)x)->ob_digit;
13835             switch (Py_SIZE(x)) {
13836                 case  0: return (int) 0;
13837                 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
13838                 case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
13839                 case -2:
13840                     if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
13841                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13842                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13843                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
13844                             return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13845                         }
13846                     }
13847                     break;
13848                 case 2:
13849                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
13850                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13851                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13852                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
13853                             return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13854                         }
13855                     }
13856                     break;
13857                 case -3:
13858                     if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
13859                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13860                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13861                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
13862                             return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13863                         }
13864                     }
13865                     break;
13866                 case 3:
13867                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
13868                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13869                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13870                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
13871                             return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13872                         }
13873                     }
13874                     break;
13875                 case -4:
13876                     if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
13877                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13878                             __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])))
13879                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
13880                             return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13881                         }
13882                     }
13883                     break;
13884                 case 4:
13885                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
13886                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13887                             __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])))
13888                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
13889                             return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13890                         }
13891                     }
13892                     break;
13893             }
13894 #endif
13895             if (sizeof(int) <= sizeof(long)) {
13896                 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
13897 #ifdef HAVE_LONG_LONG
13898             } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
13899                 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
13900 #endif
13901             }
13902         }
13903         {
13904 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
13905             PyErr_SetString(PyExc_RuntimeError,
13906                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
13907 #else
13908             int val;
13909             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
13910  #if PY_MAJOR_VERSION < 3
13911             if (likely(v) && !PyLong_Check(v)) {
13912                 PyObject *tmp = v;
13913                 v = PyNumber_Long(tmp);
13914                 Py_DECREF(tmp);
13915             }
13916  #endif
13917             if (likely(v)) {
13918                 int one = 1; int is_little = (int)*(unsigned char *)&one;
13919                 unsigned char *bytes = (unsigned char *)&val;
13920                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
13921                                               bytes, sizeof(val),
13922                                               is_little, !is_unsigned);
13923                 Py_DECREF(v);
13924                 if (likely(!ret))
13925                     return val;
13926             }
13927 #endif
13928             return (int) -1;
13929         }
13930     } else {
13931         int val;
13932         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
13933         if (!tmp) return (int) -1;
13934         val = __Pyx_PyInt_As_int(tmp);
13935         Py_DECREF(tmp);
13936         return val;
13937     }
13938 raise_overflow:
13939     PyErr_SetString(PyExc_OverflowError,
13940         "value too large to convert to int");
13941     return (int) -1;
13942 raise_neg_overflow:
13943     PyErr_SetString(PyExc_OverflowError,
13944         "can't convert negative value to int");
13945     return (int) -1;
13946 }
13947
13948 /* FastTypeChecks */
13949 #if CYTHON_COMPILING_IN_CPYTHON
13950 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
13951     while (a) {
13952         a = a->tp_base;
13953         if (a == b)
13954             return 1;
13955     }
13956     return b == &PyBaseObject_Type;
13957 }
13958 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
13959     PyObject *mro;
13960     if (a == b) return 1;
13961     mro = a->tp_mro;
13962     if (likely(mro)) {
13963         Py_ssize_t i, n;
13964         n = PyTuple_GET_SIZE(mro);
13965         for (i = 0; i < n; i++) {
13966             if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
13967                 return 1;
13968         }
13969         return 0;
13970     }
13971     return __Pyx_InBases(a, b);
13972 }
13973 #if PY_MAJOR_VERSION == 2
13974 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
13975     PyObject *exception, *value, *tb;
13976     int res;
13977     __Pyx_PyThreadState_declare
13978     __Pyx_PyThreadState_assign
13979     __Pyx_ErrFetch(&exception, &value, &tb);
13980     res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
13981     if (unlikely(res == -1)) {
13982         PyErr_WriteUnraisable(err);
13983         res = 0;
13984     }
13985     if (!res) {
13986         res = PyObject_IsSubclass(err, exc_type2);
13987         if (unlikely(res == -1)) {
13988             PyErr_WriteUnraisable(err);
13989             res = 0;
13990         }
13991     }
13992     __Pyx_ErrRestore(exception, value, tb);
13993     return res;
13994 }
13995 #else
13996 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
13997     int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
13998     if (!res) {
13999         res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
14000     }
14001     return res;
14002 }
14003 #endif
14004 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
14005     Py_ssize_t i, n;
14006     assert(PyExceptionClass_Check(exc_type));
14007     n = PyTuple_GET_SIZE(tuple);
14008 #if PY_MAJOR_VERSION >= 3
14009     for (i=0; i<n; i++) {
14010         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
14011     }
14012 #endif
14013     for (i=0; i<n; i++) {
14014         PyObject *t = PyTuple_GET_ITEM(tuple, i);
14015         #if PY_MAJOR_VERSION < 3
14016         if (likely(exc_type == t)) return 1;
14017         #endif
14018         if (likely(PyExceptionClass_Check(t))) {
14019             if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
14020         } else {
14021         }
14022     }
14023     return 0;
14024 }
14025 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
14026     if (likely(err == exc_type)) return 1;
14027     if (likely(PyExceptionClass_Check(err))) {
14028         if (likely(PyExceptionClass_Check(exc_type))) {
14029             return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
14030         } else if (likely(PyTuple_Check(exc_type))) {
14031             return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
14032         } else {
14033         }
14034     }
14035     return PyErr_GivenExceptionMatches(err, exc_type);
14036 }
14037 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
14038     assert(PyExceptionClass_Check(exc_type1));
14039     assert(PyExceptionClass_Check(exc_type2));
14040     if (likely(err == exc_type1 || err == exc_type2)) return 1;
14041     if (likely(PyExceptionClass_Check(err))) {
14042         return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
14043     }
14044     return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
14045 }
14046 #endif
14047
14048 /* CheckBinaryVersion */
14049 static int __Pyx_check_binary_version(void) {
14050     char ctversion[4], rtversion[4];
14051     PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
14052     PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
14053     if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
14054         char message[200];
14055         PyOS_snprintf(message, sizeof(message),
14056                       "compiletime version %s of module '%.100s' "
14057                       "does not match runtime version %s",
14058                       ctversion, __Pyx_MODULE_NAME, rtversion);
14059         return PyErr_WarnEx(NULL, message, 1);
14060     }
14061     return 0;
14062 }
14063
14064 /* FunctionExport */
14065 static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
14066     PyObject *d = 0;
14067     PyObject *cobj = 0;
14068     union {
14069         void (*fp)(void);
14070         void *p;
14071     } tmp;
14072     d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
14073     if (!d) {
14074         PyErr_Clear();
14075         d = PyDict_New();
14076         if (!d)
14077             goto bad;
14078         Py_INCREF(d);
14079         if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
14080             goto bad;
14081     }
14082     tmp.fp = f;
14083 #if PY_VERSION_HEX >= 0x02070000
14084     cobj = PyCapsule_New(tmp.p, sig, 0);
14085 #else
14086     cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0);
14087 #endif
14088     if (!cobj)
14089         goto bad;
14090     if (PyDict_SetItemString(d, name, cobj) < 0)
14091         goto bad;
14092     Py_DECREF(cobj);
14093     Py_DECREF(d);
14094     return 0;
14095 bad:
14096     Py_XDECREF(cobj);
14097     Py_XDECREF(d);
14098     return -1;
14099 }
14100
14101 /* InitStrings */
14102 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
14103     while (t->p) {
14104         #if PY_MAJOR_VERSION < 3
14105         if (t->is_unicode) {
14106             *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
14107         } else if (t->intern) {
14108             *t->p = PyString_InternFromString(t->s);
14109         } else {
14110             *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
14111         }
14112         #else
14113         if (t->is_unicode | t->is_str) {
14114             if (t->intern) {
14115                 *t->p = PyUnicode_InternFromString(t->s);
14116             } else if (t->encoding) {
14117                 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
14118             } else {
14119                 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
14120             }
14121         } else {
14122             *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
14123         }
14124         #endif
14125         if (!*t->p)
14126             return -1;
14127         if (PyObject_Hash(*t->p) == -1)
14128             return -1;
14129         ++t;
14130     }
14131     return 0;
14132 }
14133
14134 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
14135     return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
14136 }
14137 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
14138     Py_ssize_t ignore;
14139     return __Pyx_PyObject_AsStringAndSize(o, &ignore);
14140 }
14141 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
14142 #if !CYTHON_PEP393_ENABLED
14143 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
14144     char* defenc_c;
14145     PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
14146     if (!defenc) return NULL;
14147     defenc_c = PyBytes_AS_STRING(defenc);
14148 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
14149     {
14150         char* end = defenc_c + PyBytes_GET_SIZE(defenc);
14151         char* c;
14152         for (c = defenc_c; c < end; c++) {
14153             if ((unsigned char) (*c) >= 128) {
14154                 PyUnicode_AsASCIIString(o);
14155                 return NULL;
14156             }
14157         }
14158     }
14159 #endif
14160     *length = PyBytes_GET_SIZE(defenc);
14161     return defenc_c;
14162 }
14163 #else
14164 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
14165     if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
14166 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
14167     if (likely(PyUnicode_IS_ASCII(o))) {
14168         *length = PyUnicode_GET_LENGTH(o);
14169         return PyUnicode_AsUTF8(o);
14170     } else {
14171         PyUnicode_AsASCIIString(o);
14172         return NULL;
14173     }
14174 #else
14175     return PyUnicode_AsUTF8AndSize(o, length);
14176 #endif
14177 }
14178 #endif
14179 #endif
14180 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
14181 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
14182     if (
14183 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
14184             __Pyx_sys_getdefaultencoding_not_ascii &&
14185 #endif
14186             PyUnicode_Check(o)) {
14187         return __Pyx_PyUnicode_AsStringAndSize(o, length);
14188     } else
14189 #endif
14190 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
14191     if (PyByteArray_Check(o)) {
14192         *length = PyByteArray_GET_SIZE(o);
14193         return PyByteArray_AS_STRING(o);
14194     } else
14195 #endif
14196     {
14197         char* result;
14198         int r = PyBytes_AsStringAndSize(o, &result, length);
14199         if (unlikely(r < 0)) {
14200             return NULL;
14201         } else {
14202             return result;
14203         }
14204     }
14205 }
14206 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
14207    int is_true = x == Py_True;
14208    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
14209    else return PyObject_IsTrue(x);
14210 }
14211 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
14212     int retval;
14213     if (unlikely(!x)) return -1;
14214     retval = __Pyx_PyObject_IsTrue(x);
14215     Py_DECREF(x);
14216     return retval;
14217 }
14218 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
14219 #if PY_MAJOR_VERSION >= 3
14220     if (PyLong_Check(result)) {
14221         if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
14222                 "__int__ returned non-int (type %.200s).  "
14223                 "The ability to return an instance of a strict subclass of int "
14224                 "is deprecated, and may be removed in a future version of Python.",
14225                 Py_TYPE(result)->tp_name)) {
14226             Py_DECREF(result);
14227             return NULL;
14228         }
14229         return result;
14230     }
14231 #endif
14232     PyErr_Format(PyExc_TypeError,
14233                  "__%.4s__ returned non-%.4s (type %.200s)",
14234                  type_name, type_name, Py_TYPE(result)->tp_name);
14235     Py_DECREF(result);
14236     return NULL;
14237 }
14238 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
14239 #if CYTHON_USE_TYPE_SLOTS
14240   PyNumberMethods *m;
14241 #endif
14242   const char *name = NULL;
14243   PyObject *res = NULL;
14244 #if PY_MAJOR_VERSION < 3
14245   if (likely(PyInt_Check(x) || PyLong_Check(x)))
14246 #else
14247   if (likely(PyLong_Check(x)))
14248 #endif
14249     return __Pyx_NewRef(x);
14250 #if CYTHON_USE_TYPE_SLOTS
14251   m = Py_TYPE(x)->tp_as_number;
14252   #if PY_MAJOR_VERSION < 3
14253   if (m && m->nb_int) {
14254     name = "int";
14255     res = m->nb_int(x);
14256   }
14257   else if (m && m->nb_long) {
14258     name = "long";
14259     res = m->nb_long(x);
14260   }
14261   #else
14262   if (likely(m && m->nb_int)) {
14263     name = "int";
14264     res = m->nb_int(x);
14265   }
14266   #endif
14267 #else
14268   if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
14269     res = PyNumber_Int(x);
14270   }
14271 #endif
14272   if (likely(res)) {
14273 #if PY_MAJOR_VERSION < 3
14274     if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
14275 #else
14276     if (unlikely(!PyLong_CheckExact(res))) {
14277 #endif
14278         return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
14279     }
14280   }
14281   else if (!PyErr_Occurred()) {
14282     PyErr_SetString(PyExc_TypeError,
14283                     "an integer is required");
14284   }
14285   return res;
14286 }
14287 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
14288   Py_ssize_t ival;
14289   PyObject *x;
14290 #if PY_MAJOR_VERSION < 3
14291   if (likely(PyInt_CheckExact(b))) {
14292     if (sizeof(Py_ssize_t) >= sizeof(long))
14293         return PyInt_AS_LONG(b);
14294     else
14295         return PyInt_AsSsize_t(b);
14296   }
14297 #endif
14298   if (likely(PyLong_CheckExact(b))) {
14299     #if CYTHON_USE_PYLONG_INTERNALS
14300     const digit* digits = ((PyLongObject*)b)->ob_digit;
14301     const Py_ssize_t size = Py_SIZE(b);
14302     if (likely(__Pyx_sst_abs(size) <= 1)) {
14303         ival = likely(size) ? digits[0] : 0;
14304         if (size == -1) ival = -ival;
14305         return ival;
14306     } else {
14307       switch (size) {
14308          case 2:
14309            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
14310              return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
14311            }
14312            break;
14313          case -2:
14314            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
14315              return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
14316            }
14317            break;
14318          case 3:
14319            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
14320              return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
14321            }
14322            break;
14323          case -3:
14324            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
14325              return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
14326            }
14327            break;
14328          case 4:
14329            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
14330              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]));
14331            }
14332            break;
14333          case -4:
14334            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
14335              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]));
14336            }
14337            break;
14338       }
14339     }
14340     #endif
14341     return PyLong_AsSsize_t(b);
14342   }
14343   x = PyNumber_Index(b);
14344   if (!x) return -1;
14345   ival = PyInt_AsSsize_t(x);
14346   Py_DECREF(x);
14347   return ival;
14348 }
14349 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
14350   return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
14351 }
14352 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
14353     return PyInt_FromSize_t(ival);
14354 }
14355
14356
14357 #endif /* Py_PYTHON_H */