/* Generated by Cython 0.29.7 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "depends": [
            "/Users/burtondewilde/.pyenv/versions/2.7.15/envs/dragnet-py2/lib/python2.7/site-packages/lxml/etree_api.h", 
            "/Users/burtondewilde/.pyenv/versions/2.7.15/envs/dragnet-py2/lib/python2.7/site-packages/lxml/includes/etree_defs.h", 
            "/Users/burtondewilde/.pyenv/versions/2.7.15/envs/dragnet-py2/lib/python2.7/site-packages/lxml/includes/libxml/HTMLtree.h", 
            "/Users/burtondewilde/.pyenv/versions/2.7.15/envs/dragnet-py2/lib/python2.7/site-packages/lxml/includes/libxml/chvalid.h", 
            "/Users/burtondewilde/.pyenv/versions/2.7.15/envs/dragnet-py2/lib/python2.7/site-packages/lxml/includes/libxml/encoding.h", 
            "/Users/burtondewilde/.pyenv/versions/2.7.15/envs/dragnet-py2/lib/python2.7/site-packages/lxml/includes/libxml/globals.h", 
            "/Users/burtondewilde/.pyenv/versions/2.7.15/envs/dragnet-py2/lib/python2.7/site-packages/lxml/includes/libxml/hash.h", 
            "/Users/burtondewilde/.pyenv/versions/2.7.15/envs/dragnet-py2/lib/python2.7/site-packages/lxml/includes/libxml/tree.h", 
            "/Users/burtondewilde/.pyenv/versions/2.7.15/envs/dragnet-py2/lib/python2.7/site-packages/lxml/includes/libxml/uri.h", 
            "/Users/burtondewilde/.pyenv/versions/2.7.15/envs/dragnet-py2/lib/python2.7/site-packages/lxml/includes/libxml/valid.h", 
            "/Users/burtondewilde/.pyenv/versions/2.7.15/envs/dragnet-py2/lib/python2.7/site-packages/lxml/includes/libxml/xmlIO.h", 
            "/Users/burtondewilde/.pyenv/versions/2.7.15/envs/dragnet-py2/lib/python2.7/site-packages/lxml/includes/libxml/xmlmemory.h", 
            "/Users/burtondewilde/.pyenv/versions/2.7.15/envs/dragnet-py2/lib/python2.7/site-packages/lxml/includes/libxml/xmlsave.h", 
            "/Users/burtondewilde/.pyenv/versions/2.7.15/envs/dragnet-py2/lib/python2.7/site-packages/lxml/includes/libxml/xmlstring.h", 
            "/Users/burtondewilde/.pyenv/versions/2.7.15/envs/dragnet-py2/lib/python2.7/site-packages/lxml/includes/libxml/xmlversion.h", 
            "/Users/burtondewilde/.pyenv/versions/2.7.15/envs/dragnet-py2/lib/python2.7/site-packages/lxml/includes/lxml-version.h"
        ], 
        "include_dirs": [
            "/Users/burtondewilde/.pyenv/versions/2.7.15/envs/dragnet-py2/lib/python2.7/site-packages/lxml/includes", 
            "/Users/burtondewilde/.pyenv/versions/2.7.15/envs/dragnet-py2/lib/python2.7/site-packages/lxml", 
            "/Users/burtondewilde/.pyenv/versions/2.7.15/envs/dragnet-py2/lib/python2.7/site-packages/lxml/includes/libxml", 
            "/Users/burtondewilde/.pyenv/versions/2.7.15/envs/dragnet-py2/lib/python2.7/site-packages/lxml/includes/libxslt", 
            "/Users/burtondewilde/.pyenv/versions/2.7.15/envs/dragnet-py2/lib/python2.7/site-packages/lxml/includes/libexslt"
        ], 
        "language": "c++", 
        "libraries": [
            "xml2"
        ], 
        "name": "dragnet.blocks", 
        "sources": [
            "dragnet/blocks.pyx"
        ]
    }, 
    "module_name": "dragnet.blocks"
}
END: Cython Metadata */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
    #error Cython requires Python 2.6+ or Python 3.3+.
#else
#define CYTHON_ABI "0_29_7"
#define CYTHON_HEX_VERSION 0x001D07F0
#define CYTHON_FUTURE_DIVISION 0
#include <stddef.h>
#ifndef offsetof
  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#define __PYX_COMMA ,
#ifndef HAVE_LONG_LONG
  #if PY_VERSION_HEX >= 0x02070000
    #define HAVE_LONG_LONG
  #endif
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
  #define CYTHON_COMPILING_IN_PYPY 1
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #if PY_VERSION_HEX < 0x03050000
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
#elif defined(PYSTON_VERSION)
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 1
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_ASYNC_SLOTS
  #define CYTHON_USE_ASYNC_SLOTS 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYTYPE_LOOKUP
    #define CYTHON_USE_PYTYPE_LOOKUP 0
  #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
    #define CYTHON_USE_PYTYPE_LOOKUP 1
  #endif
  #if PY_MAJOR_VERSION < 3
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYLONG_INTERNALS
    #define CYTHON_USE_PYLONG_INTERNALS 0
  #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
    #define CYTHON_USE_PYLONG_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_PYLIST_INTERNALS
    #define CYTHON_USE_PYLIST_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #if PY_VERSION_HEX < 0x030300F0
    #undef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #elif !defined(CYTHON_USE_UNICODE_WRITER)
    #define CYTHON_USE_UNICODE_WRITER 1
  #endif
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #ifndef CYTHON_FAST_THREAD_STATE
    #define CYTHON_FAST_THREAD_STATE 1
  #endif
  #ifndef CYTHON_FAST_PYCALL
    #define CYTHON_FAST_PYCALL 1
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
  #endif
  #ifndef CYTHON_USE_DICT_VERSIONS
    #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
  #endif
  #ifndef CYTHON_USE_EXC_INFO_STACK
    #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
  #endif
#endif
#if !defined(CYTHON_FAST_PYCCALL)
#define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
#endif
#if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
  #undef SHIFT
  #undef BASE
  #undef MASK
  #ifdef SIZEOF_VOID_P
    enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
  #endif
#endif
#ifndef __has_attribute
  #define __has_attribute(x) 0
#endif
#ifndef __has_cpp_attribute
  #define __has_cpp_attribute(x) 0
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_MAYBE_UNUSED_VAR
#  if defined(__cplusplus)
     template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
#  else
#    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
#  endif
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
#ifdef _MSC_VER
    #ifndef _MSC_STDINT_H_
        #if _MSC_VER < 1300
           typedef unsigned char     uint8_t;
           typedef unsigned int      uint32_t;
        #else
           typedef unsigned __int8   uint8_t;
           typedef unsigned __int32  uint32_t;
        #endif
    #endif
#else
   #include <stdint.h>
#endif
#ifndef CYTHON_FALLTHROUGH
  #if defined(__cplusplus) && __cplusplus >= 201103L
    #if __has_cpp_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH [[fallthrough]]
    #elif __has_cpp_attribute(clang::fallthrough)
      #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
    #elif __has_cpp_attribute(gnu::fallthrough)
      #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
    #endif
  #endif
  #ifndef CYTHON_FALLTHROUGH
    #if __has_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
    #else
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
  #if defined(__clang__ ) && defined(__apple_build_version__)
    #if __apple_build_version__ < 7000000
      #undef  CYTHON_FALLTHROUGH
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
#endif

#ifndef __cplusplus
  #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
#endif
#ifndef CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #else
    #define CYTHON_INLINE inline
  #endif
#endif
template<typename T>
void __Pyx_call_destructor(T& x) {
    x.~T();
}
template<typename T>
class __Pyx_FakeReference {
  public:
    __Pyx_FakeReference() : ptr(NULL) { }
    __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
    T *operator->() { return ptr; }
    T *operator&() { return ptr; }
    operator T&() { return *ptr; }
    template<typename U> bool operator ==(U other) { return *ptr == other; }
    template<typename U> bool operator !=(U other) { return *ptr != other; }
  private:
    T *ptr;
};

#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  #define Py_OptimizeFlag 0
#endif
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyClass_Type
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyType_Type
#endif
#ifndef Py_TPFLAGS_CHECKTYPES
  #define Py_TPFLAGS_CHECKTYPES 0
#endif
#ifndef Py_TPFLAGS_HAVE_INDEX
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#ifndef Py_TPFLAGS_HAVE_FINALIZE
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#ifndef METH_STACKLESS
  #define METH_STACKLESS 0
#endif
#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
  #ifndef METH_FASTCALL
     #define METH_FASTCALL 0x80
  #endif
  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
                                                          Py_ssize_t nargs, PyObject *kwnames);
#else
  #define __Pyx_PyCFunctionFast _PyCFunctionFast
  #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
#endif
#if CYTHON_FAST_PYCCALL
#define __Pyx_PyFastCFunction_Check(func)\
    ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
#else
#define __Pyx_PyFastCFunction_Check(func) 0
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  #define PyObject_Malloc(s)   PyMem_Malloc(s)
  #define PyObject_Free(p)     PyMem_Free(p)
  #define PyObject_Realloc(p)  PyMem_Realloc(p)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
  #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
  #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
  #define PyMem_RawFree(p)             PyMem_Free(p)
#endif
#if CYTHON_COMPILING_IN_PYSTON
  #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
#else
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
#endif
#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#elif PY_VERSION_HEX >= 0x03060000
  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
#elif PY_VERSION_HEX >= 0x03000000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#else
  #define __Pyx_PyThreadState_Current _PyThreadState_Current
#endif
#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
#include "pythread.h"
#define Py_tss_NEEDS_INIT 0
typedef int Py_tss_t;
static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
  *key = PyThread_create_key();
  return 0;
}
static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
  Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
  *key = Py_tss_NEEDS_INIT;
  return key;
}
static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
  PyObject_Free(key);
}
static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
  return *key != Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
  PyThread_delete_key(*key);
  *key = Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
  return PyThread_set_key_value(*key, value);
}
static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
  return PyThread_get_key_value(*key);
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
#define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
#else
#define __Pyx_PyDict_NewPresized(n)  PyDict_New()
#endif
#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
#define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
#else
#define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
  #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
#else
  #define CYTHON_PEP393_ENABLED 0
  #define PyUnicode_1BYTE_KIND  1
  #define PyUnicode_2BYTE_KIND  2
  #define PyUnicode_4BYTE_KIND  4
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
  #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
  #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
  #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
#endif
#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
#else
  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
  #define PyObject_ASCII(o)            PyObject_Repr(o)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
  #define PyObject_Unicode             PyObject_Str
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif
#if CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
#else
  #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  #define PyNumber_Int                 PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  #ifndef PyUnicode_InternFromString
    #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  #endif
#endif
#if PY_VERSION_HEX < 0x030200A4
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
#else
  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#endif
#if CYTHON_USE_ASYNC_SLOTS
  #if PY_VERSION_HEX >= 0x030500B1
    #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
    #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  #else
    #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  #endif
#else
  #define __Pyx_PyType_AsAsync(obj) NULL
#endif
#ifndef __Pyx_PyAsyncMethodsStruct
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
    } __Pyx_PyAsyncMethodsStruct;
#endif

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


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

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

#define __PYX_HAVE__dragnet__blocks
#define __PYX_HAVE_API__dragnet__blocks
/* Early includes */
#include "ios"
#include "new"
#include "stdexcept"
#include "typeinfo"
#include <utility>
#include <set>
#include <string.h>
#include <string>
#include <vector>
#include <map>
#include <stdint.h>
#include <stdio.h>
#include "lxml-version.h"
#include "libxml/xmlversion.h"
#include "libxml/xmlstring.h"
#include "libxml/encoding.h"
#include "libxml/chvalid.h"
#include "libxml/hash.h"
#include "libxml/tree.h"
#include "libxml/uri.h"
#include "libxml/HTMLtree.h"
#include "libxml/valid.h"
#include "libxml/xmlIO.h"
#include "libxml/xmlsave.h"
#include "libxml/globals.h"
#include "libxml/xmlmemory.h"
#include "etree_defs.h"
#include "etree_api.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

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

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

#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_uchar_cast(c) ((unsigned char)c)
#define __Pyx_long_cast(x) ((long)x)
#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
    (sizeof(type) < sizeof(Py_ssize_t))  ||\
    (sizeof(type) > sizeof(Py_ssize_t) &&\
          likely(v < (type)PY_SSIZE_T_MAX ||\
                 v == (type)PY_SSIZE_T_MAX)  &&\
          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
                                v == (type)PY_SSIZE_T_MIN)))  ||\
    (sizeof(type) == sizeof(Py_ssize_t) &&\
          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
                               v == (type)PY_SSIZE_T_MAX)))  )
static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
    return (size_t) i < (size_t) limit;
}
#if defined (__cplusplus) && __cplusplus >= 201103L
    #include <cstdlib>
    #define __Pyx_sst_abs(value) std::abs(value)
#elif SIZEOF_INT >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) abs(value)
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) labs(value)
#elif defined (_MSC_VER)
    #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define __Pyx_sst_abs(value) llabs(value)
#elif defined (__GNUC__)
    #define __Pyx_sst_abs(value) __builtin_llabs(value)
#else
    #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if PY_MAJOR_VERSION < 3
    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
    const Py_UNICODE *u_end = u;
    while (*u_end++) ;
    return (size_t)(u_end - u - 1);
}
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
#define __Pyx_PySequence_Tuple(obj)\
    (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
#if CYTHON_ASSUME_SAFE_MACROS
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
#else
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
#endif
#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    PyObject* ascii_chars_u = NULL;
    PyObject* ascii_chars_b = NULL;
    const char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    if (strcmp(default_encoding_c, "ascii") == 0) {
        __Pyx_sys_getdefaultencoding_not_ascii = 0;
    } else {
        char ascii_chars[128];
        int c;
        for (c = 0; c < 128; c++) {
            ascii_chars[c] = c;
        }
        __Pyx_sys_getdefaultencoding_not_ascii = 1;
        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
        if (!ascii_chars_u) goto bad;
        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
        if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
            PyErr_Format(
                PyExc_ValueError,
                "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
                default_encoding_c);
            goto bad;
        }
        Py_DECREF(ascii_chars_u);
        Py_DECREF(ascii_chars_b);
    }
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    Py_XDECREF(ascii_chars_u);
    Py_XDECREF(ascii_chars_b);
    return -1;
}
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#else
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
    if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    return -1;
}
#endif
#endif


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

static PyObject *__pyx_m = NULL;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_cython_runtime = NULL;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static PyObject *__pyx_empty_unicode;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;


static const char *__pyx_f[] = {
  "dragnet/blocks.pyx",
  "stringsource",
  "etreepublic.pxd",
};

/*--- Type declarations ---*/
struct __pyx_obj_7dragnet_6blocks_PartialBlock;
struct __pyx_obj_7dragnet_6blocks_TagCountPB;
struct __pyx_defaults;
typedef struct __pyx_defaults __pyx_defaults;
struct __pyx_defaults1;
typedef struct __pyx_defaults1 __pyx_defaults1;

/* "dragnet/blocks.pyx":51
 * # and a default function that does nothing
 * # http://stackoverflow.com/questions/14124049/is-there-any-type-for-function-in-cython
 * ctypedef void (*callback_t)(PartialBlock, string)             # <<<<<<<<<<<<<<
 * cdef void empty_callback(PartialBlock pb, string x):
 *     return
 */
typedef void (*__pyx_t_7dragnet_6blocks_callback_t)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *, std::string);

/* "dragnet/blocks.pyx":56
 * 
 * # typedefs for the functions that subclasses of PartialBlock implement
 * ctypedef void (*reinit_t)(PartialBlock)             # <<<<<<<<<<<<<<
 * ctypedef cpp_map[string, int] (*name_t)(PartialBlock, bool)
 * ctypedef void (*subtree_t)(PartialBlock, int)
 */
typedef void (*__pyx_t_7dragnet_6blocks_reinit_t)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *);

/* "dragnet/blocks.pyx":57
 * # typedefs for the functions that subclasses of PartialBlock implement
 * ctypedef void (*reinit_t)(PartialBlock)
 * ctypedef cpp_map[string, int] (*name_t)(PartialBlock, bool)             # <<<<<<<<<<<<<<
 * ctypedef void (*subtree_t)(PartialBlock, int)
 * 
 */
typedef std::map<std::string,int>  (*__pyx_t_7dragnet_6blocks_name_t)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *, bool);

/* "dragnet/blocks.pyx":58
 * ctypedef void (*reinit_t)(PartialBlock)
 * ctypedef cpp_map[string, int] (*name_t)(PartialBlock, bool)
 * ctypedef void (*subtree_t)(PartialBlock, int)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int int_min(int a, int b): return a if a <= b else b
 */
typedef void (*__pyx_t_7dragnet_6blocks_subtree_t)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *, int);
struct __pyx_defaults {
  PyObject *__pyx_arg_pb;
};
struct __pyx_defaults1 {
  PyObject *__pyx_arg_pb;
};

/* "dragnet/blocks.pyx":250
 * 
 * 
 * cdef class PartialBlock:             # <<<<<<<<<<<<<<
 *     """As we create blocks by recursing through subtrees
 *     in Blockifier, we need to maintain some state
 */
struct __pyx_obj_7dragnet_6blocks_PartialBlock {
  PyObject_HEAD
  struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock *__pyx_vtab;
  std::vector<std::string>  css_attrib;
  std::vector<std::string>  text;
  std::vector<std::string>  link_tokens;
  PyObject *anchors;
  std::map<std::string,std::vector<std::string> >  css_tree;
  std::map<std::string,std::vector<std::string> >  css;
  std::string block_start_tag;
  PyObject *block_start_element;
  std::vector<__pyx_t_7dragnet_6blocks_callback_t>  _tag_func;
  std::vector<__pyx_t_7dragnet_6blocks_reinit_t>  _reinit_func;
  std::vector<__pyx_t_7dragnet_6blocks_name_t>  _name_func;
  std::vector<__pyx_t_7dragnet_6blocks_subtree_t>  _subtree_func;
  bool do_css;
  bool do_readability;
  uint32_t tag_id;
  uint32_t next_tag_id;
  std::vector<uint32_t>  ancestors;
  std::vector<uint32_t>  ancestors_write;
  std::set<uint32_t>  class_weights_written;
  std::vector<std::pair<uint32_t,int> >  class_weights;
};


/* "dragnet/blocks.pyx":693
 * 
 * 
 * cdef class TagCountPB(PartialBlock):             # <<<<<<<<<<<<<<
 *     """Counts tags to compute content-tag ratios"""
 * 
 */
struct __pyx_obj_7dragnet_6blocks_TagCountPB {
  struct __pyx_obj_7dragnet_6blocks_PartialBlock __pyx_base;
  int _tc;
  int _ac;
  int _tc_lb;
  int _current_depth;
  int _min_depth_last_block;
  int _min_depth_last_block_pending;
};



/* "dragnet/blocks.pyx":250
 * 
 * 
 * cdef class PartialBlock:             # <<<<<<<<<<<<<<
 *     """As we create blocks by recursing through subtrees
 *     in Blockifier, we need to maintain some state
 */

struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock {
  void (*_fe_reinit)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *);
  void (*reinit)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *);
  void (*reinit_css)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *, bool);
  PyObject *(*_extract_features)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *, bool);
  PyObject *(*_add_readability)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *);
  void (*add_block_to_results)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *, PyObject *);
  void (*add_text)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *, xmlNode *, std::string);
  void (*add_anchor)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *, xmlNode *, struct LxmlDocument *);
  void (*_tag_fe)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *, std::string);
  void (*_subtree_fe)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *, int);
  void (*subtree_readability)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *, int);
  void (*readability_score_node)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *, xmlNode *);
  void (*reinit_readability)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *);
  void (*recurse)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *, xmlNode *, PyObject *, struct LxmlDocument *);
  void (*update_css)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *, xmlNode *, bool);
  void (*pop_css_tree)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *);
};
static struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock *__pyx_vtabptr_7dragnet_6blocks_PartialBlock;


/* "dragnet/blocks.pyx":693
 * 
 * 
 * cdef class TagCountPB(PartialBlock):             # <<<<<<<<<<<<<<
 *     """Counts tags to compute content-tag ratios"""
 * 
 */

struct __pyx_vtabstruct_7dragnet_6blocks_TagCountPB {
  struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock __pyx_base;
  void (*reinit_tagcount)(struct __pyx_obj_7dragnet_6blocks_TagCountPB *);
  void (*subtree_tagcount)(struct __pyx_obj_7dragnet_6blocks_TagCountPB *, int);
  std::map<std::string,int>  (*tagcount)(struct __pyx_obj_7dragnet_6blocks_TagCountPB *, bool);
  void (*tag_tagcount)(struct __pyx_obj_7dragnet_6blocks_TagCountPB *, std::string);
};
static struct __pyx_vtabstruct_7dragnet_6blocks_TagCountPB *__pyx_vtabptr_7dragnet_6blocks_TagCountPB;

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

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

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

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

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

/* PyCFunctionFastCall.proto */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
#else
#define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
#endif

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

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

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

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

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

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

/* PyThreadStateGet.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
#define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#define __Pyx_PyErr_Occurred()  PyErr_Occurred()
#endif

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

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

/* RaiseArgTupleInvalid.proto */
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);

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

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

/* PyObjectSetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

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

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

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

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

/* PyObjectCallNoArg.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
#else
#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
#endif

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

/* ListExtend.proto */
static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject* none = _PyList_Extend((PyListObject*)L, v);
    if (unlikely(!none))
        return -1;
    Py_DECREF(none);
    return 0;
#else
    return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
#endif
}

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

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

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

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

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

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

/* PyFloatBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_SubtractObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyFloat_SubtractObjC(op1, op2, floatval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
#endif

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

/* PyIntFromDouble.proto */
#if PY_MAJOR_VERSION < 3
static CYTHON_INLINE PyObject* __Pyx_PyInt_FromDouble(double value);
#else
#define __Pyx_PyInt_FromDouble(value) PyLong_FromDouble(value)
#endif

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

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

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

/* StrEquals.proto */
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
#else
#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
#endif

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

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

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

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

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

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

/* SetupReduce.proto */
static int __Pyx_setup_reduce(PyObject* type_obj);

/* TypeImport.proto */
#ifndef __PYX_HAVE_RT_ImportType_proto
#define __PYX_HAVE_RT_ImportType_proto
enum __Pyx_ImportType_CheckSize {
   __Pyx_ImportType_CheckSize_Error = 0,
   __Pyx_ImportType_CheckSize_Warn = 1,
   __Pyx_ImportType_CheckSize_Ignore = 2
};
static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
#endif

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

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

/* FetchCommonType.proto */
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);

/* CythonFunction.proto */
#define __Pyx_CyFunction_USED 1
#define __Pyx_CYFUNCTION_STATICMETHOD  0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
#define __Pyx_CYFUNCTION_CCLASS        0x04
#define __Pyx_CyFunction_GetClosure(f)\
    (((__pyx_CyFunctionObject *) (f))->func_closure)
#define __Pyx_CyFunction_GetClassObj(f)\
    (((__pyx_CyFunctionObject *) (f))->func_classobj)
#define __Pyx_CyFunction_Defaults(type, f)\
    ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
    ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
    PyCFunctionObject func;
#if PY_VERSION_HEX < 0x030500A0
    PyObject *func_weakreflist;
#endif
    PyObject *func_dict;
    PyObject *func_name;
    PyObject *func_qualname;
    PyObject *func_doc;
    PyObject *func_globals;
    PyObject *func_code;
    PyObject *func_closure;
    PyObject *func_classobj;
    void *defaults;
    int defaults_pyobjects;
    int flags;
    PyObject *defaults_tuple;
    PyObject *defaults_kwdict;
    PyObject *(*defaults_getter)(PyObject *);
    PyObject *func_annotations;
} __pyx_CyFunctionObject;
static PyTypeObject *__pyx_CyFunctionType = 0;
#define __Pyx_CyFunction_Check(obj)  (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\
    __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code)
static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *self,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
                                                         size_t size,
                                                         int pyobjects);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
                                                            PyObject *tuple);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
                                                             PyObject *dict);
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
                                                              PyObject *dict);
static int __pyx_CyFunction_init(void);

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

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

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

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

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

/* None.proto */
#include <new>

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

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

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

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value);

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

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

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

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

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

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

/* CheckBinaryVersion.proto */
static int __Pyx_check_binary_version(void);

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

static void __pyx_f_7dragnet_6blocks_12PartialBlock__fe_reinit(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self); /* proto*/
static void __pyx_f_7dragnet_6blocks_12PartialBlock_reinit(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self); /* proto*/
static void __pyx_f_7dragnet_6blocks_12PartialBlock_reinit_css(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self, bool __pyx_v_init_tree); /* proto*/
static PyObject *__pyx_f_7dragnet_6blocks_12PartialBlock__extract_features(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self, bool __pyx_v_append); /* proto*/
static PyObject *__pyx_f_7dragnet_6blocks_12PartialBlock__add_readability(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self); /* proto*/
static void __pyx_f_7dragnet_6blocks_12PartialBlock_add_block_to_results(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self, PyObject *__pyx_v_results); /* proto*/
static void __pyx_f_7dragnet_6blocks_12PartialBlock_add_text(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self, xmlNode *__pyx_v_ele, std::string __pyx_v_text_or_tail); /* proto*/
static void __pyx_f_7dragnet_6blocks_12PartialBlock_add_anchor(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self, xmlNode *__pyx_v_ele, struct LxmlDocument *__pyx_v_doc); /* proto*/
static void __pyx_f_7dragnet_6blocks_12PartialBlock__tag_fe(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self, std::string __pyx_v_tag); /* proto*/
static void __pyx_f_7dragnet_6blocks_12PartialBlock__subtree_fe(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self, int __pyx_v_start_or_end); /* proto*/
static void __pyx_f_7dragnet_6blocks_12PartialBlock_subtree_readability(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self, int __pyx_v_start_or_end); /* proto*/
static void __pyx_f_7dragnet_6blocks_12PartialBlock_readability_score_node(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self, xmlNode *__pyx_v_node); /* proto*/
static void __pyx_f_7dragnet_6blocks_12PartialBlock_reinit_readability(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self); /* proto*/
static void __pyx_f_7dragnet_6blocks_12PartialBlock_recurse(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self, xmlNode *__pyx_v_subtree, PyObject *__pyx_v_results, struct LxmlDocument *__pyx_v_doc); /* proto*/
static void __pyx_f_7dragnet_6blocks_12PartialBlock_update_css(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self, xmlNode *__pyx_v_child, bool __pyx_v_tree); /* proto*/
static void __pyx_f_7dragnet_6blocks_12PartialBlock_pop_css_tree(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self); /* proto*/
static void __pyx_f_7dragnet_6blocks_10TagCountPB_reinit_tagcount(CYTHON_UNUSED struct __pyx_obj_7dragnet_6blocks_TagCountPB *__pyx_v_self); /* proto*/
static void __pyx_f_7dragnet_6blocks_10TagCountPB_subtree_tagcount(struct __pyx_obj_7dragnet_6blocks_TagCountPB *__pyx_v_self, int __pyx_v_start_or_end); /* proto*/
static std::map<std::string,int>  __pyx_f_7dragnet_6blocks_10TagCountPB_tagcount(struct __pyx_obj_7dragnet_6blocks_TagCountPB *__pyx_v_self, bool __pyx_v_append); /* proto*/
static void __pyx_f_7dragnet_6blocks_10TagCountPB_tag_tagcount(struct __pyx_obj_7dragnet_6blocks_TagCountPB *__pyx_v_self, std::string __pyx_v_tag); /* proto*/

/* Module declarations from 'cython' */

/* Module declarations from 'libcpp.utility' */

/* Module declarations from 'libcpp.set' */

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

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

/* Module declarations from 'libcpp.vector' */

/* Module declarations from 'libcpp.map' */

/* Module declarations from 'libcpp.pair' */

/* Module declarations from 'libcpp' */

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

/* Module declarations from 'libc' */

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

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

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

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

/* Module declarations from 'lxml.includes.etreepublic' */
static PyTypeObject *__pyx_ptype_4lxml_8includes_11etreepublic__Document = 0;
static PyTypeObject *__pyx_ptype_4lxml_8includes_11etreepublic__Element = 0;
static PyTypeObject *__pyx_ptype_4lxml_8includes_11etreepublic_ElementBase = 0;
static PyTypeObject *__pyx_ptype_4lxml_8includes_11etreepublic__ElementTree = 0;
static PyTypeObject *__pyx_ptype_4lxml_8includes_11etreepublic_ElementClassLookup = 0;
static PyTypeObject *__pyx_ptype_4lxml_8includes_11etreepublic_FallbackElementClassLookup = 0;
static PyTypeObject *__pyx_ptype_4lxml_8includes_11etreepublic__ElementTagMatcher = 0;
static PyTypeObject *__pyx_ptype_4lxml_8includes_11etreepublic__ElementIterator = 0;

/* Module declarations from 'dragnet.blocks' */
static PyTypeObject *__pyx_ptype_7dragnet_6blocks_PartialBlock = 0;
static PyTypeObject *__pyx_ptype_7dragnet_6blocks_TagCountPB = 0;
static PyObject *__pyx_v_7dragnet_6blocks_etree = 0;
static std::set<std::string>  __pyx_v_7dragnet_6blocks_BLACKLIST;
static std::set<std::string>  __pyx_v_7dragnet_6blocks_BLOCKS;
static std::string __pyx_v_7dragnet_6blocks_CTEXT;
static std::string __pyx_v_7dragnet_6blocks_CTAIL;
static std::string __pyx_v_7dragnet_6blocks_A;
static std::string __pyx_v_7dragnet_6blocks_TAGCOUNT_SINCE_LAST_BLOCK;
static std::string __pyx_v_7dragnet_6blocks_TAGCOUNT;
static std::string __pyx_v_7dragnet_6blocks_ANCHOR_COUNT;
static std::string __pyx_v_7dragnet_6blocks_MIN_DEPTH_SINCE_LAST_BLOCK;
static std::string __pyx_v_7dragnet_6blocks_DIV;
static std::set<std::string>  __pyx_v_7dragnet_6blocks_READABILITY_PLUS3;
static std::set<std::string>  __pyx_v_7dragnet_6blocks_READABILITY_MINUS3;
static std::set<std::string>  __pyx_v_7dragnet_6blocks_READABILITY_MINUS5;
static std::set<char>  __pyx_v_7dragnet_6blocks_WHITESPACE;
static CYTHON_INLINE int __pyx_f_7dragnet_6blocks_int_min(int, int); /*proto*/
static std::vector<std::string>  __pyx_f_7dragnet_6blocks__tokens_from_text(std::vector<std::string> ); /*proto*/
static std::vector<std::string>  __pyx_f_7dragnet_6blocks__text_from_subtree(xmlNode *, bool, __pyx_t_7dragnet_6blocks_callback_t, struct __pyx_obj_7dragnet_6blocks_PartialBlock *); /*proto*/
static std::string __pyx_convert_string_from_py_std__in_string(PyObject *); /*proto*/
static std::set<std::string>  __pyx_convert_set_from_py_std_3a__3a_string(PyObject *); /*proto*/
static std::set<char>  __pyx_convert_set_from_py_char(PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &); /*proto*/
static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(std::string const &); /*proto*/
static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &); /*proto*/
static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(std::string const &); /*proto*/
static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &); /*proto*/
static PyObject *__pyx_convert_vector_to_py_uint32_t(const std::vector<uint32_t>  &); /*proto*/
static PyObject *__pyx_convert_pair_to_py_uint32_t____int(std::pair<uint32_t,int>  const &); /*proto*/
static PyObject *__pyx_convert_vector_to_py_std_3a__3a_pair_3c_uint32_t_2c_int_3e___(const std::vector<std::pair<uint32_t,int> >  &); /*proto*/
static PyObject *__pyx_convert_vector_to_py_std_3a__3a_string(const std::vector<std::string>  &); /*proto*/
#define __Pyx_MODULE_NAME "dragnet.blocks"
extern int __pyx_module_is_main_dragnet__blocks;
int __pyx_module_is_main_dragnet__blocks = 0;

/* Implementation of 'dragnet.blocks' */
static PyObject *__pyx_builtin_object;
static PyObject *__pyx_builtin_staticmethod;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_UnicodeDecodeError;
static PyObject *__pyx_builtin_TypeError;
static const char __pyx_k_I[] = "I";
static const char __pyx_k_W[] = "[^\\W_]+";
static const char __pyx_k_a[] = "a";
static const char __pyx_k_p[] = "p";
static const char __pyx_k_s[] = "s";
static const char __pyx_k_x[] = "x";
static const char __pyx_k__2[] = "";
static const char __pyx_k__3[] = " ";
static const char __pyx_k_dd[] = "dd";
static const char __pyx_k_dl[] = "dl";
static const char __pyx_k_dt[] = "dt";
static const char __pyx_k_h1[] = "h1";
static const char __pyx_k_h2[] = "h2";
static const char __pyx_k_h3[] = "h3";
static const char __pyx_k_h4[] = "h4";
static const char __pyx_k_h5[] = "h5";
static const char __pyx_k_h6[] = "h6";
static const char __pyx_k_id[] = "id";
static const char __pyx_k_li[] = "li";
static const char __pyx_k_mo[] = "mo";
static const char __pyx_k_np[] = "np";
static const char __pyx_k_ol[] = "ol";
static const char __pyx_k_pb[] = "pb";
static const char __pyx_k_re[] = "re";
static const char __pyx_k_td[] = "td";
static const char __pyx_k_th[] = "th";
static const char __pyx_k_ul[] = "ul";
static const char __pyx_k_W_2[] = "[\\W_]+";
static const char __pyx_k_bdo[] = "bdo";
static const char __pyx_k_css[] = "css";
static const char __pyx_k_div[] = "div";
static const char __pyx_k_doc[] = "__doc__";
static const char __pyx_k_ele[] = "ele";
static const char __pyx_k_img[] = "img";
static const char __pyx_k_map[] = "map";
static const char __pyx_k_moh[] = "moh";
static const char __pyx_k_pre[] = "pre";
static const char __pyx_k_svg[] = "svg";
static const char __pyx_k_tag[] = "tag";
static const char __pyx_k_var[] = "var";
static const char __pyx_k_xmp[] = "xmp";
static const char __pyx_k_area[] = "area";
static const char __pyx_k_base[] = "base";
static const char __pyx_k_ceil[] = "ceil";
static const char __pyx_k_form[] = "form";
static const char __pyx_k_fram[] = "fram";
static const char __pyx_k_html[] = "html";
static const char __pyx_k_init[] = "__init__";
static const char __pyx_k_join[] = "join";
static const char __pyx_k_like[] = "like";
static const char __pyx_k_link[] = "link";
static const char __pyx_k_lxml[] = "lxml";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_math[] = "math";
static const char __pyx_k_menu[] = "menu";
static const char __pyx_k_meta[] = "meta";
static const char __pyx_k_name[] = "__name__";
static const char __pyx_k_self[] = "self";
static const char __pyx_k_tail[] = "tail";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_text[] = "text";
static const char __pyx_k_tree[] = "tree";
static const char __pyx_k_Block[] = "Block";
static const char __pyx_k_child[] = "child";
static const char __pyx_k_class[] = "class";
static const char __pyx_k_ctree[] = "ctree";
static const char __pyx_k_etree[] = "etree";
static const char __pyx_k_flags[] = "flags";
static const char __pyx_k_group[] = "group";
static const char __pyx_k_input[] = "input";
static const char __pyx_k_lower[] = "lower";
static const char __pyx_k_numpy[] = "numpy";
static const char __pyx_k_param[] = "param";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_split[] = "split";
static const char __pyx_k_style[] = "style";
static const char __pyx_k_table[] = "table";
static const char __pyx_k_utf_8[] = "utf-8";
static const char __pyx_k_applet[] = "applet";
static const char __pyx_k_blocks[] = "blocks";
static const char __pyx_k_button[] = "button";
static const char __pyx_k_compat[] = "compat";
static const char __pyx_k_detect[] = "detect";
static const char __pyx_k_do_css[] = "do_css";
static const char __pyx_k_encode[] = "encode";
static const char __pyx_k_endpos[] = "endpos";
static const char __pyx_k_iframe[] = "iframe";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_kwargs[] = "kwargs";
static const char __pyx_k_legend[] = "legend";
static const char __pyx_k_markup[] = "markup";
static const char __pyx_k_module[] = "__module__";
static const char __pyx_k_object[] = "object";
static const char __pyx_k_option[] = "option";
static const char __pyx_k_reduce[] = "__reduce__";
static const char __pyx_k_script[] = "script";
static const char __pyx_k_search[] = "search";
static const char __pyx_k_select[] = "select";
static const char __pyx_k_update[] = "update";
static const char __pyx_k_RE_TEXT[] = "RE_TEXT";
static const char __pyx_k_UNICODE[] = "UNICODE";
static const char __pyx_k_address[] = "address";
static const char __pyx_k_anchors[] = "anchors";
static const char __pyx_k_caption[] = "caption";
static const char __pyx_k_chardet[] = "chardet";
static const char __pyx_k_compile[] = "compile";
static const char __pyx_k_default[] = "default";
static const char __pyx_k_plusone[] = "plusone";
static const char __pyx_k_prepare[] = "__prepare__";
static const char __pyx_k_recover[] = "recover";
static const char __pyx_k_results[] = "results";
static const char __pyx_k_basefont[] = "basefont";
static const char __pyx_k_blockify[] = "blockify";
static const char __pyx_k_callback[] = "callback";
static const char __pyx_k_encoding[] = "encoding";
static const char __pyx_k_features[] = "features";
static const char __pyx_k_fieldset[] = "fieldset";
static const char __pyx_k_frameset[] = "frameset";
static const char __pyx_k_getstate[] = "__getstate__";
static const char __pyx_k_like_box[] = "like-box";
static const char __pyx_k_noframes[] = "noframes";
static const char __pyx_k_noscript[] = "noscript";
static const char __pyx_k_optgroup[] = "optgroup";
static const char __pyx_k_qualname[] = "__qualname__";
static const char __pyx_k_setstate[] = "__setstate__";
static const char __pyx_k_str_cast[] = "str_cast";
static const char __pyx_k_tagcount[] = "tagcount";
static const char __pyx_k_textarea[] = "textarea";
static const char __pyx_k_TypeError[] = "TypeError";
static const char __pyx_k_ancestors[] = "ancestors";
static const char __pyx_k_metaclass[] = "__metaclass__";
static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
static const char __pyx_k_Blockifier[] = "Blockifier";
static const char __pyx_k_HTMLParser[] = "HTMLParser";
static const char __pyx_k_IGNORECASE[] = "IGNORECASE";
static const char __pyx_k_TagCountPB[] = "TagCountPB";
static const char __pyx_k_blockquote[] = "blockquote";
static const char __pyx_k_bytes_cast[] = "bytes_cast";
static const char __pyx_k_fromstring[] = "fromstring";
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static const char __pyx_k_remove_pis[] = "remove_pis";
static const char __pyx_k_xml_endpos[] = "xml_endpos";
static const char __pyx_k_html_endpos[] = "html_endpos";
static const char __pyx_k_link_tokens[] = "link_tokens";
static const char __pyx_k_Block___init[] = "Block.__init__";
static const char __pyx_k_PartialBlock[] = "PartialBlock";
static const char __pyx_k_anchor_count[] = "anchor_count";
static const char __pyx_k_encoding_s_s[] = "^<\\?.*?encoding\\s*?=\\s*?['\"](.*?)['\"].*?\\?>";
static const char __pyx_k_iterchildren[] = "iterchildren";
static const char __pyx_k_link_density[] = "link_density";
static const char __pyx_k_re_tokenizer[] = "re_tokenizer";
static const char __pyx_k_staticmethod[] = "staticmethod";
static const char __pyx_k_tags_exclude[] = "tags_exclude";
static const char __pyx_k_text_density[] = "text_density";
static const char __pyx_k_BlockifyError[] = "BlockifyError";
static const char __pyx_k_partial_block[] = "partial_block";
static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
static const char __pyx_k_str_dict_cast[] = "str_dict_cast";
static const char __pyx_k_str_list_cast[] = "str_list_cast";
static const char __pyx_k_do_readability[] = "do_readability";
static const char __pyx_k_dragnet_blocks[] = "dragnet.blocks";
static const char __pyx_k_guess_encoding[] = "guess_encoding";
static const char __pyx_k_parse_callback[] = "parse_callback";
static const char __pyx_k_str_block_cast[] = "str_block_cast";
static const char __pyx_k_RE_XML_ENCODING[] = "RE_XML_ENCODING";
static const char __pyx_k_block_start_tag[] = "block_start_tag";
static const char __pyx_k_remove_comments[] = "remove_comments";
static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
static const char __pyx_k_RE_HTML_ENCODING[] = "RE_HTML_ENCODING";
static const char __pyx_k_blocks_from_tree[] = "blocks_from_tree";
static const char __pyx_k_simple_tokenizer[] = "simple_tokenizer";
static const char __pyx_k_text_from_subtree[] = "text_from_subtree";
static const char __pyx_k_TagCountBlockifier[] = "TagCountBlockifier";
static const char __pyx_k_UnicodeDecodeError[] = "UnicodeDecodeError";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_dragnet_blocks_pyx[] = "dragnet/blocks.pyx";
static const char __pyx_k_s_meta_charset_s_s[] = "<\\s*meta[^>]+charset\\s*?=\\s*?['\"]?([^>]*?)[ /;'\">]";
static const char __pyx_k_Blockifier_blockify[] = "Blockifier.blockify";
static const char __pyx_k_block_start_element[] = "block_start_element";
static const char __pyx_k_str_block_list_cast[] = "str_block_list_cast";
static const char __pyx_k_re_tokenizer_nounicode[] = "re_tokenizer_nounicode";
static const char __pyx_k_Could_not_blockify_HTML[] = "Could not blockify HTML";
static const char __pyx_k_TagCountNoCSSBlockifier[] = "TagCountNoCSSBlockifier";
static const char __pyx_k_re_readability_negative[] = "re_readability_negative";
static const char __pyx_k_re_readability_positive[] = "re_readability_positive";
static const char __pyx_k_readability_class_weights[] = "readability_class_weights";
static const char __pyx_k_tagcount_since_last_block[] = "tagcount_since_last_block";
static const char __pyx_k_min_depth_since_last_block[] = "min_depth_since_last_block";
static const char __pyx_k_Blockifier_blocks_from_tree[] = "Blockifier.blocks_from_tree";
static const char __pyx_k_TagCountBlockifier_blockify[] = "TagCountBlockifier.blockify";
static const char __pyx_k_TagCountReadabilityBlockifier[] = "TagCountReadabilityBlockifier";
static const char __pyx_k_A_blockifier_for_web_page_de_ch[] = "\n    A blockifier for web-page de-chroming that loosely follows the approach in\n    Kohlsch\303\274tter et al.: http://www.l3s.de/~kohlschuetter/publications/wsdm187-kohlschuetter.pdf\n\n    Implements the blockify interface.\n    ";
static const char __pyx_k_Implementation_of_the_blockifie[] = "\nImplementation of the blockifier interface and some classes\nto manipulate blocks\n\nblockifier interface is any object that implements blockify(html) and\nreturns a list of Block instances\n";
static const char __pyx_k_Raised_when_there_is_a_fatal_pro[] = "Raised when there is a fatal problem in blockify\n    (if lxml fails to parse the document)\n    ";
static const char __pyx_k_TagCountNoCSSBlockifier_blockify[] = "TagCountNoCSSBlockifier.blockify";
static const char __pyx_k_TagCountNoCSSReadabilityBlockifi[] = "TagCountNoCSSReadabilityBlockifier";
static const char __pyx_k_TagCountReadabilityBlockifier_bl[] = "TagCountReadabilityBlockifier.blockify";
static const char __pyx_k_article_body_content_entry_hentr[] = "article|body|content|entry|hentry|main|page|pagination|post|text|blog|story";
static const char __pyx_k_combx_comment_com_contact_foot_f[] = "combx|comment|com-|contact|foot|footer|footnote|masthead|media|meta|outbrain|promo|related|scroll|shoutbox|sidebar|sponsor|shopping|tags|tool|widget";
static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
static const char __pyx_k_TagCountNoCSSReadabilityBlockifi_2[] = "TagCountNoCSSReadabilityBlockifier.blockify";
static PyObject *__pyx_kp_s_A_blockifier_for_web_page_de_ch;
static PyObject *__pyx_n_s_Block;
static PyObject *__pyx_n_s_Block___init;
static PyObject *__pyx_n_s_Blockifier;
static PyObject *__pyx_n_s_Blockifier_blockify;
static PyObject *__pyx_n_s_Blockifier_blocks_from_tree;
static PyObject *__pyx_n_s_BlockifyError;
static PyObject *__pyx_kp_s_Could_not_blockify_HTML;
static PyObject *__pyx_n_s_HTMLParser;
static PyObject *__pyx_n_s_I;
static PyObject *__pyx_n_s_IGNORECASE;
static PyObject *__pyx_n_s_PartialBlock;
static PyObject *__pyx_n_s_RE_HTML_ENCODING;
static PyObject *__pyx_n_s_RE_TEXT;
static PyObject *__pyx_n_s_RE_XML_ENCODING;
static PyObject *__pyx_kp_s_Raised_when_there_is_a_fatal_pro;
static PyObject *__pyx_n_s_TagCountBlockifier;
static PyObject *__pyx_n_s_TagCountBlockifier_blockify;
static PyObject *__pyx_n_s_TagCountNoCSSBlockifier;
static PyObject *__pyx_n_s_TagCountNoCSSBlockifier_blockify;
static PyObject *__pyx_n_s_TagCountNoCSSReadabilityBlockifi;
static PyObject *__pyx_n_s_TagCountNoCSSReadabilityBlockifi_2;
static PyObject *__pyx_n_s_TagCountPB;
static PyObject *__pyx_n_s_TagCountReadabilityBlockifier;
static PyObject *__pyx_n_s_TagCountReadabilityBlockifier_bl;
static PyObject *__pyx_n_s_TypeError;
static PyObject *__pyx_n_s_UNICODE;
static PyObject *__pyx_n_s_UnicodeDecodeError;
static PyObject *__pyx_kp_s_W;
static PyObject *__pyx_kp_b_W_2;
static PyObject *__pyx_kp_s_W_2;
static PyObject *__pyx_kp_b__2;
static PyObject *__pyx_kp_s__2;
static PyObject *__pyx_kp_b__3;
static PyObject *__pyx_n_b_a;
static PyObject *__pyx_n_b_address;
static PyObject *__pyx_n_s_ancestors;
static PyObject *__pyx_n_b_anchor_count;
static PyObject *__pyx_n_s_anchors;
static PyObject *__pyx_n_b_applet;
static PyObject *__pyx_n_b_area;
static PyObject *__pyx_kp_s_article_body_content_entry_hentr;
static PyObject *__pyx_n_b_base;
static PyObject *__pyx_n_b_basefont;
static PyObject *__pyx_n_b_bdo;
static PyObject *__pyx_n_s_block_start_element;
static PyObject *__pyx_n_s_block_start_tag;
static PyObject *__pyx_n_s_blockify;
static PyObject *__pyx_n_b_blockquote;
static PyObject *__pyx_n_s_blocks;
static PyObject *__pyx_n_s_blocks_from_tree;
static PyObject *__pyx_n_b_button;
static PyObject *__pyx_n_s_bytes_cast;
static PyObject *__pyx_n_s_callback;
static PyObject *__pyx_n_b_caption;
static PyObject *__pyx_n_s_ceil;
static PyObject *__pyx_n_s_chardet;
static PyObject *__pyx_n_s_child;
static PyObject *__pyx_n_b_class;
static PyObject *__pyx_n_s_cline_in_traceback;
static PyObject *__pyx_kp_s_combx_comment_com_contact_foot_f;
static PyObject *__pyx_n_s_compat;
static PyObject *__pyx_n_s_compile;
static PyObject *__pyx_n_s_css;
static PyObject *__pyx_n_s_ctree;
static PyObject *__pyx_n_b_dd;
static PyObject *__pyx_n_s_default;
static PyObject *__pyx_n_s_detect;
static PyObject *__pyx_n_b_div;
static PyObject *__pyx_n_b_dl;
static PyObject *__pyx_n_s_do_css;
static PyObject *__pyx_n_s_do_readability;
static PyObject *__pyx_n_s_doc;
static PyObject *__pyx_n_s_dragnet_blocks;
static PyObject *__pyx_kp_s_dragnet_blocks_pyx;
static PyObject *__pyx_n_b_dt;
static PyObject *__pyx_n_s_ele;
static PyObject *__pyx_n_s_encode;
static PyObject *__pyx_n_s_encoding;
static PyObject *__pyx_kp_b_encoding_s_s;
static PyObject *__pyx_n_s_endpos;
static PyObject *__pyx_n_s_etree;
static PyObject *__pyx_n_s_features;
static PyObject *__pyx_n_b_fieldset;
static PyObject *__pyx_n_s_flags;
static PyObject *__pyx_n_b_form;
static PyObject *__pyx_n_b_fram;
static PyObject *__pyx_n_b_frameset;
static PyObject *__pyx_n_s_fromstring;
static PyObject *__pyx_n_s_getstate;
static PyObject *__pyx_n_s_group;
static PyObject *__pyx_n_s_guess_encoding;
static PyObject *__pyx_n_b_h1;
static PyObject *__pyx_n_b_h2;
static PyObject *__pyx_n_b_h3;
static PyObject *__pyx_n_b_h4;
static PyObject *__pyx_n_b_h5;
static PyObject *__pyx_n_b_h6;
static PyObject *__pyx_n_s_html;
static PyObject *__pyx_n_s_html_endpos;
static PyObject *__pyx_n_b_id;
static PyObject *__pyx_n_b_iframe;
static PyObject *__pyx_n_b_img;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_init;
static PyObject *__pyx_n_b_input;
static PyObject *__pyx_n_s_iterchildren;
static PyObject *__pyx_n_s_join;
static PyObject *__pyx_n_s_kwargs;
static PyObject *__pyx_n_b_legend;
static PyObject *__pyx_n_b_li;
static PyObject *__pyx_n_b_like;
static PyObject *__pyx_kp_b_like_box;
static PyObject *__pyx_n_b_link;
static PyObject *__pyx_n_s_link_density;
static PyObject *__pyx_n_s_link_tokens;
static PyObject *__pyx_n_s_lower;
static PyObject *__pyx_n_s_lxml;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_b_map;
static PyObject *__pyx_n_s_markup;
static PyObject *__pyx_n_b_math;
static PyObject *__pyx_n_s_math;
static PyObject *__pyx_n_b_menu;
static PyObject *__pyx_n_b_meta;
static PyObject *__pyx_n_s_metaclass;
static PyObject *__pyx_n_b_min_depth_since_last_block;
static PyObject *__pyx_n_s_mo;
static PyObject *__pyx_n_s_module;
static PyObject *__pyx_n_s_moh;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
static PyObject *__pyx_n_b_noframes;
static PyObject *__pyx_n_b_noscript;
static PyObject *__pyx_n_s_np;
static PyObject *__pyx_n_s_numpy;
static PyObject *__pyx_n_b_object;
static PyObject *__pyx_n_s_object;
static PyObject *__pyx_n_b_ol;
static PyObject *__pyx_n_b_optgroup;
static PyObject *__pyx_n_b_option;
static PyObject *__pyx_n_b_p;
static PyObject *__pyx_n_b_param;
static PyObject *__pyx_n_s_parse_callback;
static PyObject *__pyx_n_s_partial_block;
static PyObject *__pyx_n_s_pb;
static PyObject *__pyx_n_b_plusone;
static PyObject *__pyx_n_b_pre;
static PyObject *__pyx_n_s_prepare;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_qualname;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_re;
static PyObject *__pyx_n_s_re_readability_negative;
static PyObject *__pyx_n_s_re_readability_positive;
static PyObject *__pyx_n_s_re_tokenizer;
static PyObject *__pyx_n_s_re_tokenizer_nounicode;
static PyObject *__pyx_n_s_readability_class_weights;
static PyObject *__pyx_n_s_recover;
static PyObject *__pyx_n_s_reduce;
static PyObject *__pyx_n_s_reduce_cython;
static PyObject *__pyx_n_s_reduce_ex;
static PyObject *__pyx_n_s_remove_comments;
static PyObject *__pyx_n_s_remove_pis;
static PyObject *__pyx_n_s_results;
static PyObject *__pyx_n_s_s;
static PyObject *__pyx_kp_b_s_meta_charset_s_s;
static PyObject *__pyx_n_b_script;
static PyObject *__pyx_n_s_search;
static PyObject *__pyx_n_b_select;
static PyObject *__pyx_n_s_self;
static PyObject *__pyx_n_s_setstate;
static PyObject *__pyx_n_s_setstate_cython;
static PyObject *__pyx_n_s_simple_tokenizer;
static PyObject *__pyx_n_s_split;
static PyObject *__pyx_n_s_staticmethod;
static PyObject *__pyx_n_s_str_block_cast;
static PyObject *__pyx_n_s_str_block_list_cast;
static PyObject *__pyx_n_s_str_cast;
static PyObject *__pyx_n_s_str_dict_cast;
static PyObject *__pyx_n_s_str_list_cast;
static PyObject *__pyx_n_b_style;
static PyObject *__pyx_n_b_svg;
static PyObject *__pyx_n_b_table;
static PyObject *__pyx_n_s_tag;
static PyObject *__pyx_n_b_tagcount;
static PyObject *__pyx_n_b_tagcount_since_last_block;
static PyObject *__pyx_n_s_tags_exclude;
static PyObject *__pyx_n_b_tail;
static PyObject *__pyx_n_s_tail;
static PyObject *__pyx_n_b_td;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_b_text;
static PyObject *__pyx_n_s_text;
static PyObject *__pyx_n_s_text_density;
static PyObject *__pyx_n_s_text_from_subtree;
static PyObject *__pyx_n_b_textarea;
static PyObject *__pyx_n_b_th;
static PyObject *__pyx_n_s_tree;
static PyObject *__pyx_n_b_ul;
static PyObject *__pyx_n_s_update;
static PyObject *__pyx_kp_s_utf_8;
static PyObject *__pyx_n_b_var;
static PyObject *__pyx_n_s_x;
static PyObject *__pyx_n_s_xml_endpos;
static PyObject *__pyx_n_b_xmp;
static PyObject *__pyx_pf_7dragnet_6blocks_simple_tokenizer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_7dragnet_6blocks_5Block___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_text, PyObject *__pyx_v_link_density, PyObject *__pyx_v_text_density, PyObject *__pyx_v_anchors, PyObject *__pyx_v_link_tokens, PyObject *__pyx_v_css, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7dragnet_6blocks_2text_from_subtree(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tree, PyObject *__pyx_v_tags_exclude, PyObject *__pyx_v_tail, PyObject *__pyx_v_callback); /* proto */
static int __pyx_pf_7dragnet_6blocks_12PartialBlock___cinit__(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static int __pyx_pf_7dragnet_6blocks_12PartialBlock_2__init__(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self, PyObject *__pyx_v_do_css, PyObject *__pyx_v_do_readability); /* proto */
static PyObject *__pyx_pf_7dragnet_6blocks_12PartialBlock_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7dragnet_6blocks_12PartialBlock_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_7dragnet_6blocks_10TagCountPB___init__(struct __pyx_obj_7dragnet_6blocks_TagCountPB *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7dragnet_6blocks_10TagCountPB_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7dragnet_6blocks_TagCountPB *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7dragnet_6blocks_10TagCountPB_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7dragnet_6blocks_TagCountPB *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7dragnet_6blocks_4guess_encoding(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_markup, PyObject *__pyx_v_default); /* proto */
static PyObject *__pyx_pf_7dragnet_6blocks_6__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7dragnet_6blocks_10Blockifier_blocks_from_tree(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tree, PyObject *__pyx_v_pb, PyObject *__pyx_v_do_css, PyObject *__pyx_v_do_readability); /* proto */
static PyObject *__pyx_pf_7dragnet_6blocks_8__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7dragnet_6blocks_10Blockifier_2blockify(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s, PyObject *__pyx_v_encoding, PyObject *__pyx_v_pb, PyObject *__pyx_v_do_css, PyObject *__pyx_v_do_readability, PyObject *__pyx_v_parse_callback); /* proto */
static PyObject *__pyx_pf_7dragnet_6blocks_18TagCountBlockifier_blockify(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s, PyObject *__pyx_v_encoding, PyObject *__pyx_v_parse_callback); /* proto */
static PyObject *__pyx_pf_7dragnet_6blocks_23TagCountNoCSSBlockifier_blockify(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s, PyObject *__pyx_v_encoding, PyObject *__pyx_v_parse_callback); /* proto */
static PyObject *__pyx_pf_7dragnet_6blocks_29TagCountReadabilityBlockifier_blockify(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s, PyObject *__pyx_v_encoding, PyObject *__pyx_v_parse_callback); /* proto */
static PyObject *__pyx_pf_7dragnet_6blocks_34TagCountNoCSSReadabilityBlockifier_blockify(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s, PyObject *__pyx_v_encoding, PyObject *__pyx_v_parse_callback); /* proto */
static PyObject *__pyx_tp_new_7dragnet_6blocks_PartialBlock(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7dragnet_6blocks_TagCountPB(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_float_1_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_80;
static PyObject *__pyx_k_;
static PyObject *__pyx_tuple__4;
static PyObject *__pyx_tuple__5;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__7;
static PyObject *__pyx_tuple__8;
static PyObject *__pyx_tuple__9;
static PyObject *__pyx_tuple__10;
static PyObject *__pyx_tuple__11;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__14;
static PyObject *__pyx_tuple__15;
static PyObject *__pyx_tuple__17;
static PyObject *__pyx_tuple__19;
static PyObject *__pyx_tuple__21;
static PyObject *__pyx_tuple__22;
static PyObject *__pyx_tuple__24;
static PyObject *__pyx_tuple__26;
static PyObject *__pyx_tuple__28;
static PyObject *__pyx_tuple__29;
static PyObject *__pyx_tuple__31;
static PyObject *__pyx_tuple__32;
static PyObject *__pyx_tuple__34;
static PyObject *__pyx_tuple__35;
static PyObject *__pyx_tuple__37;
static PyObject *__pyx_codeobj__13;
static PyObject *__pyx_codeobj__16;
static PyObject *__pyx_codeobj__18;
static PyObject *__pyx_codeobj__20;
static PyObject *__pyx_codeobj__23;
static PyObject *__pyx_codeobj__25;
static PyObject *__pyx_codeobj__27;
static PyObject *__pyx_codeobj__30;
static PyObject *__pyx_codeobj__33;
static PyObject *__pyx_codeobj__36;
/* Late includes */

/* "dragnet/blocks.pyx":45
 * 
 * 
 * def simple_tokenizer(x):             # <<<<<<<<<<<<<<
 *     return [ele for ele in re_tokenizer.split(x) if len(ele) > 0]
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7dragnet_6blocks_1simple_tokenizer(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/
static PyMethodDef __pyx_mdef_7dragnet_6blocks_1simple_tokenizer = {"simple_tokenizer", (PyCFunction)__pyx_pw_7dragnet_6blocks_1simple_tokenizer, METH_O, 0};
static PyObject *__pyx_pw_7dragnet_6blocks_1simple_tokenizer(PyObject *__pyx_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("simple_tokenizer (wrapper)", 0);
  __pyx_r = __pyx_pf_7dragnet_6blocks_simple_tokenizer(__pyx_self, ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_7dragnet_6blocks_simple_tokenizer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_v_ele = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  __Pyx_RefNannySetupContext("simple_tokenizer", 0);

  /* "dragnet/blocks.pyx":46
 * 
 * def simple_tokenizer(x):
 *     return [ele for ele in re_tokenizer.split(x) if len(ele) > 0]             # <<<<<<<<<<<<<<
 * 
 * # need a typedef for the callback function in text_from_subtree
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_re_tokenizer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_split); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_v_x) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_x);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 46, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 46, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(!__pyx_t_6)) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 46, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 46, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_6(__pyx_t_4);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 46, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF_SET(__pyx_v_ele, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_7 = PyObject_Length(__pyx_v_ele); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 46, __pyx_L1_error)
    __pyx_t_8 = ((__pyx_t_7 > 0) != 0);
    if (__pyx_t_8) {
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_v_ele))) __PYX_ERR(0, 46, __pyx_L1_error)
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "dragnet/blocks.pyx":45
 * 
 * 
 * def simple_tokenizer(x):             # <<<<<<<<<<<<<<
 *     return [ele for ele in re_tokenizer.split(x) if len(ele) > 0]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("dragnet.blocks.simple_tokenizer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ele);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "dragnet/blocks.pyx":52
 * # http://stackoverflow.com/questions/14124049/is-there-any-type-for-function-in-cython
 * ctypedef void (*callback_t)(PartialBlock, string)
 * cdef void empty_callback(PartialBlock pb, string x):             # <<<<<<<<<<<<<<
 *     return
 * 
 */

static void __pyx_f_7dragnet_6blocks_empty_callback(CYTHON_UNUSED struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_pb, CYTHON_UNUSED std::string __pyx_v_x) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("empty_callback", 0);

  /* "dragnet/blocks.pyx":53
 * ctypedef void (*callback_t)(PartialBlock, string)
 * cdef void empty_callback(PartialBlock pb, string x):
 *     return             # <<<<<<<<<<<<<<
 * 
 * # typedefs for the functions that subclasses of PartialBlock implement
 */
  goto __pyx_L0;

  /* "dragnet/blocks.pyx":52
 * # http://stackoverflow.com/questions/14124049/is-there-any-type-for-function-in-cython
 * ctypedef void (*callback_t)(PartialBlock, string)
 * cdef void empty_callback(PartialBlock pb, string x):             # <<<<<<<<<<<<<<
 *     return
 * 
 */

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

/* "dragnet/blocks.pyx":60
 * ctypedef void (*subtree_t)(PartialBlock, int)
 * 
 * cdef inline int int_min(int a, int b): return a if a <= b else b             # <<<<<<<<<<<<<<
 * 
 * # tags we'll ignore completely
 */

static CYTHON_INLINE int __pyx_f_7dragnet_6blocks_int_min(int __pyx_v_a, int __pyx_v_b) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("int_min", 0);
  if (((__pyx_v_a <= __pyx_v_b) != 0)) {
    __pyx_t_1 = __pyx_v_a;
  } else {
    __pyx_t_1 = __pyx_v_b;
  }
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

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

/* "dragnet/blocks.pyx":109
 *     <char>'\r', <char>'\f', <char>'\v'])
 * 
 * cdef vector[string] _tokens_from_text(vector[string] text):             # <<<<<<<<<<<<<<
 *     '''
 *     Given a vector of text, return a vector of individual tokens
 */

static std::vector<std::string>  __pyx_f_7dragnet_6blocks__tokens_from_text(std::vector<std::string>  __pyx_v_text) {
  size_t __pyx_v_i;
  size_t __pyx_v_j;
  size_t __pyx_v_start;
  bool __pyx_v_token;
  std::vector<std::string>  __pyx_v_ret;
  std::vector<std::string>  __pyx_r;
  __Pyx_RefNannyDeclarations
  std::vector<std::string> ::size_type __pyx_t_1;
  std::vector<std::string> ::size_type __pyx_t_2;
  size_t __pyx_t_3;
  size_t __pyx_t_4;
  size_t __pyx_t_5;
  size_t __pyx_t_6;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("_tokens_from_text", 0);

  /* "dragnet/blocks.pyx":116
 *     cdef bool token
 *     cdef vector[string] ret
 *     for i in range(text.size()):             # <<<<<<<<<<<<<<
 *         token = False
 *         for j in range(text[i].length()):
 */
  __pyx_t_1 = __pyx_v_text.size();
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "dragnet/blocks.pyx":117
 *     cdef vector[string] ret
 *     for i in range(text.size()):
 *         token = False             # <<<<<<<<<<<<<<
 *         for j in range(text[i].length()):
 *             if WHITESPACE.find(text[i][j]) == WHITESPACE.end():
 */
    __pyx_v_token = 0;

    /* "dragnet/blocks.pyx":118
 *     for i in range(text.size()):
 *         token = False
 *         for j in range(text[i].length()):             # <<<<<<<<<<<<<<
 *             if WHITESPACE.find(text[i][j]) == WHITESPACE.end():
 *                 # current char is not whitespace
 */
    __pyx_t_4 = (__pyx_v_text[__pyx_v_i]).length();
    __pyx_t_5 = __pyx_t_4;
    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
      __pyx_v_j = __pyx_t_6;

      /* "dragnet/blocks.pyx":119
 *         token = False
 *         for j in range(text[i].length()):
 *             if WHITESPACE.find(text[i][j]) == WHITESPACE.end():             # <<<<<<<<<<<<<<
 *                 # current char is not whitespace
 *                 if not token:
 */
      __pyx_t_7 = ((__pyx_v_7dragnet_6blocks_WHITESPACE.find(((__pyx_v_text[__pyx_v_i])[__pyx_v_j])) == __pyx_v_7dragnet_6blocks_WHITESPACE.end()) != 0);
      if (__pyx_t_7) {

        /* "dragnet/blocks.pyx":121
 *             if WHITESPACE.find(text[i][j]) == WHITESPACE.end():
 *                 # current char is not whitespace
 *                 if not token:             # <<<<<<<<<<<<<<
 *                     token = True
 *                     start = j
 */
        __pyx_t_7 = ((!(__pyx_v_token != 0)) != 0);
        if (__pyx_t_7) {

          /* "dragnet/blocks.pyx":122
 *                 # current char is not whitespace
 *                 if not token:
 *                     token = True             # <<<<<<<<<<<<<<
 *                     start = j
 *             else:
 */
          __pyx_v_token = 1;

          /* "dragnet/blocks.pyx":123
 *                 if not token:
 *                     token = True
 *                     start = j             # <<<<<<<<<<<<<<
 *             else:
 *                 # a white space character
 */
          __pyx_v_start = __pyx_v_j;

          /* "dragnet/blocks.pyx":121
 *             if WHITESPACE.find(text[i][j]) == WHITESPACE.end():
 *                 # current char is not whitespace
 *                 if not token:             # <<<<<<<<<<<<<<
 *                     token = True
 *                     start = j
 */
        }

        /* "dragnet/blocks.pyx":119
 *         token = False
 *         for j in range(text[i].length()):
 *             if WHITESPACE.find(text[i][j]) == WHITESPACE.end():             # <<<<<<<<<<<<<<
 *                 # current char is not whitespace
 *                 if not token:
 */
        goto __pyx_L7;
      }

      /* "dragnet/blocks.pyx":126
 *             else:
 *                 # a white space character
 *                 if token:             # <<<<<<<<<<<<<<
 *                     # write out token
 *                     ret.push_back(text[i].substr(start, j - start))
 */
      /*else*/ {
        __pyx_t_7 = (__pyx_v_token != 0);
        if (__pyx_t_7) {

          /* "dragnet/blocks.pyx":128
 *                 if token:
 *                     # write out token
 *                     ret.push_back(text[i].substr(start, j - start))             # <<<<<<<<<<<<<<
 *                     token = False
 *         # check last token
 */
          try {
            __pyx_v_ret.push_back((__pyx_v_text[__pyx_v_i]).substr(__pyx_v_start, (__pyx_v_j - __pyx_v_start)));
          } catch(...) {
            __Pyx_CppExn2PyErr();
            __PYX_ERR(0, 128, __pyx_L1_error)
          }

          /* "dragnet/blocks.pyx":129
 *                     # write out token
 *                     ret.push_back(text[i].substr(start, j - start))
 *                     token = False             # <<<<<<<<<<<<<<
 *         # check last token
 *         if token:
 */
          __pyx_v_token = 0;

          /* "dragnet/blocks.pyx":126
 *             else:
 *                 # a white space character
 *                 if token:             # <<<<<<<<<<<<<<
 *                     # write out token
 *                     ret.push_back(text[i].substr(start, j - start))
 */
        }
      }
      __pyx_L7:;
    }

    /* "dragnet/blocks.pyx":131
 *                     token = False
 *         # check last token
 *         if token:             # <<<<<<<<<<<<<<
 *             ret.push_back(text[i].substr(start, text[i].length() - start))
 *     return ret
 */
    __pyx_t_7 = (__pyx_v_token != 0);
    if (__pyx_t_7) {

      /* "dragnet/blocks.pyx":132
 *         # check last token
 *         if token:
 *             ret.push_back(text[i].substr(start, text[i].length() - start))             # <<<<<<<<<<<<<<
 *     return ret
 * 
 */
      try {
        __pyx_v_ret.push_back((__pyx_v_text[__pyx_v_i]).substr(__pyx_v_start, ((__pyx_v_text[__pyx_v_i]).length() - __pyx_v_start)));
      } catch(...) {
        __Pyx_CppExn2PyErr();
        __PYX_ERR(0, 132, __pyx_L1_error)
      }

      /* "dragnet/blocks.pyx":131
 *                     token = False
 *         # check last token
 *         if token:             # <<<<<<<<<<<<<<
 *             ret.push_back(text[i].substr(start, text[i].length() - start))
 *     return ret
 */
    }
  }

  /* "dragnet/blocks.pyx":133
 *         if token:
 *             ret.push_back(text[i].substr(start, text[i].length() - start))
 *     return ret             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  /* "dragnet/blocks.pyx":109
 *     <char>'\r', <char>'\f', <char>'\v'])
 * 
 * cdef vector[string] _tokens_from_text(vector[string] text):             # <<<<<<<<<<<<<<
 *     '''
 *     Given a vector of text, return a vector of individual tokens
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("dragnet.blocks._tokens_from_text", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "dragnet/blocks.pyx":137
 * 
 * class Block(object):
 *     def __init__(self, text, link_density, text_density,             # <<<<<<<<<<<<<<
 *             anchors, link_tokens, css, **kwargs):
 *         self.text = text
 */

/* Python wrapper */
static PyObject *__pyx_pw_7dragnet_6blocks_5Block_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7dragnet_6blocks_5Block_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7dragnet_6blocks_5Block_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7dragnet_6blocks_5Block_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_text = 0;
  PyObject *__pyx_v_link_density = 0;
  PyObject *__pyx_v_text_density = 0;
  PyObject *__pyx_v_anchors = 0;
  PyObject *__pyx_v_link_tokens = 0;
  PyObject *__pyx_v_css = 0;
  PyObject *__pyx_v_kwargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_text,&__pyx_n_s_link_density,&__pyx_n_s_text_density,&__pyx_n_s_anchors,&__pyx_n_s_link_tokens,&__pyx_n_s_css,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_text)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 7, 7, 1); __PYX_ERR(0, 137, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_link_density)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 7, 7, 2); __PYX_ERR(0, 137, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_text_density)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 7, 7, 3); __PYX_ERR(0, 137, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_anchors)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 7, 7, 4); __PYX_ERR(0, 137, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_link_tokens)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 7, 7, 5); __PYX_ERR(0, 137, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_css)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 7, 7, 6); __PYX_ERR(0, 137, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 137, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
    }
    __pyx_v_self = values[0];
    __pyx_v_text = values[1];
    __pyx_v_link_density = values[2];
    __pyx_v_text_density = values[3];
    __pyx_v_anchors = values[4];
    __pyx_v_link_tokens = values[5];
    __pyx_v_css = values[6];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 137, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("dragnet.blocks.Block.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7dragnet_6blocks_5Block___init__(__pyx_self, __pyx_v_self, __pyx_v_text, __pyx_v_link_density, __pyx_v_text_density, __pyx_v_anchors, __pyx_v_link_tokens, __pyx_v_css, __pyx_v_kwargs);

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

static PyObject *__pyx_pf_7dragnet_6blocks_5Block___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_text, PyObject *__pyx_v_link_density, PyObject *__pyx_v_text_density, PyObject *__pyx_v_anchors, PyObject *__pyx_v_link_tokens, PyObject *__pyx_v_css, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "dragnet/blocks.pyx":139
 *     def __init__(self, text, link_density, text_density,
 *             anchors, link_tokens, css, **kwargs):
 *         self.text = text             # <<<<<<<<<<<<<<
 *         self.link_density = link_density
 *         self.text_density = text_density
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_text, __pyx_v_text) < 0) __PYX_ERR(0, 139, __pyx_L1_error)

  /* "dragnet/blocks.pyx":140
 *             anchors, link_tokens, css, **kwargs):
 *         self.text = text
 *         self.link_density = link_density             # <<<<<<<<<<<<<<
 *         self.text_density = text_density
 *         self.anchors = anchors
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_link_density, __pyx_v_link_density) < 0) __PYX_ERR(0, 140, __pyx_L1_error)

  /* "dragnet/blocks.pyx":141
 *         self.text = text
 *         self.link_density = link_density
 *         self.text_density = text_density             # <<<<<<<<<<<<<<
 *         self.anchors = anchors
 *         self.link_tokens = link_tokens  # a hook for testing
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_text_density, __pyx_v_text_density) < 0) __PYX_ERR(0, 141, __pyx_L1_error)

  /* "dragnet/blocks.pyx":142
 *         self.link_density = link_density
 *         self.text_density = text_density
 *         self.anchors = anchors             # <<<<<<<<<<<<<<
 *         self.link_tokens = link_tokens  # a hook for testing
 *         self.css = css
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_anchors, __pyx_v_anchors) < 0) __PYX_ERR(0, 142, __pyx_L1_error)

  /* "dragnet/blocks.pyx":143
 *         self.text_density = text_density
 *         self.anchors = anchors
 *         self.link_tokens = link_tokens  # a hook for testing             # <<<<<<<<<<<<<<
 *         self.css = css
 *         self.features = kwargs
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_link_tokens, __pyx_v_link_tokens) < 0) __PYX_ERR(0, 143, __pyx_L1_error)

  /* "dragnet/blocks.pyx":144
 *         self.anchors = anchors
 *         self.link_tokens = link_tokens  # a hook for testing
 *         self.css = css             # <<<<<<<<<<<<<<
 *         self.features = kwargs
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_css, __pyx_v_css) < 0) __PYX_ERR(0, 144, __pyx_L1_error)

  /* "dragnet/blocks.pyx":145
 *         self.link_tokens = link_tokens  # a hook for testing
 *         self.css = css
 *         self.features = kwargs             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_features, __pyx_v_kwargs) < 0) __PYX_ERR(0, 145, __pyx_L1_error)

  /* "dragnet/blocks.pyx":137
 * 
 * class Block(object):
 *     def __init__(self, text, link_density, text_density,             # <<<<<<<<<<<<<<
 *             anchors, link_tokens, css, **kwargs):
 *         self.text = text
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("dragnet.blocks.Block.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "dragnet/blocks.pyx":155
 * 
 * 
 * cdef vector[string] _text_from_subtree(cetree.tree.xmlNode *tree,             # <<<<<<<<<<<<<<
 *     bool tail, callback_t callback, PartialBlock klass):
 *     '''
 */

static std::vector<std::string>  __pyx_f_7dragnet_6blocks__text_from_subtree(xmlNode *__pyx_v_tree, bool __pyx_v_tail, __pyx_t_7dragnet_6blocks_callback_t __pyx_v_callback, struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_klass) {
  std::vector<std::string>  __pyx_v_text;
  PyObject *__pyx_v_t = 0;
  xmlNode *__pyx_v_node;
  xmlNode *__pyx_v_next_node;
  std::string __pyx_v_tag;
  std::vector<std::string>  __pyx_v_to_add;
  size_t __pyx_v_k;
  std::vector<std::string>  __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  std::string __pyx_t_9;
  int __pyx_t_10;
  std::vector<std::string> ::size_type __pyx_t_11;
  std::vector<std::string> ::size_type __pyx_t_12;
  size_t __pyx_t_13;
  __Pyx_RefNannySetupContext("_text_from_subtree", 0);

  /* "dragnet/blocks.pyx":162
 * 
 *     cdef vector[string] text
 *     text.clear()             # <<<<<<<<<<<<<<
 *     cdef object t
 * 
 */
  __pyx_v_text.clear();

  /* "dragnet/blocks.pyx":165
 *     cdef object t
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         t = cetree.textOf(tree)
 *         if t is not None:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "dragnet/blocks.pyx":166
 * 
 *     try:
 *         t = cetree.textOf(tree)             # <<<<<<<<<<<<<<
 *         if t is not None:
 *             text.push_back(t.encode('utf-8'))
 */
      __pyx_t_4 = textOf(__pyx_v_tree); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 166, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_t = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "dragnet/blocks.pyx":167
 *     try:
 *         t = cetree.textOf(tree)
 *         if t is not None:             # <<<<<<<<<<<<<<
 *             text.push_back(t.encode('utf-8'))
 *     except UnicodeDecodeError:
 */
      __pyx_t_5 = (__pyx_v_t != Py_None);
      __pyx_t_6 = (__pyx_t_5 != 0);
      if (__pyx_t_6) {

        /* "dragnet/blocks.pyx":168
 *         t = cetree.textOf(tree)
 *         if t is not None:
 *             text.push_back(t.encode('utf-8'))             # <<<<<<<<<<<<<<
 *     except UnicodeDecodeError:
 *         pass
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_t, __pyx_n_s_encode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 168, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
          }
        }
        __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_kp_s_utf_8);
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 168, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_9 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L3_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        try {
          __pyx_v_text.push_back(__pyx_t_9);
        } catch(...) {
          __Pyx_CppExn2PyErr();
          __PYX_ERR(0, 168, __pyx_L3_error)
        }

        /* "dragnet/blocks.pyx":167
 *     try:
 *         t = cetree.textOf(tree)
 *         if t is not None:             # <<<<<<<<<<<<<<
 *             text.push_back(t.encode('utf-8'))
 *     except UnicodeDecodeError:
 */
      }

      /* "dragnet/blocks.pyx":165
 *     cdef object t
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         t = cetree.textOf(tree)
 *         if t is not None:
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "dragnet/blocks.pyx":169
 *         if t is not None:
 *             text.push_back(t.encode('utf-8'))
 *     except UnicodeDecodeError:             # <<<<<<<<<<<<<<
 *         pass
 * 
 */
    __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
    if (__pyx_t_10) {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "dragnet/blocks.pyx":165
 *     cdef object t
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         t = cetree.textOf(tree)
 *         if t is not None:
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L8_try_end:;
  }

  /* "dragnet/blocks.pyx":178
 *     cdef size_t k
 * 
 *     if cetree.hasChild(tree):             # <<<<<<<<<<<<<<
 *         node = cetree.findChild(tree, 0)
 *     else:
 */
  __pyx_t_6 = (hasChild(__pyx_v_tree) != 0);
  if (__pyx_t_6) {

    /* "dragnet/blocks.pyx":179
 * 
 *     if cetree.hasChild(tree):
 *         node = cetree.findChild(tree, 0)             # <<<<<<<<<<<<<<
 *     else:
 *         node = NULL
 */
    __pyx_v_node = findChild(__pyx_v_tree, 0);

    /* "dragnet/blocks.pyx":178
 *     cdef size_t k
 * 
 *     if cetree.hasChild(tree):             # <<<<<<<<<<<<<<
 *         node = cetree.findChild(tree, 0)
 *     else:
 */
    goto __pyx_L10;
  }

  /* "dragnet/blocks.pyx":181
 *         node = cetree.findChild(tree, 0)
 *     else:
 *         node = NULL             # <<<<<<<<<<<<<<
 * 
 *     while node != NULL:
 */
  /*else*/ {
    __pyx_v_node = NULL;
  }
  __pyx_L10:;

  /* "dragnet/blocks.pyx":183
 *         node = NULL
 * 
 *     while node != NULL:             # <<<<<<<<<<<<<<
 * 
 *         # get the tag
 */
  while (1) {
    __pyx_t_6 = ((__pyx_v_node != NULL) != 0);
    if (!__pyx_t_6) break;

    /* "dragnet/blocks.pyx":186
 * 
 *         # get the tag
 *         tag = <string> cetree.namespacedName(node).encode('utf-8')             # <<<<<<<<<<<<<<
 * 
 *         # call the feature extractor child hooks
 */
    __pyx_t_7 = namespacedName(__pyx_v_node); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 186, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_encode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 186, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_kp_s_utf_8);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 186, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_9 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 186, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_tag = ((std::string)__pyx_t_9);

    /* "dragnet/blocks.pyx":189
 * 
 *         # call the feature extractor child hooks
 *         callback(klass, tag)             # <<<<<<<<<<<<<<
 * 
 *         # check whether in black list
 */
    __pyx_v_callback(__pyx_v_klass, __pyx_v_tag);

    /* "dragnet/blocks.pyx":192
 * 
 *         # check whether in black list
 *         if BLACKLIST.find(tag) == BLACKLIST.end():             # <<<<<<<<<<<<<<
 *             to_add = _text_from_subtree(node, True, callback, klass)
 *             for k in range(to_add.size()):
 */
    __pyx_t_6 = ((__pyx_v_7dragnet_6blocks_BLACKLIST.find(__pyx_v_tag) == __pyx_v_7dragnet_6blocks_BLACKLIST.end()) != 0);
    if (__pyx_t_6) {

      /* "dragnet/blocks.pyx":193
 *         # check whether in black list
 *         if BLACKLIST.find(tag) == BLACKLIST.end():
 *             to_add = _text_from_subtree(node, True, callback, klass)             # <<<<<<<<<<<<<<
 *             for k in range(to_add.size()):
 *                 text.push_back(to_add[k])
 */
      __pyx_v_to_add = __pyx_f_7dragnet_6blocks__text_from_subtree(__pyx_v_node, 1, __pyx_v_callback, __pyx_v_klass);

      /* "dragnet/blocks.pyx":194
 *         if BLACKLIST.find(tag) == BLACKLIST.end():
 *             to_add = _text_from_subtree(node, True, callback, klass)
 *             for k in range(to_add.size()):             # <<<<<<<<<<<<<<
 *                 text.push_back(to_add[k])
 *         else:
 */
      __pyx_t_11 = __pyx_v_to_add.size();
      __pyx_t_12 = __pyx_t_11;
      for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
        __pyx_v_k = __pyx_t_13;

        /* "dragnet/blocks.pyx":195
 *             to_add = _text_from_subtree(node, True, callback, klass)
 *             for k in range(to_add.size()):
 *                 text.push_back(to_add[k])             # <<<<<<<<<<<<<<
 *         else:
 *             # get the tail
 */
        try {
          __pyx_v_text.push_back((__pyx_v_to_add[__pyx_v_k]));
        } catch(...) {
          __Pyx_CppExn2PyErr();
          __PYX_ERR(0, 195, __pyx_L1_error)
        }
      }

      /* "dragnet/blocks.pyx":192
 * 
 *         # check whether in black list
 *         if BLACKLIST.find(tag) == BLACKLIST.end():             # <<<<<<<<<<<<<<
 *             to_add = _text_from_subtree(node, True, callback, klass)
 *             for k in range(to_add.size()):
 */
      goto __pyx_L13;
    }

    /* "dragnet/blocks.pyx":198
 *         else:
 *             # get the tail
 *             try:             # <<<<<<<<<<<<<<
 *                 t = cetree.tailOf(node)
 *                 if t is not None:
 */
    /*else*/ {
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
        __Pyx_XGOTREF(__pyx_t_3);
        __Pyx_XGOTREF(__pyx_t_2);
        __Pyx_XGOTREF(__pyx_t_1);
        /*try:*/ {

          /* "dragnet/blocks.pyx":199
 *             # get the tail
 *             try:
 *                 t = cetree.tailOf(node)             # <<<<<<<<<<<<<<
 *                 if t is not None:
 *                     text.push_back(t.encode('utf-8'))
 */
          __pyx_t_4 = tailOf(__pyx_v_node); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 199, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
          __pyx_t_4 = 0;

          /* "dragnet/blocks.pyx":200
 *             try:
 *                 t = cetree.tailOf(node)
 *                 if t is not None:             # <<<<<<<<<<<<<<
 *                     text.push_back(t.encode('utf-8'))
 *             except UnicodeDecodeError:
 */
          __pyx_t_6 = (__pyx_v_t != Py_None);
          __pyx_t_5 = (__pyx_t_6 != 0);
          if (__pyx_t_5) {

            /* "dragnet/blocks.pyx":201
 *                 t = cetree.tailOf(node)
 *                 if t is not None:
 *                     text.push_back(t.encode('utf-8'))             # <<<<<<<<<<<<<<
 *             except UnicodeDecodeError:
 *                 pass
 */
            __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_t, __pyx_n_s_encode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 201, __pyx_L16_error)
            __Pyx_GOTREF(__pyx_t_8);
            __pyx_t_7 = NULL;
            if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
              __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
              if (likely(__pyx_t_7)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
                __Pyx_INCREF(__pyx_t_7);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_8, function);
              }
            }
            __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_kp_s_utf_8);
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 201, __pyx_L16_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __pyx_t_9 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 201, __pyx_L16_error)
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            try {
              __pyx_v_text.push_back(__pyx_t_9);
            } catch(...) {
              __Pyx_CppExn2PyErr();
              __PYX_ERR(0, 201, __pyx_L16_error)
            }

            /* "dragnet/blocks.pyx":200
 *             try:
 *                 t = cetree.tailOf(node)
 *                 if t is not None:             # <<<<<<<<<<<<<<
 *                     text.push_back(t.encode('utf-8'))
 *             except UnicodeDecodeError:
 */
          }

          /* "dragnet/blocks.pyx":198
 *         else:
 *             # get the tail
 *             try:             # <<<<<<<<<<<<<<
 *                 t = cetree.tailOf(node)
 *                 if t is not None:
 */
        }
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L23_try_end;
        __pyx_L16_error:;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "dragnet/blocks.pyx":202
 *                 if t is not None:
 *                     text.push_back(t.encode('utf-8'))
 *             except UnicodeDecodeError:             # <<<<<<<<<<<<<<
 *                 pass
 * 
 */
        __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
        if (__pyx_t_10) {
          __Pyx_ErrRestore(0,0,0);
          goto __pyx_L17_exception_handled;
        }
        goto __pyx_L18_except_error;
        __pyx_L18_except_error:;

        /* "dragnet/blocks.pyx":198
 *         else:
 *             # get the tail
 *             try:             # <<<<<<<<<<<<<<
 *                 t = cetree.tailOf(node)
 *                 if t is not None:
 */
        __Pyx_XGIVEREF(__pyx_t_3);
        __Pyx_XGIVEREF(__pyx_t_2);
        __Pyx_XGIVEREF(__pyx_t_1);
        __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
        goto __pyx_L1_error;
        __pyx_L17_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_3);
        __Pyx_XGIVEREF(__pyx_t_2);
        __Pyx_XGIVEREF(__pyx_t_1);
        __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
        __pyx_L23_try_end:;
      }
    }
    __pyx_L13:;

    /* "dragnet/blocks.pyx":205
 *                 pass
 * 
 *         next_node = cetree.nextElement(node)             # <<<<<<<<<<<<<<
 *         node = next_node
 * 
 */
    __pyx_v_next_node = nextElement(__pyx_v_node);

    /* "dragnet/blocks.pyx":206
 * 
 *         next_node = cetree.nextElement(node)
 *         node = next_node             # <<<<<<<<<<<<<<
 * 
 *     if tail:
 */
    __pyx_v_node = __pyx_v_next_node;
  }

  /* "dragnet/blocks.pyx":208
 *         node = next_node
 * 
 *     if tail:             # <<<<<<<<<<<<<<
 *         try:
 *             t = cetree.tailOf(tree)
 */
  __pyx_t_5 = (__pyx_v_tail != 0);
  if (__pyx_t_5) {

    /* "dragnet/blocks.pyx":209
 * 
 *     if tail:
 *         try:             # <<<<<<<<<<<<<<
 *             t = cetree.tailOf(tree)
 *             if t is not None:
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_3);
      /*try:*/ {

        /* "dragnet/blocks.pyx":210
 *     if tail:
 *         try:
 *             t = cetree.tailOf(tree)             # <<<<<<<<<<<<<<
 *             if t is not None:
 *                 text.push_back(t.encode('utf-8'))
 */
        __pyx_t_4 = tailOf(__pyx_v_tree); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 210, __pyx_L26_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "dragnet/blocks.pyx":211
 *         try:
 *             t = cetree.tailOf(tree)
 *             if t is not None:             # <<<<<<<<<<<<<<
 *                 text.push_back(t.encode('utf-8'))
 *         except UnicodeDecodeError:
 */
        __pyx_t_5 = (__pyx_v_t != Py_None);
        __pyx_t_6 = (__pyx_t_5 != 0);
        if (__pyx_t_6) {

          /* "dragnet/blocks.pyx":212
 *             t = cetree.tailOf(tree)
 *             if t is not None:
 *                 text.push_back(t.encode('utf-8'))             # <<<<<<<<<<<<<<
 *         except UnicodeDecodeError:
 *             pass
 */
          __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_t, __pyx_n_s_encode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 212, __pyx_L26_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_7 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
            __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
            if (likely(__pyx_t_7)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
              __Pyx_INCREF(__pyx_t_7);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_8, function);
            }
          }
          __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_kp_s_utf_8);
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 212, __pyx_L26_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_9 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 212, __pyx_L26_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          try {
            __pyx_v_text.push_back(__pyx_t_9);
          } catch(...) {
            __Pyx_CppExn2PyErr();
            __PYX_ERR(0, 212, __pyx_L26_error)
          }

          /* "dragnet/blocks.pyx":211
 *         try:
 *             t = cetree.tailOf(tree)
 *             if t is not None:             # <<<<<<<<<<<<<<
 *                 text.push_back(t.encode('utf-8'))
 *         except UnicodeDecodeError:
 */
        }

        /* "dragnet/blocks.pyx":209
 * 
 *     if tail:
 *         try:             # <<<<<<<<<<<<<<
 *             t = cetree.tailOf(tree)
 *             if t is not None:
 */
      }
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L31_try_end;
      __pyx_L26_error:;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "dragnet/blocks.pyx":213
 *             if t is not None:
 *                 text.push_back(t.encode('utf-8'))
 *         except UnicodeDecodeError:             # <<<<<<<<<<<<<<
 *             pass
 * 
 */
      __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
      if (__pyx_t_10) {
        __Pyx_ErrRestore(0,0,0);
        goto __pyx_L27_exception_handled;
      }
      goto __pyx_L28_except_error;
      __pyx_L28_except_error:;

      /* "dragnet/blocks.pyx":209
 * 
 *     if tail:
 *         try:             # <<<<<<<<<<<<<<
 *             t = cetree.tailOf(tree)
 *             if t is not None:
 */
      __Pyx_XGIVEREF(__pyx_t_1);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
      goto __pyx_L1_error;
      __pyx_L27_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_1);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
      __pyx_L31_try_end:;
    }

    /* "dragnet/blocks.pyx":208
 *         node = next_node
 * 
 *     if tail:             # <<<<<<<<<<<<<<
 *         try:
 *             t = cetree.tailOf(tree)
 */
  }

  /* "dragnet/blocks.pyx":216
 *             pass
 * 
 *     return text             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_text;
  goto __pyx_L0;

  /* "dragnet/blocks.pyx":155
 * 
 * 
 * cdef vector[string] _text_from_subtree(cetree.tree.xmlNode *tree,             # <<<<<<<<<<<<<<
 *     bool tail, callback_t callback, PartialBlock klass):
 *     '''
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_WriteUnraisable("dragnet.blocks._text_from_subtree", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "dragnet/blocks.pyx":219
 * 
 * 
 * def text_from_subtree(tree, tags_exclude=set(), tail=True, callback=None):             # <<<<<<<<<<<<<<
 *     """Get all the text
 *     from the subtree, excluding tags_exclude
 */

/* Python wrapper */
static PyObject *__pyx_pw_7dragnet_6blocks_3text_from_subtree(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7dragnet_6blocks_2text_from_subtree[] = "Get all the text\n    from the subtree, excluding tags_exclude\n    If tail=False, then don't append the tail for this top level element\n    callbacks = called with callback(child) when iterating through the tree";
static PyMethodDef __pyx_mdef_7dragnet_6blocks_3text_from_subtree = {"text_from_subtree", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7dragnet_6blocks_3text_from_subtree, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7dragnet_6blocks_2text_from_subtree};
static PyObject *__pyx_pw_7dragnet_6blocks_3text_from_subtree(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tree = 0;
  PyObject *__pyx_v_tags_exclude = 0;
  PyObject *__pyx_v_tail = 0;
  PyObject *__pyx_v_callback = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("text_from_subtree (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tree,&__pyx_n_s_tags_exclude,&__pyx_n_s_tail,&__pyx_n_s_callback,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = __pyx_k_;
    values[2] = ((PyObject *)Py_True);
    values[3] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tree)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tags_exclude);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tail);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "text_from_subtree") < 0)) __PYX_ERR(0, 219, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_tree = values[0];
    __pyx_v_tags_exclude = values[1];
    __pyx_v_tail = values[2];
    __pyx_v_callback = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("text_from_subtree", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 219, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("dragnet.blocks.text_from_subtree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7dragnet_6blocks_2text_from_subtree(__pyx_self, __pyx_v_tree, __pyx_v_tags_exclude, __pyx_v_tail, __pyx_v_callback);

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

static PyObject *__pyx_pf_7dragnet_6blocks_2text_from_subtree(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tree, PyObject *__pyx_v_tags_exclude, PyObject *__pyx_v_tail, PyObject *__pyx_v_callback) {
  PyObject *__pyx_v_text = NULL;
  PyObject *__pyx_v_child = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  Py_ssize_t __pyx_t_10;
  PyObject *(*__pyx_t_11)(PyObject *);
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  __Pyx_RefNannySetupContext("text_from_subtree", 0);

  /* "dragnet/blocks.pyx":224
 *     If tail=False, then don't append the tail for this top level element
 *     callbacks = called with callback(child) when iterating through the tree"""
 *     try:             # <<<<<<<<<<<<<<
 *         text = [tree.text or '']
 *     except UnicodeDecodeError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "dragnet/blocks.pyx":225
 *     callbacks = called with callback(child) when iterating through the tree"""
 *     try:
 *         text = [tree.text or '']             # <<<<<<<<<<<<<<
 *     except UnicodeDecodeError:
 *         text = []
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_text); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 225, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 225, __pyx_L3_error)
      if (!__pyx_t_6) {
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else {
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_4 = __pyx_t_5;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L9_bool_binop_done;
      }
      __Pyx_INCREF(__pyx_kp_s__2);
      __pyx_t_4 = __pyx_kp_s__2;
      __pyx_L9_bool_binop_done:;
      __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 225, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_4);
      PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_v_text = ((PyObject*)__pyx_t_5);
      __pyx_t_5 = 0;

      /* "dragnet/blocks.pyx":224
 *     If tail=False, then don't append the tail for this top level element
 *     callbacks = called with callback(child) when iterating through the tree"""
 *     try:             # <<<<<<<<<<<<<<
 *         text = [tree.text or '']
 *     except UnicodeDecodeError:
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "dragnet/blocks.pyx":226
 *     try:
 *         text = [tree.text or '']
 *     except UnicodeDecodeError:             # <<<<<<<<<<<<<<
 *         text = []
 *     for child in tree.iterchildren():
 */
    __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
    if (__pyx_t_7) {
      __Pyx_AddTraceback("dragnet.blocks.text_from_subtree", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_8) < 0) __PYX_ERR(0, 226, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_8);

      /* "dragnet/blocks.pyx":227
 *         text = [tree.text or '']
 *     except UnicodeDecodeError:
 *         text = []             # <<<<<<<<<<<<<<
 *     for child in tree.iterchildren():
 * 
 */
      __pyx_t_9 = PyList_New(0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 227, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_XDECREF_SET(__pyx_v_text, ((PyObject*)__pyx_t_9));
      __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "dragnet/blocks.pyx":224
 *     If tail=False, then don't append the tail for this top level element
 *     callbacks = called with callback(child) when iterating through the tree"""
 *     try:             # <<<<<<<<<<<<<<
 *         text = [tree.text or '']
 *     except UnicodeDecodeError:
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L8_try_end:;
  }

  /* "dragnet/blocks.pyx":228
 *     except UnicodeDecodeError:
 *         text = []
 *     for child in tree.iterchildren():             # <<<<<<<<<<<<<<
 * 
 *         # call the feature extractor child hooks
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_iterchildren); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_8 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (likely(PyList_CheckExact(__pyx_t_8)) || PyTuple_CheckExact(__pyx_t_8)) {
    __pyx_t_4 = __pyx_t_8; __Pyx_INCREF(__pyx_t_4); __pyx_t_10 = 0;
    __pyx_t_11 = NULL;
  } else {
    __pyx_t_10 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 228, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_11 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 228, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  for (;;) {
    if (likely(!__pyx_t_11)) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_8 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_10); __Pyx_INCREF(__pyx_t_8); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 228, __pyx_L1_error)
        #else
        __pyx_t_8 = PySequence_ITEM(__pyx_t_4, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 228, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        #endif
      } else {
        if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_10); __Pyx_INCREF(__pyx_t_8); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 228, __pyx_L1_error)
        #else
        __pyx_t_8 = PySequence_ITEM(__pyx_t_4, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 228, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        #endif
      }
    } else {
      __pyx_t_8 = __pyx_t_11(__pyx_t_4);
      if (unlikely(!__pyx_t_8)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 228, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_8);
    }
    __Pyx_XDECREF_SET(__pyx_v_child, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "dragnet/blocks.pyx":231
 * 
 *         # call the feature extractor child hooks
 *         if callback:             # <<<<<<<<<<<<<<
 *             callback(child)
 * 
 */
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_callback); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 231, __pyx_L1_error)
    if (__pyx_t_6) {

      /* "dragnet/blocks.pyx":232
 *         # call the feature extractor child hooks
 *         if callback:
 *             callback(child)             # <<<<<<<<<<<<<<
 * 
 *         if child.tag not in tags_exclude:
 */
      __Pyx_INCREF(__pyx_v_callback);
      __pyx_t_5 = __pyx_v_callback; __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_8 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_9, __pyx_v_child) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_child);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 232, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "dragnet/blocks.pyx":231
 * 
 *         # call the feature extractor child hooks
 *         if callback:             # <<<<<<<<<<<<<<
 *             callback(child)
 * 
 */
    }

    /* "dragnet/blocks.pyx":234
 *             callback(child)
 * 
 *         if child.tag not in tags_exclude:             # <<<<<<<<<<<<<<
 *             text.extend(text_from_subtree(child, tags_exclude=tags_exclude, callback=callback))
 *         else:
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_child, __pyx_n_s_tag); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_t_8, __pyx_v_tags_exclude, Py_NE)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 234, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_12 = (__pyx_t_6 != 0);
    if (__pyx_t_12) {

      /* "dragnet/blocks.pyx":235
 * 
 *         if child.tag not in tags_exclude:
 *             text.extend(text_from_subtree(child, tags_exclude=tags_exclude, callback=callback))             # <<<<<<<<<<<<<<
 *         else:
 *             # get the tail
 */
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_text_from_subtree); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 235, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 235, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_child);
      __Pyx_GIVEREF(__pyx_v_child);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_child);
      __pyx_t_9 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 235, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_tags_exclude, __pyx_v_tags_exclude) < 0) __PYX_ERR(0, 235, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_callback, __pyx_v_callback) < 0) __PYX_ERR(0, 235, __pyx_L1_error)
      __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_5, __pyx_t_9); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 235, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_14 = __Pyx_PyList_Extend(__pyx_v_text, __pyx_t_13); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 235, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

      /* "dragnet/blocks.pyx":234
 *             callback(child)
 * 
 *         if child.tag not in tags_exclude:             # <<<<<<<<<<<<<<
 *             text.extend(text_from_subtree(child, tags_exclude=tags_exclude, callback=callback))
 *         else:
 */
      goto __pyx_L16;
    }

    /* "dragnet/blocks.pyx":238
 *         else:
 *             # get the tail
 *             try:             # <<<<<<<<<<<<<<
 *                 text.append(child.tail or '')
 *             except UnicodeDecodeError:
 */
    /*else*/ {
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
        __Pyx_XGOTREF(__pyx_t_3);
        __Pyx_XGOTREF(__pyx_t_2);
        __Pyx_XGOTREF(__pyx_t_1);
        /*try:*/ {

          /* "dragnet/blocks.pyx":239
 *             # get the tail
 *             try:
 *                 text.append(child.tail or '')             # <<<<<<<<<<<<<<
 *             except UnicodeDecodeError:
 *                 pass
 */
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_child, __pyx_n_s_tail); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 239, __pyx_L17_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 239, __pyx_L17_error)
          if (!__pyx_t_12) {
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          } else {
            __Pyx_INCREF(__pyx_t_9);
            __pyx_t_13 = __pyx_t_9;
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            goto __pyx_L25_bool_binop_done;
          }
          __Pyx_INCREF(__pyx_kp_s__2);
          __pyx_t_13 = __pyx_kp_s__2;
          __pyx_L25_bool_binop_done:;
          __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_text, __pyx_t_13); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 239, __pyx_L17_error)
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

          /* "dragnet/blocks.pyx":238
 *         else:
 *             # get the tail
 *             try:             # <<<<<<<<<<<<<<
 *                 text.append(child.tail or '')
 *             except UnicodeDecodeError:
 */
        }
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L24_try_end;
        __pyx_L17_error:;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

        /* "dragnet/blocks.pyx":240
 *             try:
 *                 text.append(child.tail or '')
 *             except UnicodeDecodeError:             # <<<<<<<<<<<<<<
 *                 pass
 *     if tail:
 */
        __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
        if (__pyx_t_7) {
          __Pyx_ErrRestore(0,0,0);
          goto __pyx_L18_exception_handled;
        }
        goto __pyx_L19_except_error;
        __pyx_L19_except_error:;

        /* "dragnet/blocks.pyx":238
 *         else:
 *             # get the tail
 *             try:             # <<<<<<<<<<<<<<
 *                 text.append(child.tail or '')
 *             except UnicodeDecodeError:
 */
        __Pyx_XGIVEREF(__pyx_t_3);
        __Pyx_XGIVEREF(__pyx_t_2);
        __Pyx_XGIVEREF(__pyx_t_1);
        __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
        goto __pyx_L1_error;
        __pyx_L18_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_3);
        __Pyx_XGIVEREF(__pyx_t_2);
        __Pyx_XGIVEREF(__pyx_t_1);
        __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
        __pyx_L24_try_end:;
      }
    }
    __pyx_L16:;

    /* "dragnet/blocks.pyx":228
 *     except UnicodeDecodeError:
 *         text = []
 *     for child in tree.iterchildren():             # <<<<<<<<<<<<<<
 * 
 *         # call the feature extractor child hooks
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "dragnet/blocks.pyx":242
 *             except UnicodeDecodeError:
 *                 pass
 *     if tail:             # <<<<<<<<<<<<<<
 *         try:
 *             text.append(tree.tail or '')
 */
  __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_tail); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 242, __pyx_L1_error)
  if (__pyx_t_12) {

    /* "dragnet/blocks.pyx":243
 *                 pass
 *     if tail:
 *         try:             # <<<<<<<<<<<<<<
 *             text.append(tree.tail or '')
 *         except UnicodeDecodeError:
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_3);
      /*try:*/ {

        /* "dragnet/blocks.pyx":244
 *     if tail:
 *         try:
 *             text.append(tree.tail or '')             # <<<<<<<<<<<<<<
 *         except UnicodeDecodeError:
 *             pass
 */
        __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_tail); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 244, __pyx_L28_error)
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 244, __pyx_L28_error)
        if (!__pyx_t_12) {
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        } else {
          __Pyx_INCREF(__pyx_t_13);
          __pyx_t_4 = __pyx_t_13;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          goto __pyx_L34_bool_binop_done;
        }
        __Pyx_INCREF(__pyx_kp_s__2);
        __pyx_t_4 = __pyx_kp_s__2;
        __pyx_L34_bool_binop_done:;
        __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_text, __pyx_t_4); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 244, __pyx_L28_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "dragnet/blocks.pyx":243
 *                 pass
 *     if tail:
 *         try:             # <<<<<<<<<<<<<<
 *             text.append(tree.tail or '')
 *         except UnicodeDecodeError:
 */
      }
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L33_try_end;
      __pyx_L28_error:;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "dragnet/blocks.pyx":245
 *         try:
 *             text.append(tree.tail or '')
 *         except UnicodeDecodeError:             # <<<<<<<<<<<<<<
 *             pass
 *     return text
 */
      __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
      if (__pyx_t_7) {
        __Pyx_ErrRestore(0,0,0);
        goto __pyx_L29_exception_handled;
      }
      goto __pyx_L30_except_error;
      __pyx_L30_except_error:;

      /* "dragnet/blocks.pyx":243
 *                 pass
 *     if tail:
 *         try:             # <<<<<<<<<<<<<<
 *             text.append(tree.tail or '')
 *         except UnicodeDecodeError:
 */
      __Pyx_XGIVEREF(__pyx_t_1);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
      goto __pyx_L1_error;
      __pyx_L29_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_1);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
      __pyx_L33_try_end:;
    }

    /* "dragnet/blocks.pyx":242
 *             except UnicodeDecodeError:
 *                 pass
 *     if tail:             # <<<<<<<<<<<<<<
 *         try:
 *             text.append(tree.tail or '')
 */
  }

  /* "dragnet/blocks.pyx":247
 *         except UnicodeDecodeError:
 *             pass
 *     return text             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_text);
  __pyx_r = __pyx_v_text;
  goto __pyx_L0;

  /* "dragnet/blocks.pyx":219
 * 
 * 
 * def text_from_subtree(tree, tags_exclude=set(), tail=True, callback=None):             # <<<<<<<<<<<<<<
 *     """Get all the text
 *     from the subtree, excluding tags_exclude
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("dragnet.blocks.text_from_subtree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_text);
  __Pyx_XDECREF(__pyx_v_child);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "dragnet/blocks.pyx":326
 *     cdef vector[pair[uint32_t, int] ] class_weights
 * 
 *     def __cinit__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         self.css_attrib.clear()
 *         self.css_attrib.push_back('id')
 */

/* Python wrapper */
static int __pyx_pw_7dragnet_6blocks_12PartialBlock_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7dragnet_6blocks_12PartialBlock_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_args = 0;
  CYTHON_UNUSED PyObject *__pyx_v_kwargs = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 1))) return -1;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_7dragnet_6blocks_12PartialBlock___cinit__(((struct __pyx_obj_7dragnet_6blocks_PartialBlock *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs);

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

static int __pyx_pf_7dragnet_6blocks_12PartialBlock___cinit__(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  std::string __pyx_t_1;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "dragnet/blocks.pyx":327
 * 
 *     def __cinit__(self, *args, **kwargs):
 *         self.css_attrib.clear()             # <<<<<<<<<<<<<<
 *         self.css_attrib.push_back('id')
 *         self.css_attrib.push_back('class')
 */
  __pyx_v_self->css_attrib.clear();

  /* "dragnet/blocks.pyx":328
 *     def __cinit__(self, *args, **kwargs):
 *         self.css_attrib.clear()
 *         self.css_attrib.push_back('id')             # <<<<<<<<<<<<<<
 *         self.css_attrib.push_back('class')
 * 
 */
  __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_id); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 328, __pyx_L1_error)
  try {
    __pyx_v_self->css_attrib.push_back(__pyx_t_1);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 328, __pyx_L1_error)
  }

  /* "dragnet/blocks.pyx":329
 *         self.css_attrib.clear()
 *         self.css_attrib.push_back('id')
 *         self.css_attrib.push_back('class')             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, do_css=True, do_readability=False):
 */
  __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_class); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 329, __pyx_L1_error)
  try {
    __pyx_v_self->css_attrib.push_back(__pyx_t_1);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 329, __pyx_L1_error)
  }

  /* "dragnet/blocks.pyx":326
 *     cdef vector[pair[uint32_t, int] ] class_weights
 * 
 *     def __cinit__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         self.css_attrib.clear()
 *         self.css_attrib.push_back('id')
 */

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

/* "dragnet/blocks.pyx":331
 *         self.css_attrib.push_back('class')
 * 
 *     def __init__(self, do_css=True, do_readability=False):             # <<<<<<<<<<<<<<
 *         self._tag_func.clear()
 *         self._reinit_func.clear()
 */

/* Python wrapper */
static int __pyx_pw_7dragnet_6blocks_12PartialBlock_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7dragnet_6blocks_12PartialBlock_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_do_css = 0;
  PyObject *__pyx_v_do_readability = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_do_css,&__pyx_n_s_do_readability,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_True);
    values[1] = ((PyObject *)Py_False);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_do_css);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_do_readability);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 331, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_do_css = values[0];
    __pyx_v_do_readability = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 331, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("dragnet.blocks.PartialBlock.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7dragnet_6blocks_12PartialBlock_2__init__(((struct __pyx_obj_7dragnet_6blocks_PartialBlock *)__pyx_v_self), __pyx_v_do_css, __pyx_v_do_readability);

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

static int __pyx_pf_7dragnet_6blocks_12PartialBlock_2__init__(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self, PyObject *__pyx_v_do_css, PyObject *__pyx_v_do_readability) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  bool __pyx_t_1;
  std::string __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "dragnet/blocks.pyx":332
 * 
 *     def __init__(self, do_css=True, do_readability=False):
 *         self._tag_func.clear()             # <<<<<<<<<<<<<<
 *         self._reinit_func.clear()
 *         self._name_func.clear()
 */
  __pyx_v_self->_tag_func.clear();

  /* "dragnet/blocks.pyx":333
 *     def __init__(self, do_css=True, do_readability=False):
 *         self._tag_func.clear()
 *         self._reinit_func.clear()             # <<<<<<<<<<<<<<
 *         self._name_func.clear()
 *         self._subtree_func.clear()
 */
  __pyx_v_self->_reinit_func.clear();

  /* "dragnet/blocks.pyx":334
 *         self._tag_func.clear()
 *         self._reinit_func.clear()
 *         self._name_func.clear()             # <<<<<<<<<<<<<<
 *         self._subtree_func.clear()
 *         self.reinit()
 */
  __pyx_v_self->_name_func.clear();

  /* "dragnet/blocks.pyx":335
 *         self._reinit_func.clear()
 *         self._name_func.clear()
 *         self._subtree_func.clear()             # <<<<<<<<<<<<<<
 *         self.reinit()
 *         self.reinit_css(True)
 */
  __pyx_v_self->_subtree_func.clear();

  /* "dragnet/blocks.pyx":336
 *         self._name_func.clear()
 *         self._subtree_func.clear()
 *         self.reinit()             # <<<<<<<<<<<<<<
 *         self.reinit_css(True)
 *         self.do_css = do_css
 */
  ((struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock *)__pyx_v_self->__pyx_vtab)->reinit(__pyx_v_self);

  /* "dragnet/blocks.pyx":337
 *         self._subtree_func.clear()
 *         self.reinit()
 *         self.reinit_css(True)             # <<<<<<<<<<<<<<
 *         self.do_css = do_css
 * 
 */
  ((struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock *)__pyx_v_self->__pyx_vtab)->reinit_css(__pyx_v_self, 1);

  /* "dragnet/blocks.pyx":338
 *         self.reinit()
 *         self.reinit_css(True)
 *         self.do_css = do_css             # <<<<<<<<<<<<<<
 * 
 *         self.block_start_tag = b''
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_do_css); if (unlikely((__pyx_t_1 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 338, __pyx_L1_error)
  __pyx_v_self->do_css = __pyx_t_1;

  /* "dragnet/blocks.pyx":340
 *         self.do_css = do_css
 * 
 *         self.block_start_tag = b''             # <<<<<<<<<<<<<<
 *         self.block_start_element = None
 * 
 */
  __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_kp_b__2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 340, __pyx_L1_error)
  __pyx_v_self->block_start_tag = __pyx_t_2;

  /* "dragnet/blocks.pyx":341
 * 
 *         self.block_start_tag = b''
 *         self.block_start_element = None             # <<<<<<<<<<<<<<
 * 
 *         self.do_readability = do_readability
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->block_start_element);
  __Pyx_DECREF(__pyx_v_self->block_start_element);
  __pyx_v_self->block_start_element = Py_None;

  /* "dragnet/blocks.pyx":343
 *         self.block_start_element = None
 * 
 *         self.do_readability = do_readability             # <<<<<<<<<<<<<<
 *         self.ancestors.clear()
 *         self.ancestors_write.clear()
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_do_readability); if (unlikely((__pyx_t_1 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 343, __pyx_L1_error)
  __pyx_v_self->do_readability = __pyx_t_1;

  /* "dragnet/blocks.pyx":344
 * 
 *         self.do_readability = do_readability
 *         self.ancestors.clear()             # <<<<<<<<<<<<<<
 *         self.ancestors_write.clear()
 *         self.tag_id = 0
 */
  __pyx_v_self->ancestors.clear();

  /* "dragnet/blocks.pyx":345
 *         self.do_readability = do_readability
 *         self.ancestors.clear()
 *         self.ancestors_write.clear()             # <<<<<<<<<<<<<<
 *         self.tag_id = 0
 *         self.next_tag_id = 1
 */
  __pyx_v_self->ancestors_write.clear();

  /* "dragnet/blocks.pyx":346
 *         self.ancestors.clear()
 *         self.ancestors_write.clear()
 *         self.tag_id = 0             # <<<<<<<<<<<<<<
 *         self.next_tag_id = 1
 *         self.class_weights_written.clear()
 */
  __pyx_v_self->tag_id = 0;

  /* "dragnet/blocks.pyx":347
 *         self.ancestors_write.clear()
 *         self.tag_id = 0
 *         self.next_tag_id = 1             # <<<<<<<<<<<<<<
 *         self.class_weights_written.clear()
 *         self.class_weights.clear()
 */
  __pyx_v_self->next_tag_id = 1;

  /* "dragnet/blocks.pyx":348
 *         self.tag_id = 0
 *         self.next_tag_id = 1
 *         self.class_weights_written.clear()             # <<<<<<<<<<<<<<
 *         self.class_weights.clear()
 *         if do_readability:
 */
  __pyx_v_self->class_weights_written.clear();

  /* "dragnet/blocks.pyx":349
 *         self.next_tag_id = 1
 *         self.class_weights_written.clear()
 *         self.class_weights.clear()             # <<<<<<<<<<<<<<
 *         if do_readability:
 *             self._subtree_func.push_back(
 */
  __pyx_v_self->class_weights.clear();

  /* "dragnet/blocks.pyx":350
 *         self.class_weights_written.clear()
 *         self.class_weights.clear()
 *         if do_readability:             # <<<<<<<<<<<<<<
 *             self._subtree_func.push_back(
 *                 <subtree_t>PartialBlock.subtree_readability)
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_do_readability); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 350, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "dragnet/blocks.pyx":351
 *         self.class_weights.clear()
 *         if do_readability:
 *             self._subtree_func.push_back(             # <<<<<<<<<<<<<<
 *                 <subtree_t>PartialBlock.subtree_readability)
 *             self._reinit_func.push_back(
 */
    try {
      __pyx_v_self->_subtree_func.push_back(((__pyx_t_7dragnet_6blocks_subtree_t)__pyx_f_7dragnet_6blocks_12PartialBlock_subtree_readability));
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 351, __pyx_L1_error)
    }

    /* "dragnet/blocks.pyx":353
 *             self._subtree_func.push_back(
 *                 <subtree_t>PartialBlock.subtree_readability)
 *             self._reinit_func.push_back(             # <<<<<<<<<<<<<<
 *                 <reinit_t>PartialBlock.reinit_readability)
 * 
 */
    try {
      __pyx_v_self->_reinit_func.push_back(((__pyx_t_7dragnet_6blocks_reinit_t)__pyx_f_7dragnet_6blocks_12PartialBlock_reinit_readability));
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 353, __pyx_L1_error)
    }

    /* "dragnet/blocks.pyx":350
 *         self.class_weights_written.clear()
 *         self.class_weights.clear()
 *         if do_readability:             # <<<<<<<<<<<<<<
 *             self._subtree_func.push_back(
 *                 <subtree_t>PartialBlock.subtree_readability)
 */
  }

  /* "dragnet/blocks.pyx":331
 *         self.css_attrib.push_back('class')
 * 
 *     def __init__(self, do_css=True, do_readability=False):             # <<<<<<<<<<<<<<
 *         self._tag_func.clear()
 *         self._reinit_func.clear()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("dragnet.blocks.PartialBlock.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "dragnet/blocks.pyx":356
 *                 <reinit_t>PartialBlock.reinit_readability)
 * 
 *     cdef void _fe_reinit(self):             # <<<<<<<<<<<<<<
 *         # each subclass implements reinit_fename()
 *         # call self.reinit_name() for each name
 */

static void __pyx_f_7dragnet_6blocks_12PartialBlock__fe_reinit(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self) {
  size_t __pyx_v_k;
  __Pyx_RefNannyDeclarations
  std::vector<__pyx_t_7dragnet_6blocks_reinit_t> ::size_type __pyx_t_1;
  std::vector<__pyx_t_7dragnet_6blocks_reinit_t> ::size_type __pyx_t_2;
  size_t __pyx_t_3;
  __Pyx_RefNannySetupContext("_fe_reinit", 0);

  /* "dragnet/blocks.pyx":360
 *         # call self.reinit_name() for each name
 *         cdef size_t k
 *         for k in range(self._reinit_func.size()):             # <<<<<<<<<<<<<<
 *             self._reinit_func[k](self)
 * 
 */
  __pyx_t_1 = __pyx_v_self->_reinit_func.size();
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_k = __pyx_t_3;

    /* "dragnet/blocks.pyx":361
 *         cdef size_t k
 *         for k in range(self._reinit_func.size()):
 *             self._reinit_func[k](self)             # <<<<<<<<<<<<<<
 * 
 *     cdef void reinit(self):
 */
    (__pyx_v_self->_reinit_func[__pyx_v_k])(__pyx_v_self);
  }

  /* "dragnet/blocks.pyx":356
 *                 <reinit_t>PartialBlock.reinit_readability)
 * 
 *     cdef void _fe_reinit(self):             # <<<<<<<<<<<<<<
 *         # each subclass implements reinit_fename()
 *         # call self.reinit_name() for each name
 */

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

/* "dragnet/blocks.pyx":363
 *             self._reinit_func[k](self)
 * 
 *     cdef void reinit(self):             # <<<<<<<<<<<<<<
 *         self.text.clear()
 *         self.link_tokens.clear()
 */

static void __pyx_f_7dragnet_6blocks_12PartialBlock_reinit(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("reinit", 0);

  /* "dragnet/blocks.pyx":364
 * 
 *     cdef void reinit(self):
 *         self.text.clear()             # <<<<<<<<<<<<<<
 *         self.link_tokens.clear()
 *         self.anchors = []
 */
  __pyx_v_self->text.clear();

  /* "dragnet/blocks.pyx":365
 *     cdef void reinit(self):
 *         self.text.clear()
 *         self.link_tokens.clear()             # <<<<<<<<<<<<<<
 *         self.anchors = []
 *         self._fe_reinit()
 */
  __pyx_v_self->link_tokens.clear();

  /* "dragnet/blocks.pyx":366
 *         self.text.clear()
 *         self.link_tokens.clear()
 *         self.anchors = []             # <<<<<<<<<<<<<<
 *         self._fe_reinit()
 * 
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->anchors);
  __Pyx_DECREF(__pyx_v_self->anchors);
  __pyx_v_self->anchors = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "dragnet/blocks.pyx":367
 *         self.link_tokens.clear()
 *         self.anchors = []
 *         self._fe_reinit()             # <<<<<<<<<<<<<<
 * 
 *     cdef void reinit_css(self, bool init_tree):
 */
  ((struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock *)__pyx_v_self->__pyx_vtab)->_fe_reinit(__pyx_v_self);

  /* "dragnet/blocks.pyx":363
 *             self._reinit_func[k](self)
 * 
 *     cdef void reinit(self):             # <<<<<<<<<<<<<<
 *         self.text.clear()
 *         self.link_tokens.clear()
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_WriteUnraisable("dragnet.blocks.PartialBlock.reinit", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "dragnet/blocks.pyx":369
 *         self._fe_reinit()
 * 
 *     cdef void reinit_css(self, bool init_tree):             # <<<<<<<<<<<<<<
 *         # we want to keep track of the id and class CSS attributes.
 *         # we will accumulate a few sources of them
 */

static void __pyx_f_7dragnet_6blocks_12PartialBlock_reinit_css(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self, bool __pyx_v_init_tree) {
  size_t __pyx_v_k;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  std::vector<std::string> ::size_type __pyx_t_2;
  std::vector<std::string> ::size_type __pyx_t_3;
  size_t __pyx_t_4;
  __Pyx_RefNannySetupContext("reinit_css", 0);

  /* "dragnet/blocks.pyx":381
 * 
 *         cdef size_t k
 *         if init_tree:             # <<<<<<<<<<<<<<
 *             # the initial init
 *             self.css_tree.clear()
 */
  __pyx_t_1 = (__pyx_v_init_tree != 0);
  if (__pyx_t_1) {

    /* "dragnet/blocks.pyx":383
 *         if init_tree:
 *             # the initial init
 *             self.css_tree.clear()             # <<<<<<<<<<<<<<
 *             self.css.clear()
 *             for k in range(self.css_attrib.size()):
 */
    __pyx_v_self->css_tree.clear();

    /* "dragnet/blocks.pyx":384
 *             # the initial init
 *             self.css_tree.clear()
 *             self.css.clear()             # <<<<<<<<<<<<<<
 *             for k in range(self.css_attrib.size()):
 *                 self.css_tree[self.css_attrib[k]].clear()
 */
    __pyx_v_self->css.clear();

    /* "dragnet/blocks.pyx":385
 *             self.css_tree.clear()
 *             self.css.clear()
 *             for k in range(self.css_attrib.size()):             # <<<<<<<<<<<<<<
 *                 self.css_tree[self.css_attrib[k]].clear()
 *                 self.css[self.css_attrib[k]].clear()
 */
    __pyx_t_2 = __pyx_v_self->css_attrib.size();
    __pyx_t_3 = __pyx_t_2;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_k = __pyx_t_4;

      /* "dragnet/blocks.pyx":386
 *             self.css.clear()
 *             for k in range(self.css_attrib.size()):
 *                 self.css_tree[self.css_attrib[k]].clear()             # <<<<<<<<<<<<<<
 *                 self.css[self.css_attrib[k]].clear()
 *         else:
 */
      (__pyx_v_self->css_tree[(__pyx_v_self->css_attrib[__pyx_v_k])]).clear();

      /* "dragnet/blocks.pyx":387
 *             for k in range(self.css_attrib.size()):
 *                 self.css_tree[self.css_attrib[k]].clear()
 *                 self.css[self.css_attrib[k]].clear()             # <<<<<<<<<<<<<<
 *         else:
 *             # we are re-initializing after creating a block
 */
      (__pyx_v_self->css[(__pyx_v_self->css_attrib[__pyx_v_k])]).clear();
    }

    /* "dragnet/blocks.pyx":381
 * 
 *         cdef size_t k
 *         if init_tree:             # <<<<<<<<<<<<<<
 *             # the initial init
 *             self.css_tree.clear()
 */
    goto __pyx_L3;
  }

  /* "dragnet/blocks.pyx":391
 *             # we are re-initializing after creating a block
 *             # css_tree is unchanged and css is set to css_tree
 *             self.css.clear()             # <<<<<<<<<<<<<<
 *             for k in range(self.css_attrib.size()):
 *                 self.css[self.css_attrib[k]].clear()
 */
  /*else*/ {
    __pyx_v_self->css.clear();

    /* "dragnet/blocks.pyx":392
 *             # css_tree is unchanged and css is set to css_tree
 *             self.css.clear()
 *             for k in range(self.css_attrib.size()):             # <<<<<<<<<<<<<<
 *                 self.css[self.css_attrib[k]].clear()
 * 
 */
    __pyx_t_2 = __pyx_v_self->css_attrib.size();
    __pyx_t_3 = __pyx_t_2;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_k = __pyx_t_4;

      /* "dragnet/blocks.pyx":393
 *             self.css.clear()
 *             for k in range(self.css_attrib.size()):
 *                 self.css[self.css_attrib[k]].clear()             # <<<<<<<<<<<<<<
 * 
 *     cdef object _extract_features(self, bool append):
 */
      (__pyx_v_self->css[(__pyx_v_self->css_attrib[__pyx_v_k])]).clear();
    }
  }
  __pyx_L3:;

  /* "dragnet/blocks.pyx":369
 *         self._fe_reinit()
 * 
 *     cdef void reinit_css(self, bool init_tree):             # <<<<<<<<<<<<<<
 *         # we want to keep track of the id and class CSS attributes.
 *         # we will accumulate a few sources of them
 */

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

/* "dragnet/blocks.pyx":395
 *                 self.css[self.css_attrib[k]].clear()
 * 
 *     cdef object _extract_features(self, bool append):             # <<<<<<<<<<<<<<
 *         # call self.fe_name(append=True/False) where
 *         # append is True if this PartialBlock is appended
 */

static PyObject *__pyx_f_7dragnet_6blocks_12PartialBlock__extract_features(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self, bool __pyx_v_append) {
  PyObject *__pyx_v_ret = NULL;
  std::map<std::string,int>  __pyx_v_to_add;
  std::map<std::string,int> ::iterator __pyx_v_it;
  size_t __pyx_v_k;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  std::vector<__pyx_t_7dragnet_6blocks_name_t> ::size_type __pyx_t_2;
  std::vector<__pyx_t_7dragnet_6blocks_name_t> ::size_type __pyx_t_3;
  size_t __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("_extract_features", 0);

  /* "dragnet/blocks.pyx":399
 *         # append is True if this PartialBlock is appended
 *         # or False if it is not.
 *         ret = {}             # <<<<<<<<<<<<<<
 *         cdef cpp_map[string, int] to_add
 *         cdef cpp_map[string, int].iterator it
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ret = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "dragnet/blocks.pyx":403
 *         cdef cpp_map[string, int].iterator it
 *         cdef size_t k
 *         for k in range(self._name_func.size()):             # <<<<<<<<<<<<<<
 *             to_add = self._name_func[k](self, append)
 *             it = to_add.begin()
 */
  __pyx_t_2 = __pyx_v_self->_name_func.size();
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_k = __pyx_t_4;

    /* "dragnet/blocks.pyx":404
 *         cdef size_t k
 *         for k in range(self._name_func.size()):
 *             to_add = self._name_func[k](self, append)             # <<<<<<<<<<<<<<
 *             it = to_add.begin()
 *             while it != to_add.end():
 */
    __pyx_v_to_add = (__pyx_v_self->_name_func[__pyx_v_k])(__pyx_v_self, __pyx_v_append);

    /* "dragnet/blocks.pyx":405
 *         for k in range(self._name_func.size()):
 *             to_add = self._name_func[k](self, append)
 *             it = to_add.begin()             # <<<<<<<<<<<<<<
 *             while it != to_add.end():
 *                 ret[str_cast(deref(it).first)] = deref(it).second
 */
    __pyx_v_it = __pyx_v_to_add.begin();

    /* "dragnet/blocks.pyx":406
 *             to_add = self._name_func[k](self, append)
 *             it = to_add.begin()
 *             while it != to_add.end():             # <<<<<<<<<<<<<<
 *                 ret[str_cast(deref(it).first)] = deref(it).second
 *                 inc(it)
 */
    while (1) {
      __pyx_t_5 = ((__pyx_v_it != __pyx_v_to_add.end()) != 0);
      if (!__pyx_t_5) break;

      /* "dragnet/blocks.pyx":407
 *             it = to_add.begin()
 *             while it != to_add.end():
 *                 ret[str_cast(deref(it).first)] = deref(it).second             # <<<<<<<<<<<<<<
 *                 inc(it)
 *         return ret
 */
      __pyx_t_1 = __Pyx_PyInt_From_int((*__pyx_v_it).second); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 407, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_str_cast); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 407, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __pyx_convert_PyBytes_string_to_py_std__in_string((*__pyx_v_it).first); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 407, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      __pyx_t_6 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 407, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(PyDict_SetItem(__pyx_v_ret, __pyx_t_6, __pyx_t_1) < 0)) __PYX_ERR(0, 407, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "dragnet/blocks.pyx":408
 *             while it != to_add.end():
 *                 ret[str_cast(deref(it).first)] = deref(it).second
 *                 inc(it)             # <<<<<<<<<<<<<<
 *         return ret
 * 
 */
      (void)((++__pyx_v_it));
    }
  }

  /* "dragnet/blocks.pyx":409
 *                 ret[str_cast(deref(it).first)] = deref(it).second
 *                 inc(it)
 *         return ret             # <<<<<<<<<<<<<<
 * 
 *     cdef object _add_readability(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_ret);
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  /* "dragnet/blocks.pyx":395
 *                 self.css[self.css_attrib[k]].clear()
 * 
 *     cdef object _extract_features(self, bool append):             # <<<<<<<<<<<<<<
 *         # call self.fe_name(append=True/False) where
 *         # append is True if this PartialBlock is appended
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("dragnet.blocks.PartialBlock._extract_features", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ret);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "dragnet/blocks.pyx":411
 *         return ret
 * 
 *     cdef object _add_readability(self):             # <<<<<<<<<<<<<<
 *         if self.do_readability:
 *             ret = {
 */

static PyObject *__pyx_f_7dragnet_6blocks_12PartialBlock__add_readability(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self) {
  PyObject *__pyx_v_ret = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("_add_readability", 0);

  /* "dragnet/blocks.pyx":412
 * 
 *     cdef object _add_readability(self):
 *         if self.do_readability:             # <<<<<<<<<<<<<<
 *             ret = {
 *                 'ancestors': self.ancestors_write,
 */
  __pyx_t_1 = (__pyx_v_self->do_readability != 0);
  if (__pyx_t_1) {

    /* "dragnet/blocks.pyx":414
 *         if self.do_readability:
 *             ret = {
 *                 'ancestors': self.ancestors_write,             # <<<<<<<<<<<<<<
 *                 'readability_class_weights': self.class_weights
 *             }
 */
    __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 414, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __pyx_convert_vector_to_py_uint32_t(__pyx_v_self->ancestors_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 414, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_ancestors, __pyx_t_3) < 0) __PYX_ERR(0, 414, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "dragnet/blocks.pyx":415
 *             ret = {
 *                 'ancestors': self.ancestors_write,
 *                 'readability_class_weights': self.class_weights             # <<<<<<<<<<<<<<
 *             }
 *             self.class_weights.clear()
 */
    __pyx_t_3 = __pyx_convert_vector_to_py_std_3a__3a_pair_3c_uint32_t_2c_int_3e___(__pyx_v_self->class_weights); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 415, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_readability_class_weights, __pyx_t_3) < 0) __PYX_ERR(0, 414, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_ret = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "dragnet/blocks.pyx":417
 *                 'readability_class_weights': self.class_weights
 *             }
 *             self.class_weights.clear()             # <<<<<<<<<<<<<<
 *             return ret
 *         else:
 */
    __pyx_v_self->class_weights.clear();

    /* "dragnet/blocks.pyx":418
 *             }
 *             self.class_weights.clear()
 *             return ret             # <<<<<<<<<<<<<<
 *         else:
 *             return {}
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_ret);
    __pyx_r = __pyx_v_ret;
    goto __pyx_L0;

    /* "dragnet/blocks.pyx":412
 * 
 *     cdef object _add_readability(self):
 *         if self.do_readability:             # <<<<<<<<<<<<<<
 *             ret = {
 *                 'ancestors': self.ancestors_write,
 */
  }

  /* "dragnet/blocks.pyx":420
 *             return ret
 *         else:
 *             return {}             # <<<<<<<<<<<<<<
 * 
 *     cdef void add_block_to_results(self, list results):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 420, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "dragnet/blocks.pyx":411
 *         return ret
 * 
 *     cdef object _add_readability(self):             # <<<<<<<<<<<<<<
 *         if self.do_readability:
 *             ret = {
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("dragnet.blocks.PartialBlock._add_readability", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ret);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "dragnet/blocks.pyx":422
 *             return {}
 * 
 *     cdef void add_block_to_results(self, list results):             # <<<<<<<<<<<<<<
 *         """Create a block from the current partial block
 *         and append it to results.  Reset the partial block"""
 */

static void __pyx_f_7dragnet_6blocks_12PartialBlock_add_block_to_results(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self, PyObject *__pyx_v_results) {
  std::vector<std::string>  __pyx_v_block_tokens;
  size_t __pyx_v_k;
  std::string __pyx_v_cssa;
  PyObject *__pyx_v_block_text = NULL;
  PyObject *__pyx_v_link_text = NULL;
  PyObject *__pyx_v_at = NULL;
  PyObject *__pyx_v_bt = NULL;
  double __pyx_v_link_d;
  PyObject *__pyx_v_lines = NULL;
  PyObject *__pyx_v_text_d = NULL;
  PyObject *__pyx_v_tokens = NULL;
  PyObject *__pyx_v_css = NULL;
  PyObject *__pyx_v_kwargs = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  std::vector<std::string> ::size_type __pyx_t_8;
  std::vector<std::string> ::size_type __pyx_t_9;
  size_t __pyx_t_10;
  int __pyx_t_11;
  __Pyx_RefNannySetupContext("add_block_to_results", 0);

  /* "dragnet/blocks.pyx":427
 * 
 *         # compute block and link tokens!
 *         block_tokens = _tokens_from_text(self.text)             # <<<<<<<<<<<<<<
 *         cdef size_t k
 *         cdef string cssa
 */
  __pyx_v_block_tokens = __pyx_f_7dragnet_6blocks__tokens_from_text(__pyx_v_self->text);

  /* "dragnet/blocks.pyx":430
 *         cdef size_t k
 *         cdef string cssa
 *         if len(block_tokens) > 0:             # <<<<<<<<<<<<<<
 *             # only process blocks with something other then white space
 *             block_text = b' '.join(block_tokens)
 */
  __pyx_t_1 = __pyx_convert_vector_to_py_std_3a__3a_string(__pyx_v_block_tokens); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 430, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = ((__pyx_t_2 > 0) != 0);
  if (__pyx_t_3) {

    /* "dragnet/blocks.pyx":432
 *         if len(block_tokens) > 0:
 *             # only process blocks with something other then white space
 *             block_text = b' '.join(block_tokens)             # <<<<<<<<<<<<<<
 *             link_text = b' '.join(self.link_tokens)
 * 
 */
    __pyx_t_1 = __pyx_convert_vector_to_py_std_3a__3a_string(__pyx_v_block_tokens); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 432, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyBytes_Join(__pyx_kp_b__3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 432, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_block_text = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "dragnet/blocks.pyx":433
 *             # only process blocks with something other then white space
 *             block_text = b' '.join(block_tokens)
 *             link_text = b' '.join(self.link_tokens)             # <<<<<<<<<<<<<<
 * 
 *             # compute link/text density
 */
    __pyx_t_4 = __pyx_convert_vector_to_py_std_3a__3a_string(__pyx_v_self->link_tokens); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 433, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyBytes_Join(__pyx_kp_b__3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 433, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_link_text = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "dragnet/blocks.pyx":436
 * 
 *             # compute link/text density
 *             at = re_tokenizer_nounicode.split(link_text)             # <<<<<<<<<<<<<<
 *             bt = re_tokenizer_nounicode.split(block_text)
 *             link_d = float(len(at)) / len(bt)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_re_tokenizer_nounicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 436, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_split); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 436, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_v_link_text) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_link_text);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 436, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_at = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "dragnet/blocks.pyx":437
 *             # compute link/text density
 *             at = re_tokenizer_nounicode.split(link_text)
 *             bt = re_tokenizer_nounicode.split(block_text)             # <<<<<<<<<<<<<<
 *             link_d = float(len(at)) / len(bt)
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_re_tokenizer_nounicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 437, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_split); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 437, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_block_text) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_block_text);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 437, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_bt = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "dragnet/blocks.pyx":438
 *             at = re_tokenizer_nounicode.split(link_text)
 *             bt = re_tokenizer_nounicode.split(block_text)
 *             link_d = float(len(at)) / len(bt)             # <<<<<<<<<<<<<<
 * 
 *             lines = int(math.ceil(len(block_text) / 80.0))
 */
    __pyx_t_2 = PyObject_Length(__pyx_v_at); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 438, __pyx_L1_error)
    __pyx_t_6 = PyObject_Length(__pyx_v_bt); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 438, __pyx_L1_error)
    if (unlikely(__pyx_t_6 == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      __PYX_ERR(0, 438, __pyx_L1_error)
    }
    __pyx_v_link_d = (((double)__pyx_t_2) / __pyx_t_6);

    /* "dragnet/blocks.pyx":440
 *             link_d = float(len(at)) / len(bt)
 * 
 *             lines = int(math.ceil(len(block_text) / 80.0))             # <<<<<<<<<<<<<<
 *             if lines == 1:
 *                 text_d = float(len(bt))
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_math); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 440, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ceil); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 440, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = PyObject_Length(__pyx_v_block_text); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 440, __pyx_L1_error)
    __pyx_t_4 = PyFloat_FromDouble((__pyx_t_6 / 80.0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 440, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 440, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 440, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_lines = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "dragnet/blocks.pyx":441
 * 
 *             lines = int(math.ceil(len(block_text) / 80.0))
 *             if lines == 1:             # <<<<<<<<<<<<<<
 *                 text_d = float(len(bt))
 *             else:
 */
    __pyx_t_5 = __Pyx_PyInt_EqObjC(__pyx_v_lines, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 441, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 441, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_3) {

      /* "dragnet/blocks.pyx":442
 *             lines = int(math.ceil(len(block_text) / 80.0))
 *             if lines == 1:
 *                 text_d = float(len(bt))             # <<<<<<<<<<<<<<
 *             else:
 *                 # need the number of tokens excluding the last partial line
 */
      __pyx_t_6 = PyObject_Length(__pyx_v_bt); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 442, __pyx_L1_error)
      __pyx_t_5 = PyFloat_FromDouble(((double)__pyx_t_6)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 442, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_text_d = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "dragnet/blocks.pyx":441
 * 
 *             lines = int(math.ceil(len(block_text) / 80.0))
 *             if lines == 1:             # <<<<<<<<<<<<<<
 *                 text_d = float(len(bt))
 *             else:
 */
      goto __pyx_L4;
    }

    /* "dragnet/blocks.pyx":445
 *             else:
 *                 # need the number of tokens excluding the last partial line
 *                 tokens = re_tokenizer_nounicode.split(             # <<<<<<<<<<<<<<
 *                     block_text[:(int(lines - 1) * 80)])
 *                 text_d = len(tokens) / (lines - 1.0)
 */
    /*else*/ {
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_re_tokenizer_nounicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 445, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_split); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 445, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "dragnet/blocks.pyx":446
 *                 # need the number of tokens excluding the last partial line
 *                 tokens = re_tokenizer_nounicode.split(
 *                     block_text[:(int(lines - 1) * 80)])             # <<<<<<<<<<<<<<
 *                 text_d = len(tokens) / (lines - 1.0)
 * 
 */
      __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_v_lines, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 446, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 446, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyNumber_Multiply(__pyx_t_7, __pyx_int_80); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 446, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_GetSlice(__pyx_v_block_text, 0, 0, NULL, &__pyx_t_1, NULL, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 446, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      __pyx_t_5 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_1, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_7);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 445, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_tokens = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "dragnet/blocks.pyx":447
 *                 tokens = re_tokenizer_nounicode.split(
 *                     block_text[:(int(lines - 1) * 80)])
 *                 text_d = len(tokens) / (lines - 1.0)             # <<<<<<<<<<<<<<
 * 
 *             # get the id, class attributes
 */
      __pyx_t_6 = PyObject_Length(__pyx_v_tokens); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 447, __pyx_L1_error)
      __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 447, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __Pyx_PyFloat_SubtractObjC(__pyx_v_lines, __pyx_float_1_0, 1.0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 447, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 447, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_text_d = __pyx_t_7;
      __pyx_t_7 = 0;
    }
    __pyx_L4:;

    /* "dragnet/blocks.pyx":450
 * 
 *             # get the id, class attributes
 *             css = {}             # <<<<<<<<<<<<<<
 *             if self.do_css:
 *                 for k in range(self.css_attrib.size()):
 */
    __pyx_t_7 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 450, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_v_css = ((PyObject*)__pyx_t_7);
    __pyx_t_7 = 0;

    /* "dragnet/blocks.pyx":451
 *             # get the id, class attributes
 *             css = {}
 *             if self.do_css:             # <<<<<<<<<<<<<<
 *                 for k in range(self.css_attrib.size()):
 *                     cssa = self.css_attrib[k]
 */
    __pyx_t_3 = (__pyx_v_self->do_css != 0);
    if (__pyx_t_3) {

      /* "dragnet/blocks.pyx":452
 *             css = {}
 *             if self.do_css:
 *                 for k in range(self.css_attrib.size()):             # <<<<<<<<<<<<<<
 *                     cssa = self.css_attrib[k]
 *                     css[cssa] = b' '.join(
 */
      __pyx_t_8 = __pyx_v_self->css_attrib.size();
      __pyx_t_9 = __pyx_t_8;
      for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
        __pyx_v_k = __pyx_t_10;

        /* "dragnet/blocks.pyx":453
 *             if self.do_css:
 *                 for k in range(self.css_attrib.size()):
 *                     cssa = self.css_attrib[k]             # <<<<<<<<<<<<<<
 *                     css[cssa] = b' '.join(
 *                         _tokens_from_text(self.css[cssa])).lower()
 */
        __pyx_v_cssa = (__pyx_v_self->css_attrib[__pyx_v_k]);

        /* "dragnet/blocks.pyx":455
 *                     cssa = self.css_attrib[k]
 *                     css[cssa] = b' '.join(
 *                         _tokens_from_text(self.css[cssa])).lower()             # <<<<<<<<<<<<<<
 * 
 *             kwargs = self._add_readability()
 */
        __pyx_t_4 = __pyx_convert_vector_to_py_std_3a__3a_string(__pyx_f_7dragnet_6blocks__tokens_from_text((__pyx_v_self->css[__pyx_v_cssa]))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 455, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);

        /* "dragnet/blocks.pyx":454
 *                 for k in range(self.css_attrib.size()):
 *                     cssa = self.css_attrib[k]
 *                     css[cssa] = b' '.join(             # <<<<<<<<<<<<<<
 *                         _tokens_from_text(self.css[cssa])).lower()
 * 
 */
        __pyx_t_5 = __Pyx_PyBytes_Join(__pyx_kp_b__3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 454, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "dragnet/blocks.pyx":455
 *                     cssa = self.css_attrib[k]
 *                     css[cssa] = b' '.join(
 *                         _tokens_from_text(self.css[cssa])).lower()             # <<<<<<<<<<<<<<
 * 
 *             kwargs = self._add_readability()
 */
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_lower); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 455, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
          }
        }
        __pyx_t_7 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 455, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "dragnet/blocks.pyx":454
 *                 for k in range(self.css_attrib.size()):
 *                     cssa = self.css_attrib[k]
 *                     css[cssa] = b' '.join(             # <<<<<<<<<<<<<<
 *                         _tokens_from_text(self.css[cssa])).lower()
 * 
 */
        __pyx_t_4 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_cssa); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 454, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (unlikely(PyDict_SetItem(__pyx_v_css, __pyx_t_4, __pyx_t_7) < 0)) __PYX_ERR(0, 454, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }

      /* "dragnet/blocks.pyx":451
 *             # get the id, class attributes
 *             css = {}
 *             if self.do_css:             # <<<<<<<<<<<<<<
 *                 for k in range(self.css_attrib.size()):
 *                     cssa = self.css_attrib[k]
 */
    }

    /* "dragnet/blocks.pyx":457
 *                         _tokens_from_text(self.css[cssa])).lower()
 * 
 *             kwargs = self._add_readability()             # <<<<<<<<<<<<<<
 *             kwargs.update(self._extract_features(True))
 *             kwargs['block_start_tag'] = self.block_start_tag
 */
    __pyx_t_7 = ((struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock *)__pyx_v_self->__pyx_vtab)->_add_readability(__pyx_v_self); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 457, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_v_kwargs = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "dragnet/blocks.pyx":458
 * 
 *             kwargs = self._add_readability()
 *             kwargs.update(self._extract_features(True))             # <<<<<<<<<<<<<<
 *             kwargs['block_start_tag'] = self.block_start_tag
 *             kwargs['block_start_element'] = self.block_start_element
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_kwargs, __pyx_n_s_update); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 458, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = ((struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock *)__pyx_v_self->__pyx_vtab)->_extract_features(__pyx_v_self, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 458, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_7 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_1, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 458, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "dragnet/blocks.pyx":459
 *             kwargs = self._add_readability()
 *             kwargs.update(self._extract_features(True))
 *             kwargs['block_start_tag'] = self.block_start_tag             # <<<<<<<<<<<<<<
 *             kwargs['block_start_element'] = self.block_start_element
 *             results.append(Block(block_text, link_d, text_d, self.anchors,
 */
    __pyx_t_7 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_self->block_start_tag); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 459, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (unlikely(PyObject_SetItem(__pyx_v_kwargs, __pyx_n_s_block_start_tag, __pyx_t_7) < 0)) __PYX_ERR(0, 459, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "dragnet/blocks.pyx":460
 *             kwargs.update(self._extract_features(True))
 *             kwargs['block_start_tag'] = self.block_start_tag
 *             kwargs['block_start_element'] = self.block_start_element             # <<<<<<<<<<<<<<
 *             results.append(Block(block_text, link_d, text_d, self.anchors,
 *                                  self.link_tokens, css, **kwargs))
 */
    __pyx_t_7 = __pyx_v_self->block_start_element;
    __Pyx_INCREF(__pyx_t_7);
    if (unlikely(PyObject_SetItem(__pyx_v_kwargs, __pyx_n_s_block_start_element, __pyx_t_7) < 0)) __PYX_ERR(0, 460, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "dragnet/blocks.pyx":461
 *             kwargs['block_start_tag'] = self.block_start_tag
 *             kwargs['block_start_element'] = self.block_start_element
 *             results.append(Block(block_text, link_d, text_d, self.anchors,             # <<<<<<<<<<<<<<
 *                                  self.link_tokens, css, **kwargs))
 *         else:
 */
    if (unlikely(__pyx_v_results == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
      __PYX_ERR(0, 461, __pyx_L1_error)
    }
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_Block); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 461, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_link_d); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 461, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "dragnet/blocks.pyx":462
 *             kwargs['block_start_element'] = self.block_start_element
 *             results.append(Block(block_text, link_d, text_d, self.anchors,
 *                                  self.link_tokens, css, **kwargs))             # <<<<<<<<<<<<<<
 *         else:
 *             self._extract_features(False)
 */
    __pyx_t_5 = __pyx_convert_vector_to_py_std_3a__3a_string(__pyx_v_self->link_tokens); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 462, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);

    /* "dragnet/blocks.pyx":461
 *             kwargs['block_start_tag'] = self.block_start_tag
 *             kwargs['block_start_element'] = self.block_start_element
 *             results.append(Block(block_text, link_d, text_d, self.anchors,             # <<<<<<<<<<<<<<
 *                                  self.link_tokens, css, **kwargs))
 *         else:
 */
    __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 461, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_block_text);
    __Pyx_GIVEREF(__pyx_v_block_text);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_block_text);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
    __Pyx_INCREF(__pyx_v_text_d);
    __Pyx_GIVEREF(__pyx_v_text_d);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_text_d);
    __Pyx_INCREF(__pyx_v_self->anchors);
    __Pyx_GIVEREF(__pyx_v_self->anchors);
    PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_self->anchors);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_t_5);
    __Pyx_INCREF(__pyx_v_css);
    __Pyx_GIVEREF(__pyx_v_css);
    PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_v_css);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;

    /* "dragnet/blocks.pyx":462
 *             kwargs['block_start_element'] = self.block_start_element
 *             results.append(Block(block_text, link_d, text_d, self.anchors,
 *                                  self.link_tokens, css, **kwargs))             # <<<<<<<<<<<<<<
 *         else:
 *             self._extract_features(False)
 */
    if (unlikely(__pyx_v_kwargs == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
      __PYX_ERR(0, 462, __pyx_L1_error)
    }
    if (likely(PyDict_CheckExact(__pyx_v_kwargs))) {
      __pyx_t_5 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 462, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      __pyx_t_5 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kwargs, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 461, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }

    /* "dragnet/blocks.pyx":461
 *             kwargs['block_start_tag'] = self.block_start_tag
 *             kwargs['block_start_element'] = self.block_start_element
 *             results.append(Block(block_text, link_d, text_d, self.anchors,             # <<<<<<<<<<<<<<
 *                                  self.link_tokens, css, **kwargs))
 *         else:
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 461, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_results, __pyx_t_4); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 461, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "dragnet/blocks.pyx":430
 *         cdef size_t k
 *         cdef string cssa
 *         if len(block_tokens) > 0:             # <<<<<<<<<<<<<<
 *             # only process blocks with something other then white space
 *             block_text = b' '.join(block_tokens)
 */
    goto __pyx_L3;
  }

  /* "dragnet/blocks.pyx":464
 *                                  self.link_tokens, css, **kwargs))
 *         else:
 *             self._extract_features(False)             # <<<<<<<<<<<<<<
 * 
 *         self.reinit()
 */
  /*else*/ {
    __pyx_t_4 = ((struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock *)__pyx_v_self->__pyx_vtab)->_extract_features(__pyx_v_self, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 464, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_L3:;

  /* "dragnet/blocks.pyx":466
 *             self._extract_features(False)
 * 
 *         self.reinit()             # <<<<<<<<<<<<<<
 *         if self.do_css:
 *             self.reinit_css(False)
 */
  ((struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock *)__pyx_v_self->__pyx_vtab)->reinit(__pyx_v_self);

  /* "dragnet/blocks.pyx":467
 * 
 *         self.reinit()
 *         if self.do_css:             # <<<<<<<<<<<<<<
 *             self.reinit_css(False)
 * 
 */
  __pyx_t_3 = (__pyx_v_self->do_css != 0);
  if (__pyx_t_3) {

    /* "dragnet/blocks.pyx":468
 *         self.reinit()
 *         if self.do_css:
 *             self.reinit_css(False)             # <<<<<<<<<<<<<<
 * 
 *     cdef void add_text(self, cetree.tree.xmlNode *ele, string text_or_tail):
 */
    ((struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock *)__pyx_v_self->__pyx_vtab)->reinit_css(__pyx_v_self, 0);

    /* "dragnet/blocks.pyx":467
 * 
 *         self.reinit()
 *         if self.do_css:             # <<<<<<<<<<<<<<
 *             self.reinit_css(False)
 * 
 */
  }

  /* "dragnet/blocks.pyx":422
 *             return {}
 * 
 *     cdef void add_block_to_results(self, list results):             # <<<<<<<<<<<<<<
 *         """Create a block from the current partial block
 *         and append it to results.  Reset the partial block"""
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_WriteUnraisable("dragnet.blocks.PartialBlock.add_block_to_results", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_block_text);
  __Pyx_XDECREF(__pyx_v_link_text);
  __Pyx_XDECREF(__pyx_v_at);
  __Pyx_XDECREF(__pyx_v_bt);
  __Pyx_XDECREF(__pyx_v_lines);
  __Pyx_XDECREF(__pyx_v_text_d);
  __Pyx_XDECREF(__pyx_v_tokens);
  __Pyx_XDECREF(__pyx_v_css);
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
}

/* "dragnet/blocks.pyx":470
 *             self.reinit_css(False)
 * 
 *     cdef void add_text(self, cetree.tree.xmlNode *ele, string text_or_tail):             # <<<<<<<<<<<<<<
 *         """Add the text/tail from the element
 *         text_or_tail is 'text' or 'tail'"""
 */

static void __pyx_f_7dragnet_6blocks_12PartialBlock_add_text(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self, xmlNode *__pyx_v_ele, std::string __pyx_v_text_or_tail) {
  PyObject *__pyx_v_t = 0;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  std::string __pyx_t_9;
  int __pyx_t_10;
  __Pyx_RefNannySetupContext("add_text", 0);

  /* "dragnet/blocks.pyx":474
 *         text_or_tail is 'text' or 'tail'"""
 *         cdef object t
 *         try:             # <<<<<<<<<<<<<<
 *             if text_or_tail == CTEXT:
 *                 t = cetree.textOf(ele)
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "dragnet/blocks.pyx":475
 *         cdef object t
 *         try:
 *             if text_or_tail == CTEXT:             # <<<<<<<<<<<<<<
 *                 t = cetree.textOf(ele)
 *             else:
 */
      __pyx_t_4 = ((__pyx_v_text_or_tail == __pyx_v_7dragnet_6blocks_CTEXT) != 0);
      if (__pyx_t_4) {

        /* "dragnet/blocks.pyx":476
 *         try:
 *             if text_or_tail == CTEXT:
 *                 t = cetree.textOf(ele)             # <<<<<<<<<<<<<<
 *             else:
 *                 t = cetree.tailOf(ele)
 */
        __pyx_t_5 = textOf(__pyx_v_ele); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 476, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_v_t = __pyx_t_5;
        __pyx_t_5 = 0;

        /* "dragnet/blocks.pyx":475
 *         cdef object t
 *         try:
 *             if text_or_tail == CTEXT:             # <<<<<<<<<<<<<<
 *                 t = cetree.textOf(ele)
 *             else:
 */
        goto __pyx_L9;
      }

      /* "dragnet/blocks.pyx":478
 *                 t = cetree.textOf(ele)
 *             else:
 *                 t = cetree.tailOf(ele)             # <<<<<<<<<<<<<<
 *             if t is not None:
 *                 self.text.push_back(t.encode('utf-8'))
 */
      /*else*/ {
        __pyx_t_5 = tailOf(__pyx_v_ele); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 478, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_v_t = __pyx_t_5;
        __pyx_t_5 = 0;
      }
      __pyx_L9:;

      /* "dragnet/blocks.pyx":479
 *             else:
 *                 t = cetree.tailOf(ele)
 *             if t is not None:             # <<<<<<<<<<<<<<
 *                 self.text.push_back(t.encode('utf-8'))
 *         except UnicodeDecodeError:
 */
      __pyx_t_4 = (__pyx_v_t != Py_None);
      __pyx_t_6 = (__pyx_t_4 != 0);
      if (__pyx_t_6) {

        /* "dragnet/blocks.pyx":480
 *                 t = cetree.tailOf(ele)
 *             if t is not None:
 *                 self.text.push_back(t.encode('utf-8'))             # <<<<<<<<<<<<<<
 *         except UnicodeDecodeError:
 *             pass
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_t, __pyx_n_s_encode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 480, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
          }
        }
        __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_kp_s_utf_8);
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 480, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_9 = __pyx_convert_string_from_py_std__in_string(__pyx_t_5); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 480, __pyx_L3_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        try {
          __pyx_v_self->text.push_back(__pyx_t_9);
        } catch(...) {
          __Pyx_CppExn2PyErr();
          __PYX_ERR(0, 480, __pyx_L3_error)
        }

        /* "dragnet/blocks.pyx":479
 *             else:
 *                 t = cetree.tailOf(ele)
 *             if t is not None:             # <<<<<<<<<<<<<<
 *                 self.text.push_back(t.encode('utf-8'))
 *         except UnicodeDecodeError:
 */
      }

      /* "dragnet/blocks.pyx":474
 *         text_or_tail is 'text' or 'tail'"""
 *         cdef object t
 *         try:             # <<<<<<<<<<<<<<
 *             if text_or_tail == CTEXT:
 *                 t = cetree.textOf(ele)
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "dragnet/blocks.pyx":481
 *             if t is not None:
 *                 self.text.push_back(t.encode('utf-8'))
 *         except UnicodeDecodeError:             # <<<<<<<<<<<<<<
 *             pass
 * 
 */
    __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
    if (__pyx_t_10) {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "dragnet/blocks.pyx":474
 *         text_or_tail is 'text' or 'tail'"""
 *         cdef object t
 *         try:             # <<<<<<<<<<<<<<
 *             if text_or_tail == CTEXT:
 *                 t = cetree.textOf(ele)
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L8_try_end:;
  }

  /* "dragnet/blocks.pyx":470
 *             self.reinit_css(False)
 * 
 *     cdef void add_text(self, cetree.tree.xmlNode *ele, string text_or_tail):             # <<<<<<<<<<<<<<
 *         """Add the text/tail from the element
 *         text_or_tail is 'text' or 'tail'"""
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_WriteUnraisable("dragnet.blocks.PartialBlock.add_text", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_RefNannyFinishContext();
}

/* "dragnet/blocks.pyx":485
 * 
 * 
 *     cdef void add_anchor(self, cetree.tree.xmlNode* ele, cetree._Document doc):             # <<<<<<<<<<<<<<
 *         """Add the anchor tag to the block"""
 *         self.anchors.append(cetree.elementFactory(doc, ele))
 */

static void __pyx_f_7dragnet_6blocks_12PartialBlock_add_anchor(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self, xmlNode *__pyx_v_ele, struct LxmlDocument *__pyx_v_doc) {
  std::vector<std::string>  __pyx_v_anchor_text_list;
  size_t __pyx_v_k;
  PyObject *__pyx_v_t = 0;
  std::vector<std::string>  __pyx_v_anchor_tokens;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  std::vector<std::string> ::size_type __pyx_t_3;
  std::vector<std::string> ::size_type __pyx_t_4;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  std::string __pyx_t_13;
  int __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  __Pyx_RefNannySetupContext("add_anchor", 0);

  /* "dragnet/blocks.pyx":487
 *     cdef void add_anchor(self, cetree.tree.xmlNode* ele, cetree._Document doc):
 *         """Add the anchor tag to the block"""
 *         self.anchors.append(cetree.elementFactory(doc, ele))             # <<<<<<<<<<<<<<
 *         # need all the text from the subtree
 * 
 */
  if (unlikely(__pyx_v_self->anchors == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
    __PYX_ERR(0, 487, __pyx_L1_error)
  }
  __pyx_t_1 = ((PyObject *)elementFactory(__pyx_v_doc, __pyx_v_ele)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyList_Append(__pyx_v_self->anchors, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 487, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "dragnet/blocks.pyx":498
 *         cdef vector[string] anchor_text_list
 * 
 *         anchor_text_list = _text_from_subtree(ele, False, self._tag_fe, self)             # <<<<<<<<<<<<<<
 * 
 *         cdef size_t k
 */
  __pyx_v_anchor_text_list = __pyx_f_7dragnet_6blocks__text_from_subtree(__pyx_v_ele, 0, ((struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock *)__pyx_v_self->__pyx_vtab)->_tag_fe, __pyx_v_self);

  /* "dragnet/blocks.pyx":501
 * 
 *         cdef size_t k
 *         for k in range(anchor_text_list.size()):             # <<<<<<<<<<<<<<
 *             self.text.push_back(anchor_text_list[k])
 * 
 */
  __pyx_t_3 = __pyx_v_anchor_text_list.size();
  __pyx_t_4 = __pyx_t_3;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
    __pyx_v_k = __pyx_t_5;

    /* "dragnet/blocks.pyx":502
 *         cdef size_t k
 *         for k in range(anchor_text_list.size()):
 *             self.text.push_back(anchor_text_list[k])             # <<<<<<<<<<<<<<
 * 
 *         cdef object t
 */
    try {
      __pyx_v_self->text.push_back((__pyx_v_anchor_text_list[__pyx_v_k]));
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 502, __pyx_L1_error)
    }
  }

  /* "dragnet/blocks.pyx":505
 * 
 *         cdef object t
 *         try:             # <<<<<<<<<<<<<<
 *             t = cetree.tailOf(ele)
 *             if t is not None:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_8);
    /*try:*/ {

      /* "dragnet/blocks.pyx":506
 *         cdef object t
 *         try:
 *             t = cetree.tailOf(ele)             # <<<<<<<<<<<<<<
 *             if t is not None:
 *                 self.text.push_back(t.encode('utf-8'))
 */
      __pyx_t_1 = tailOf(__pyx_v_ele); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 506, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_t = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "dragnet/blocks.pyx":507
 *         try:
 *             t = cetree.tailOf(ele)
 *             if t is not None:             # <<<<<<<<<<<<<<
 *                 self.text.push_back(t.encode('utf-8'))
 *         except UnicodeDecodeError:
 */
      __pyx_t_9 = (__pyx_v_t != Py_None);
      __pyx_t_10 = (__pyx_t_9 != 0);
      if (__pyx_t_10) {

        /* "dragnet/blocks.pyx":508
 *             t = cetree.tailOf(ele)
 *             if t is not None:
 *                 self.text.push_back(t.encode('utf-8'))             # <<<<<<<<<<<<<<
 *         except UnicodeDecodeError:
 *             pass
 */
        __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_t, __pyx_n_s_encode); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 508, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_12 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
          __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
          if (likely(__pyx_t_12)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
            __Pyx_INCREF(__pyx_t_12);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_11, function);
          }
        }
        __pyx_t_1 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_kp_s_utf_8);
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 508, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_13 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 508, __pyx_L5_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        try {
          __pyx_v_self->text.push_back(__pyx_t_13);
        } catch(...) {
          __Pyx_CppExn2PyErr();
          __PYX_ERR(0, 508, __pyx_L5_error)
        }

        /* "dragnet/blocks.pyx":507
 *         try:
 *             t = cetree.tailOf(ele)
 *             if t is not None:             # <<<<<<<<<<<<<<
 *                 self.text.push_back(t.encode('utf-8'))
 *         except UnicodeDecodeError:
 */
      }

      /* "dragnet/blocks.pyx":505
 * 
 *         cdef object t
 *         try:             # <<<<<<<<<<<<<<
 *             t = cetree.tailOf(ele)
 *             if t is not None:
 */
    }
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    goto __pyx_L10_try_end;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;

    /* "dragnet/blocks.pyx":509
 *             if t is not None:
 *                 self.text.push_back(t.encode('utf-8'))
 *         except UnicodeDecodeError:             # <<<<<<<<<<<<<<
 *             pass
 * 
 */
    __pyx_t_14 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
    if (__pyx_t_14) {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L6_exception_handled;
    }
    goto __pyx_L7_except_error;
    __pyx_L7_except_error:;

    /* "dragnet/blocks.pyx":505
 * 
 *         cdef object t
 *         try:             # <<<<<<<<<<<<<<
 *             t = cetree.tailOf(ele)
 *             if t is not None:
 */
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
    goto __pyx_L1_error;
    __pyx_L6_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
    __pyx_L10_try_end:;
  }

  /* "dragnet/blocks.pyx":513
 * 
 *         cdef vector[string] anchor_tokens
 *         anchor_tokens = _tokens_from_text(anchor_text_list)             # <<<<<<<<<<<<<<
 *         for k in range(len(anchor_tokens)):
 *             self.link_tokens.push_back(anchor_tokens[k])
 */
  __pyx_v_anchor_tokens = __pyx_f_7dragnet_6blocks__tokens_from_text(__pyx_v_anchor_text_list);

  /* "dragnet/blocks.pyx":514
 *         cdef vector[string] anchor_tokens
 *         anchor_tokens = _tokens_from_text(anchor_text_list)
 *         for k in range(len(anchor_tokens)):             # <<<<<<<<<<<<<<
 *             self.link_tokens.push_back(anchor_tokens[k])
 * 
 */
  __pyx_t_1 = __pyx_convert_vector_to_py_std_3a__3a_string(__pyx_v_anchor_tokens); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 514, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_15 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(0, 514, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_16 = __pyx_t_15;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_16; __pyx_t_5+=1) {
    __pyx_v_k = __pyx_t_5;

    /* "dragnet/blocks.pyx":515
 *         anchor_tokens = _tokens_from_text(anchor_text_list)
 *         for k in range(len(anchor_tokens)):
 *             self.link_tokens.push_back(anchor_tokens[k])             # <<<<<<<<<<<<<<
 * 
 * 
 */
    try {
      __pyx_v_self->link_tokens.push_back((__pyx_v_anchor_tokens[__pyx_v_k]));
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 515, __pyx_L1_error)
    }
  }

  /* "dragnet/blocks.pyx":485
 * 
 * 
 *     cdef void add_anchor(self, cetree.tree.xmlNode* ele, cetree._Document doc):             # <<<<<<<<<<<<<<
 *         """Add the anchor tag to the block"""
 *         self.anchors.append(cetree.elementFactory(doc, ele))
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_WriteUnraisable("dragnet.blocks.PartialBlock.add_anchor", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_RefNannyFinishContext();
}

/* "dragnet/blocks.pyx":518
 * 
 * 
 *     cdef void _tag_fe(self, string tag):             # <<<<<<<<<<<<<<
 *         # call the tag_featurename functions
 *         cdef size_t k
 */

static void __pyx_f_7dragnet_6blocks_12PartialBlock__tag_fe(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self, std::string __pyx_v_tag) {
  size_t __pyx_v_k;
  __Pyx_RefNannyDeclarations
  std::vector<__pyx_t_7dragnet_6blocks_callback_t> ::size_type __pyx_t_1;
  std::vector<__pyx_t_7dragnet_6blocks_callback_t> ::size_type __pyx_t_2;
  size_t __pyx_t_3;
  __Pyx_RefNannySetupContext("_tag_fe", 0);

  /* "dragnet/blocks.pyx":521
 *         # call the tag_featurename functions
 *         cdef size_t k
 *         for k in range(self._tag_func.size()):             # <<<<<<<<<<<<<<
 *             self._tag_func[k](self, tag)
 * 
 */
  __pyx_t_1 = __pyx_v_self->_tag_func.size();
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_k = __pyx_t_3;

    /* "dragnet/blocks.pyx":522
 *         cdef size_t k
 *         for k in range(self._tag_func.size()):
 *             self._tag_func[k](self, tag)             # <<<<<<<<<<<<<<
 * 
 *     cdef void _subtree_fe(self, int start_or_end):
 */
    (__pyx_v_self->_tag_func[__pyx_v_k])(__pyx_v_self, __pyx_v_tag);
  }

  /* "dragnet/blocks.pyx":518
 * 
 * 
 *     cdef void _tag_fe(self, string tag):             # <<<<<<<<<<<<<<
 *         # call the tag_featurename functions
 *         cdef size_t k
 */

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

/* "dragnet/blocks.pyx":524
 *             self._tag_func[k](self, tag)
 * 
 *     cdef void _subtree_fe(self, int start_or_end):             # <<<<<<<<<<<<<<
 *         # call the subtree_featurename functions
 *         cdef size_t k
 */

static void __pyx_f_7dragnet_6blocks_12PartialBlock__subtree_fe(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self, int __pyx_v_start_or_end) {
  size_t __pyx_v_k;
  __Pyx_RefNannyDeclarations
  std::vector<__pyx_t_7dragnet_6blocks_subtree_t> ::size_type __pyx_t_1;
  std::vector<__pyx_t_7dragnet_6blocks_subtree_t> ::size_type __pyx_t_2;
  size_t __pyx_t_3;
  __Pyx_RefNannySetupContext("_subtree_fe", 0);

  /* "dragnet/blocks.pyx":527
 *         # call the subtree_featurename functions
 *         cdef size_t k
 *         for k in range(self._subtree_func.size()):             # <<<<<<<<<<<<<<
 *             self._subtree_func[k](self, start_or_end)
 * 
 */
  __pyx_t_1 = __pyx_v_self->_subtree_func.size();
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_k = __pyx_t_3;

    /* "dragnet/blocks.pyx":528
 *         cdef size_t k
 *         for k in range(self._subtree_func.size()):
 *             self._subtree_func[k](self, start_or_end)             # <<<<<<<<<<<<<<
 * 
 *     cdef void subtree_readability(self, int start_or_end):
 */
    (__pyx_v_self->_subtree_func[__pyx_v_k])(__pyx_v_self, __pyx_v_start_or_end);
  }

  /* "dragnet/blocks.pyx":524
 *             self._tag_func[k](self, tag)
 * 
 *     cdef void _subtree_fe(self, int start_or_end):             # <<<<<<<<<<<<<<
 *         # call the subtree_featurename functions
 *         cdef size_t k
 */

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

/* "dragnet/blocks.pyx":530
 *             self._subtree_func[k](self, start_or_end)
 * 
 *     cdef void subtree_readability(self, int start_or_end):             # <<<<<<<<<<<<<<
 *         if start_or_end == 1:
 *             self.ancestors.push_back(self.tag_id)
 */

static void __pyx_f_7dragnet_6blocks_12PartialBlock_subtree_readability(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self, int __pyx_v_start_or_end) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("subtree_readability", 0);

  /* "dragnet/blocks.pyx":531
 * 
 *     cdef void subtree_readability(self, int start_or_end):
 *         if start_or_end == 1:             # <<<<<<<<<<<<<<
 *             self.ancestors.push_back(self.tag_id)
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_start_or_end == 1) != 0);
  if (__pyx_t_1) {

    /* "dragnet/blocks.pyx":532
 *     cdef void subtree_readability(self, int start_or_end):
 *         if start_or_end == 1:
 *             self.ancestors.push_back(self.tag_id)             # <<<<<<<<<<<<<<
 *         else:
 *             self.tag_id = self.ancestors.back()
 */
    try {
      __pyx_v_self->ancestors.push_back(__pyx_v_self->tag_id);
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 532, __pyx_L1_error)
    }

    /* "dragnet/blocks.pyx":531
 * 
 *     cdef void subtree_readability(self, int start_or_end):
 *         if start_or_end == 1:             # <<<<<<<<<<<<<<
 *             self.ancestors.push_back(self.tag_id)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "dragnet/blocks.pyx":534
 *             self.ancestors.push_back(self.tag_id)
 *         else:
 *             self.tag_id = self.ancestors.back()             # <<<<<<<<<<<<<<
 *             self.ancestors.pop_back()
 * 
 */
  /*else*/ {
    __pyx_v_self->tag_id = __pyx_v_self->ancestors.back();

    /* "dragnet/blocks.pyx":535
 *         else:
 *             self.tag_id = self.ancestors.back()
 *             self.ancestors.pop_back()             # <<<<<<<<<<<<<<
 * 
 *     cdef void readability_score_node(self, cetree.tree.xmlNode* node):
 */
    __pyx_v_self->ancestors.pop_back();
  }
  __pyx_L3:;

  /* "dragnet/blocks.pyx":530
 *             self._subtree_func[k](self, start_or_end)
 * 
 *     cdef void subtree_readability(self, int start_or_end):             # <<<<<<<<<<<<<<
 *         if start_or_end == 1:
 *             self.ancestors.push_back(self.tag_id)
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("dragnet.blocks.PartialBlock.subtree_readability", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "dragnet/blocks.pyx":537
 *             self.ancestors.pop_back()
 * 
 *     cdef void readability_score_node(self, cetree.tree.xmlNode* node):             # <<<<<<<<<<<<<<
 *         cdef int weight = 0
 *         cdef cetree.tree.xmlAttr* attr
 */

static void __pyx_f_7dragnet_6blocks_12PartialBlock_readability_score_node(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self, xmlNode *__pyx_v_node) {
  int __pyx_v_weight;
  xmlAttr *__pyx_v_attr;
  size_t __pyx_v_k;
  PyObject *__pyx_v_id_class = NULL;
  std::string __pyx_v_attrib;
  std::string __pyx_v_tag;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  std::vector<std::string> ::size_type __pyx_t_2;
  std::vector<std::string> ::size_type __pyx_t_3;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  std::string __pyx_t_8;
  std::pair<uint32_t,int>  __pyx_t_9;
  __Pyx_RefNannySetupContext("readability_score_node", 0);

  /* "dragnet/blocks.pyx":538
 * 
 *     cdef void readability_score_node(self, cetree.tree.xmlNode* node):
 *         cdef int weight = 0             # <<<<<<<<<<<<<<
 *         cdef cetree.tree.xmlAttr* attr
 *         cdef size_t k
 */
  __pyx_v_weight = 0;

  /* "dragnet/blocks.pyx":541
 *         cdef cetree.tree.xmlAttr* attr
 *         cdef size_t k
 *         id_class = ''             # <<<<<<<<<<<<<<
 *         cdef string attrib
 *         cdef string tag
 */
  __Pyx_INCREF(__pyx_kp_s__2);
  __pyx_v_id_class = __pyx_kp_s__2;

  /* "dragnet/blocks.pyx":547
 *         # check to see if we've already scored this tag_id.
 *         # if so don't score again
 *         if (self.class_weights_written.find(self.tag_id) !=             # <<<<<<<<<<<<<<
 *                 self.class_weights_written.end()):
 *             return
 */
  __pyx_t_1 = ((__pyx_v_self->class_weights_written.find(__pyx_v_self->tag_id) != __pyx_v_self->class_weights_written.end()) != 0);
  if (__pyx_t_1) {

    /* "dragnet/blocks.pyx":549
 *         if (self.class_weights_written.find(self.tag_id) !=
 *                 self.class_weights_written.end()):
 *             return             # <<<<<<<<<<<<<<
 * 
 *         # first the class/id weights
 */
    goto __pyx_L0;

    /* "dragnet/blocks.pyx":547
 *         # check to see if we've already scored this tag_id.
 *         # if so don't score again
 *         if (self.class_weights_written.find(self.tag_id) !=             # <<<<<<<<<<<<<<
 *                 self.class_weights_written.end()):
 *             return
 */
  }

  /* "dragnet/blocks.pyx":552
 * 
 *         # first the class/id weights
 *         for k in range(self.css_attrib.size()):             # <<<<<<<<<<<<<<
 *             attrib = self.css_attrib[k]
 *             attr = cetree.tree.xmlHasProp(node,
 */
  __pyx_t_2 = __pyx_v_self->css_attrib.size();
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_k = __pyx_t_4;

    /* "dragnet/blocks.pyx":553
 *         # first the class/id weights
 *         for k in range(self.css_attrib.size()):
 *             attrib = self.css_attrib[k]             # <<<<<<<<<<<<<<
 *             attr = cetree.tree.xmlHasProp(node,
 *                 <cetree.tree.const_xmlChar*> attrib.c_str())
 */
    __pyx_v_attrib = (__pyx_v_self->css_attrib[__pyx_v_k]);

    /* "dragnet/blocks.pyx":554
 *         for k in range(self.css_attrib.size()):
 *             attrib = self.css_attrib[k]
 *             attr = cetree.tree.xmlHasProp(node,             # <<<<<<<<<<<<<<
 *                 <cetree.tree.const_xmlChar*> attrib.c_str())
 *             if attr is not NULL:
 */
    __pyx_v_attr = xmlHasProp(__pyx_v_node, ((const xmlChar *)__pyx_v_attrib.c_str()));

    /* "dragnet/blocks.pyx":556
 *             attr = cetree.tree.xmlHasProp(node,
 *                 <cetree.tree.const_xmlChar*> attrib.c_str())
 *             if attr is not NULL:             # <<<<<<<<<<<<<<
 *                 id_class = cetree.attributeValue(node, attr)
 *                 if re_readability_negative.search(id_class):
 */
    __pyx_t_1 = ((__pyx_v_attr != NULL) != 0);
    if (__pyx_t_1) {

      /* "dragnet/blocks.pyx":557
 *                 <cetree.tree.const_xmlChar*> attrib.c_str())
 *             if attr is not NULL:
 *                 id_class = cetree.attributeValue(node, attr)             # <<<<<<<<<<<<<<
 *                 if re_readability_negative.search(id_class):
 *                     weight -= 25
 */
      __pyx_t_5 = attributeValue(__pyx_v_node, __pyx_v_attr); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 557, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF_SET(__pyx_v_id_class, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "dragnet/blocks.pyx":558
 *             if attr is not NULL:
 *                 id_class = cetree.attributeValue(node, attr)
 *                 if re_readability_negative.search(id_class):             # <<<<<<<<<<<<<<
 *                     weight -= 25
 *                 if re_readability_positive.search(id_class):
 */
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_re_readability_negative); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 558, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_search); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 558, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_6, __pyx_v_id_class) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_id_class);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 558, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 558, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_1) {

        /* "dragnet/blocks.pyx":559
 *                 id_class = cetree.attributeValue(node, attr)
 *                 if re_readability_negative.search(id_class):
 *                     weight -= 25             # <<<<<<<<<<<<<<
 *                 if re_readability_positive.search(id_class):
 *                     weight += 25
 */
        __pyx_v_weight = (__pyx_v_weight - 25);

        /* "dragnet/blocks.pyx":558
 *             if attr is not NULL:
 *                 id_class = cetree.attributeValue(node, attr)
 *                 if re_readability_negative.search(id_class):             # <<<<<<<<<<<<<<
 *                     weight -= 25
 *                 if re_readability_positive.search(id_class):
 */
      }

      /* "dragnet/blocks.pyx":560
 *                 if re_readability_negative.search(id_class):
 *                     weight -= 25
 *                 if re_readability_positive.search(id_class):             # <<<<<<<<<<<<<<
 *                     weight += 25
 * 
 */
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_re_readability_positive); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 560, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_search); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 560, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_id_class) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_id_class);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 560, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 560, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_1) {

        /* "dragnet/blocks.pyx":561
 *                     weight -= 25
 *                 if re_readability_positive.search(id_class):
 *                     weight += 25             # <<<<<<<<<<<<<<
 * 
 *         # now the tag name specific weight
 */
        __pyx_v_weight = (__pyx_v_weight + 25);

        /* "dragnet/blocks.pyx":560
 *                 if re_readability_negative.search(id_class):
 *                     weight -= 25
 *                 if re_readability_positive.search(id_class):             # <<<<<<<<<<<<<<
 *                     weight += 25
 * 
 */
      }

      /* "dragnet/blocks.pyx":556
 *             attr = cetree.tree.xmlHasProp(node,
 *                 <cetree.tree.const_xmlChar*> attrib.c_str())
 *             if attr is not NULL:             # <<<<<<<<<<<<<<
 *                 id_class = cetree.attributeValue(node, attr)
 *                 if re_readability_negative.search(id_class):
 */
    }
  }

  /* "dragnet/blocks.pyx":564
 * 
 *         # now the tag name specific weight
 *         tag = <string> cetree.namespacedName(node).encode('utf-8')             # <<<<<<<<<<<<<<
 *         if tag == DIV:
 *             weight += 5
 */
  __pyx_t_6 = namespacedName(__pyx_v_node); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_encode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_6, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_kp_s_utf_8);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_5); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_tag = ((std::string)__pyx_t_8);

  /* "dragnet/blocks.pyx":565
 *         # now the tag name specific weight
 *         tag = <string> cetree.namespacedName(node).encode('utf-8')
 *         if tag == DIV:             # <<<<<<<<<<<<<<
 *             weight += 5
 *         elif READABILITY_PLUS3.find(tag) != READABILITY_PLUS3.end():
 */
  __pyx_t_1 = ((__pyx_v_tag == __pyx_v_7dragnet_6blocks_DIV) != 0);
  if (__pyx_t_1) {

    /* "dragnet/blocks.pyx":566
 *         tag = <string> cetree.namespacedName(node).encode('utf-8')
 *         if tag == DIV:
 *             weight += 5             # <<<<<<<<<<<<<<
 *         elif READABILITY_PLUS3.find(tag) != READABILITY_PLUS3.end():
 *             weight += 5
 */
    __pyx_v_weight = (__pyx_v_weight + 5);

    /* "dragnet/blocks.pyx":565
 *         # now the tag name specific weight
 *         tag = <string> cetree.namespacedName(node).encode('utf-8')
 *         if tag == DIV:             # <<<<<<<<<<<<<<
 *             weight += 5
 *         elif READABILITY_PLUS3.find(tag) != READABILITY_PLUS3.end():
 */
    goto __pyx_L9;
  }

  /* "dragnet/blocks.pyx":567
 *         if tag == DIV:
 *             weight += 5
 *         elif READABILITY_PLUS3.find(tag) != READABILITY_PLUS3.end():             # <<<<<<<<<<<<<<
 *             weight += 5
 *         elif READABILITY_MINUS3.find(tag) != READABILITY_MINUS3.end():
 */
  __pyx_t_1 = ((__pyx_v_7dragnet_6blocks_READABILITY_PLUS3.find(__pyx_v_tag) != __pyx_v_7dragnet_6blocks_READABILITY_PLUS3.end()) != 0);
  if (__pyx_t_1) {

    /* "dragnet/blocks.pyx":568
 *             weight += 5
 *         elif READABILITY_PLUS3.find(tag) != READABILITY_PLUS3.end():
 *             weight += 5             # <<<<<<<<<<<<<<
 *         elif READABILITY_MINUS3.find(tag) != READABILITY_MINUS3.end():
 *             weight -= 3
 */
    __pyx_v_weight = (__pyx_v_weight + 5);

    /* "dragnet/blocks.pyx":567
 *         if tag == DIV:
 *             weight += 5
 *         elif READABILITY_PLUS3.find(tag) != READABILITY_PLUS3.end():             # <<<<<<<<<<<<<<
 *             weight += 5
 *         elif READABILITY_MINUS3.find(tag) != READABILITY_MINUS3.end():
 */
    goto __pyx_L9;
  }

  /* "dragnet/blocks.pyx":569
 *         elif READABILITY_PLUS3.find(tag) != READABILITY_PLUS3.end():
 *             weight += 5
 *         elif READABILITY_MINUS3.find(tag) != READABILITY_MINUS3.end():             # <<<<<<<<<<<<<<
 *             weight -= 3
 *         elif READABILITY_MINUS5.find(tag) != READABILITY_MINUS5.end():
 */
  __pyx_t_1 = ((__pyx_v_7dragnet_6blocks_READABILITY_MINUS3.find(__pyx_v_tag) != __pyx_v_7dragnet_6blocks_READABILITY_MINUS3.end()) != 0);
  if (__pyx_t_1) {

    /* "dragnet/blocks.pyx":570
 *             weight += 5
 *         elif READABILITY_MINUS3.find(tag) != READABILITY_MINUS3.end():
 *             weight -= 3             # <<<<<<<<<<<<<<
 *         elif READABILITY_MINUS5.find(tag) != READABILITY_MINUS5.end():
 *             weight -= 5
 */
    __pyx_v_weight = (__pyx_v_weight - 3);

    /* "dragnet/blocks.pyx":569
 *         elif READABILITY_PLUS3.find(tag) != READABILITY_PLUS3.end():
 *             weight += 5
 *         elif READABILITY_MINUS3.find(tag) != READABILITY_MINUS3.end():             # <<<<<<<<<<<<<<
 *             weight -= 3
 *         elif READABILITY_MINUS5.find(tag) != READABILITY_MINUS5.end():
 */
    goto __pyx_L9;
  }

  /* "dragnet/blocks.pyx":571
 *         elif READABILITY_MINUS3.find(tag) != READABILITY_MINUS3.end():
 *             weight -= 3
 *         elif READABILITY_MINUS5.find(tag) != READABILITY_MINUS5.end():             # <<<<<<<<<<<<<<
 *             weight -= 5
 * 
 */
  __pyx_t_1 = ((__pyx_v_7dragnet_6blocks_READABILITY_MINUS5.find(__pyx_v_tag) != __pyx_v_7dragnet_6blocks_READABILITY_MINUS5.end()) != 0);
  if (__pyx_t_1) {

    /* "dragnet/blocks.pyx":572
 *             weight -= 3
 *         elif READABILITY_MINUS5.find(tag) != READABILITY_MINUS5.end():
 *             weight -= 5             # <<<<<<<<<<<<<<
 * 
 *         # finally store it
 */
    __pyx_v_weight = (__pyx_v_weight - 5);

    /* "dragnet/blocks.pyx":571
 *         elif READABILITY_MINUS3.find(tag) != READABILITY_MINUS3.end():
 *             weight -= 3
 *         elif READABILITY_MINUS5.find(tag) != READABILITY_MINUS5.end():             # <<<<<<<<<<<<<<
 *             weight -= 5
 * 
 */
  }
  __pyx_L9:;

  /* "dragnet/blocks.pyx":575
 * 
 *         # finally store it
 *         self.class_weights.push_back(pair[uint32_t, int](self.tag_id, weight))             # <<<<<<<<<<<<<<
 *         self.class_weights_written.insert(self.tag_id)
 * 
 */
  try {
    __pyx_t_9 = std::pair<uint32_t,int> (__pyx_v_self->tag_id, __pyx_v_weight);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 575, __pyx_L1_error)
  }
  try {
    __pyx_v_self->class_weights.push_back(__pyx_t_9);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 575, __pyx_L1_error)
  }

  /* "dragnet/blocks.pyx":576
 *         # finally store it
 *         self.class_weights.push_back(pair[uint32_t, int](self.tag_id, weight))
 *         self.class_weights_written.insert(self.tag_id)             # <<<<<<<<<<<<<<
 * 
 *     cdef void reinit_readability(self):
 */
  try {
    __pyx_v_self->class_weights_written.insert(__pyx_v_self->tag_id);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 576, __pyx_L1_error)
  }

  /* "dragnet/blocks.pyx":537
 *             self.ancestors.pop_back()
 * 
 *     cdef void readability_score_node(self, cetree.tree.xmlNode* node):             # <<<<<<<<<<<<<<
 *         cdef int weight = 0
 *         cdef cetree.tree.xmlAttr* attr
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_WriteUnraisable("dragnet.blocks.PartialBlock.readability_score_node", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_id_class);
  __Pyx_RefNannyFinishContext();
}

/* "dragnet/blocks.pyx":578
 *         self.class_weights_written.insert(self.tag_id)
 * 
 *     cdef void reinit_readability(self):             # <<<<<<<<<<<<<<
 *         self.ancestors_write = self.ancestors
 * 
 */

static void __pyx_f_7dragnet_6blocks_12PartialBlock_reinit_readability(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  std::vector<uint32_t>  __pyx_t_1;
  __Pyx_RefNannySetupContext("reinit_readability", 0);

  /* "dragnet/blocks.pyx":579
 * 
 *     cdef void reinit_readability(self):
 *         self.ancestors_write = self.ancestors             # <<<<<<<<<<<<<<
 * 
 *     cdef void recurse(self, cetree.tree.xmlNode* subtree, list results,
 */
  __pyx_t_1 = __pyx_v_self->ancestors;
  __pyx_v_self->ancestors_write = __pyx_t_1;

  /* "dragnet/blocks.pyx":578
 *         self.class_weights_written.insert(self.tag_id)
 * 
 *     cdef void reinit_readability(self):             # <<<<<<<<<<<<<<
 *         self.ancestors_write = self.ancestors
 * 
 */

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

/* "dragnet/blocks.pyx":581
 *         self.ancestors_write = self.ancestors
 * 
 *     cdef void recurse(self, cetree.tree.xmlNode* subtree, list results,             # <<<<<<<<<<<<<<
 *         cetree._Document doc):
 * 
 */

static void __pyx_f_7dragnet_6blocks_12PartialBlock_recurse(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self, xmlNode *__pyx_v_subtree, PyObject *__pyx_v_results, struct LxmlDocument *__pyx_v_doc) {
  xmlNode *__pyx_v_node;
  xmlNode *__pyx_v_next_node;
  std::string __pyx_v_tag;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  uint32_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  std::string __pyx_t_7;
  __Pyx_RefNannySetupContext("recurse", 0);

  /* "dragnet/blocks.pyx":589
 *         # for CSS, we want to output all CSS tags for all levels in subtree
 *         # we will add them on entry, and pop them on exit
 *         if self.do_css:             # <<<<<<<<<<<<<<
 *             self.update_css(subtree, True)
 * 
 */
  __pyx_t_1 = (__pyx_v_self->do_css != 0);
  if (__pyx_t_1) {

    /* "dragnet/blocks.pyx":590
 *         # we will add them on entry, and pop them on exit
 *         if self.do_css:
 *             self.update_css(subtree, True)             # <<<<<<<<<<<<<<
 * 
 *         self._subtree_fe(1)
 */
    ((struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock *)__pyx_v_self->__pyx_vtab)->update_css(__pyx_v_self, __pyx_v_subtree, 1);

    /* "dragnet/blocks.pyx":589
 *         # for CSS, we want to output all CSS tags for all levels in subtree
 *         # we will add them on entry, and pop them on exit
 *         if self.do_css:             # <<<<<<<<<<<<<<
 *             self.update_css(subtree, True)
 * 
 */
  }

  /* "dragnet/blocks.pyx":592
 *             self.update_css(subtree, True)
 * 
 *         self._subtree_fe(1)             # <<<<<<<<<<<<<<
 *         if self.do_readability:
 *             self.readability_score_node(subtree)
 */
  ((struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock *)__pyx_v_self->__pyx_vtab)->_subtree_fe(__pyx_v_self, 1);

  /* "dragnet/blocks.pyx":593
 * 
 *         self._subtree_fe(1)
 *         if self.do_readability:             # <<<<<<<<<<<<<<
 *             self.readability_score_node(subtree)
 * 
 */
  __pyx_t_1 = (__pyx_v_self->do_readability != 0);
  if (__pyx_t_1) {

    /* "dragnet/blocks.pyx":594
 *         self._subtree_fe(1)
 *         if self.do_readability:
 *             self.readability_score_node(subtree)             # <<<<<<<<<<<<<<
 * 
 *         # first iteration through need to set
 */
    ((struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock *)__pyx_v_self->__pyx_vtab)->readability_score_node(__pyx_v_self, __pyx_v_subtree);

    /* "dragnet/blocks.pyx":593
 * 
 *         self._subtree_fe(1)
 *         if self.do_readability:             # <<<<<<<<<<<<<<
 *             self.readability_score_node(subtree)
 * 
 */
  }

  /* "dragnet/blocks.pyx":597
 * 
 *         # first iteration through need to set
 *         if self.block_start_element is None:             # <<<<<<<<<<<<<<
 *             self.block_start_element = cetree.elementFactory(doc, subtree)
 * 
 */
  __pyx_t_1 = (__pyx_v_self->block_start_element == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "dragnet/blocks.pyx":598
 *         # first iteration through need to set
 *         if self.block_start_element is None:
 *             self.block_start_element = cetree.elementFactory(doc, subtree)             # <<<<<<<<<<<<<<
 * 
 *         # iterate through children
 */
    __pyx_t_3 = ((PyObject *)elementFactory(__pyx_v_doc, __pyx_v_subtree)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 598, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->block_start_element);
    __Pyx_DECREF(__pyx_v_self->block_start_element);
    __pyx_v_self->block_start_element = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "dragnet/blocks.pyx":597
 * 
 *         # first iteration through need to set
 *         if self.block_start_element is None:             # <<<<<<<<<<<<<<
 *             self.block_start_element = cetree.elementFactory(doc, subtree)
 * 
 */
  }

  /* "dragnet/blocks.pyx":601
 * 
 *         # iterate through children
 *         if cetree.hasChild(subtree):             # <<<<<<<<<<<<<<
 *             node = cetree.findChild(subtree, 0)
 *             self.tag_id = self.next_tag_id
 */
  __pyx_t_2 = (hasChild(__pyx_v_subtree) != 0);
  if (__pyx_t_2) {

    /* "dragnet/blocks.pyx":602
 *         # iterate through children
 *         if cetree.hasChild(subtree):
 *             node = cetree.findChild(subtree, 0)             # <<<<<<<<<<<<<<
 *             self.tag_id = self.next_tag_id
 *             self.next_tag_id += 1
 */
    __pyx_v_node = findChild(__pyx_v_subtree, 0);

    /* "dragnet/blocks.pyx":603
 *         if cetree.hasChild(subtree):
 *             node = cetree.findChild(subtree, 0)
 *             self.tag_id = self.next_tag_id             # <<<<<<<<<<<<<<
 *             self.next_tag_id += 1
 *         else:
 */
    __pyx_t_4 = __pyx_v_self->next_tag_id;
    __pyx_v_self->tag_id = __pyx_t_4;

    /* "dragnet/blocks.pyx":604
 *             node = cetree.findChild(subtree, 0)
 *             self.tag_id = self.next_tag_id
 *             self.next_tag_id += 1             # <<<<<<<<<<<<<<
 *         else:
 *             node = NULL
 */
    __pyx_v_self->next_tag_id = (__pyx_v_self->next_tag_id + 1);

    /* "dragnet/blocks.pyx":601
 * 
 *         # iterate through children
 *         if cetree.hasChild(subtree):             # <<<<<<<<<<<<<<
 *             node = cetree.findChild(subtree, 0)
 *             self.tag_id = self.next_tag_id
 */
    goto __pyx_L6;
  }

  /* "dragnet/blocks.pyx":606
 *             self.next_tag_id += 1
 *         else:
 *             node = NULL             # <<<<<<<<<<<<<<
 * 
 *         while node != NULL:
 */
  /*else*/ {
    __pyx_v_node = NULL;
  }
  __pyx_L6:;

  /* "dragnet/blocks.pyx":608
 *             node = NULL
 * 
 *         while node != NULL:             # <<<<<<<<<<<<<<
 * 
 *             # readability
 */
  while (1) {
    __pyx_t_2 = ((__pyx_v_node != NULL) != 0);
    if (!__pyx_t_2) break;

    /* "dragnet/blocks.pyx":613
 *             # update the tag_id.  we do it here so it's updated for every
 *             # potential parent
 *             self.tag_id = self.next_tag_id             # <<<<<<<<<<<<<<
 *             self.next_tag_id += 1
 * 
 */
    __pyx_t_4 = __pyx_v_self->next_tag_id;
    __pyx_v_self->tag_id = __pyx_t_4;

    /* "dragnet/blocks.pyx":614
 *             # potential parent
 *             self.tag_id = self.next_tag_id
 *             self.next_tag_id += 1             # <<<<<<<<<<<<<<
 * 
 *             # get the tag
 */
    __pyx_v_self->next_tag_id = (__pyx_v_self->next_tag_id + 1);

    /* "dragnet/blocks.pyx":617
 * 
 *             # get the tag
 *             tag = <string> cetree.namespacedName(node).encode('utf-8')             # <<<<<<<<<<<<<<
 * 
 *             if self._tag_func.size() > 0:
 */
    __pyx_t_5 = namespacedName(__pyx_v_node); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 617, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_encode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 617, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_s_utf_8);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 617, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 617, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_tag = ((std::string)__pyx_t_7);

    /* "dragnet/blocks.pyx":619
 *             tag = <string> cetree.namespacedName(node).encode('utf-8')
 * 
 *             if self._tag_func.size() > 0:             # <<<<<<<<<<<<<<
 *                 self._tag_fe(tag)
 * 
 */
    __pyx_t_2 = ((__pyx_v_self->_tag_func.size() > 0) != 0);
    if (__pyx_t_2) {

      /* "dragnet/blocks.pyx":620
 * 
 *             if self._tag_func.size() > 0:
 *                 self._tag_fe(tag)             # <<<<<<<<<<<<<<
 * 
 *             if BLACKLIST.find(tag) != BLACKLIST.end():
 */
      ((struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock *)__pyx_v_self->__pyx_vtab)->_tag_fe(__pyx_v_self, __pyx_v_tag);

      /* "dragnet/blocks.pyx":619
 *             tag = <string> cetree.namespacedName(node).encode('utf-8')
 * 
 *             if self._tag_func.size() > 0:             # <<<<<<<<<<<<<<
 *                 self._tag_fe(tag)
 * 
 */
    }

    /* "dragnet/blocks.pyx":622
 *                 self._tag_fe(tag)
 * 
 *             if BLACKLIST.find(tag) != BLACKLIST.end():             # <<<<<<<<<<<<<<
 *                 # in the blacklist
 *                 # in this case, skip the entire tag,
 */
    __pyx_t_2 = ((__pyx_v_7dragnet_6blocks_BLACKLIST.find(__pyx_v_tag) != __pyx_v_7dragnet_6blocks_BLACKLIST.end()) != 0);
    if (__pyx_t_2) {

      /* "dragnet/blocks.pyx":626
 *                 # in this case, skip the entire tag,
 *                 # but it might have some tail text we need
 *                 self.add_text(node, CTAIL)             # <<<<<<<<<<<<<<
 * 
 *             elif BLOCKS.find(tag) != BLOCKS.end():
 */
      ((struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock *)__pyx_v_self->__pyx_vtab)->add_text(__pyx_v_self, __pyx_v_node, __pyx_v_7dragnet_6blocks_CTAIL);

      /* "dragnet/blocks.pyx":622
 *                 self._tag_fe(tag)
 * 
 *             if BLACKLIST.find(tag) != BLACKLIST.end():             # <<<<<<<<<<<<<<
 *                 # in the blacklist
 *                 # in this case, skip the entire tag,
 */
      goto __pyx_L10;
    }

    /* "dragnet/blocks.pyx":628
 *                 self.add_text(node, CTAIL)
 * 
 *             elif BLOCKS.find(tag) != BLOCKS.end():             # <<<<<<<<<<<<<<
 *                 # this is the start of a new block
 *                 # add the existing block to the list,
 */
    __pyx_t_2 = ((__pyx_v_7dragnet_6blocks_BLOCKS.find(__pyx_v_tag) != __pyx_v_7dragnet_6blocks_BLOCKS.end()) != 0);
    if (__pyx_t_2) {

      /* "dragnet/blocks.pyx":632
 *                 # add the existing block to the list,
 *                 # start the new block and recurse
 *                 self.add_block_to_results(results)             # <<<<<<<<<<<<<<
 *                 self.block_start_tag = tag
 *                 self.block_start_element = cetree.elementFactory(doc, node)
 */
      ((struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock *)__pyx_v_self->__pyx_vtab)->add_block_to_results(__pyx_v_self, __pyx_v_results);

      /* "dragnet/blocks.pyx":633
 *                 # start the new block and recurse
 *                 self.add_block_to_results(results)
 *                 self.block_start_tag = tag             # <<<<<<<<<<<<<<
 *                 self.block_start_element = cetree.elementFactory(doc, node)
 *                 self.add_text(node, CTEXT)
 */
      __pyx_v_self->block_start_tag = __pyx_v_tag;

      /* "dragnet/blocks.pyx":634
 *                 self.add_block_to_results(results)
 *                 self.block_start_tag = tag
 *                 self.block_start_element = cetree.elementFactory(doc, node)             # <<<<<<<<<<<<<<
 *                 self.add_text(node, CTEXT)
 *                 if self.do_css:
 */
      __pyx_t_3 = ((PyObject *)elementFactory(__pyx_v_doc, __pyx_v_node)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 634, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_v_self->block_start_element);
      __Pyx_DECREF(__pyx_v_self->block_start_element);
      __pyx_v_self->block_start_element = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "dragnet/blocks.pyx":635
 *                 self.block_start_tag = tag
 *                 self.block_start_element = cetree.elementFactory(doc, node)
 *                 self.add_text(node, CTEXT)             # <<<<<<<<<<<<<<
 *                 if self.do_css:
 *                     self.update_css(node, False)
 */
      ((struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock *)__pyx_v_self->__pyx_vtab)->add_text(__pyx_v_self, __pyx_v_node, __pyx_v_7dragnet_6blocks_CTEXT);

      /* "dragnet/blocks.pyx":636
 *                 self.block_start_element = cetree.elementFactory(doc, node)
 *                 self.add_text(node, CTEXT)
 *                 if self.do_css:             # <<<<<<<<<<<<<<
 *                     self.update_css(node, False)
 *                 self.recurse(node, results, doc)
 */
      __pyx_t_2 = (__pyx_v_self->do_css != 0);
      if (__pyx_t_2) {

        /* "dragnet/blocks.pyx":637
 *                 self.add_text(node, CTEXT)
 *                 if self.do_css:
 *                     self.update_css(node, False)             # <<<<<<<<<<<<<<
 *                 self.recurse(node, results, doc)
 *                 self.add_text(node, CTAIL)
 */
        ((struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock *)__pyx_v_self->__pyx_vtab)->update_css(__pyx_v_self, __pyx_v_node, 0);

        /* "dragnet/blocks.pyx":636
 *                 self.block_start_element = cetree.elementFactory(doc, node)
 *                 self.add_text(node, CTEXT)
 *                 if self.do_css:             # <<<<<<<<<<<<<<
 *                     self.update_css(node, False)
 *                 self.recurse(node, results, doc)
 */
      }

      /* "dragnet/blocks.pyx":638
 *                 if self.do_css:
 *                     self.update_css(node, False)
 *                 self.recurse(node, results, doc)             # <<<<<<<<<<<<<<
 *                 self.add_text(node, CTAIL)
 * 
 */
      ((struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock *)__pyx_v_self->__pyx_vtab)->recurse(__pyx_v_self, __pyx_v_node, __pyx_v_results, __pyx_v_doc);

      /* "dragnet/blocks.pyx":639
 *                     self.update_css(node, False)
 *                 self.recurse(node, results, doc)
 *                 self.add_text(node, CTAIL)             # <<<<<<<<<<<<<<
 * 
 *             elif tag == A:
 */
      ((struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock *)__pyx_v_self->__pyx_vtab)->add_text(__pyx_v_self, __pyx_v_node, __pyx_v_7dragnet_6blocks_CTAIL);

      /* "dragnet/blocks.pyx":628
 *                 self.add_text(node, CTAIL)
 * 
 *             elif BLOCKS.find(tag) != BLOCKS.end():             # <<<<<<<<<<<<<<
 *                 # this is the start of a new block
 *                 # add the existing block to the list,
 */
      goto __pyx_L10;
    }

    /* "dragnet/blocks.pyx":641
 *                 self.add_text(node, CTAIL)
 * 
 *             elif tag == A:             # <<<<<<<<<<<<<<
 *                 # an anchor tag
 *                 self.add_anchor(node, doc)
 */
    __pyx_t_2 = ((__pyx_v_tag == __pyx_v_7dragnet_6blocks_A) != 0);
    if (__pyx_t_2) {

      /* "dragnet/blocks.pyx":643
 *             elif tag == A:
 *                 # an anchor tag
 *                 self.add_anchor(node, doc)             # <<<<<<<<<<<<<<
 *                 if self.do_css:
 *                     self.update_css(node, False)
 */
      ((struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock *)__pyx_v_self->__pyx_vtab)->add_anchor(__pyx_v_self, __pyx_v_node, __pyx_v_doc);

      /* "dragnet/blocks.pyx":644
 *                 # an anchor tag
 *                 self.add_anchor(node, doc)
 *                 if self.do_css:             # <<<<<<<<<<<<<<
 *                     self.update_css(node, False)
 * 
 */
      __pyx_t_2 = (__pyx_v_self->do_css != 0);
      if (__pyx_t_2) {

        /* "dragnet/blocks.pyx":645
 *                 self.add_anchor(node, doc)
 *                 if self.do_css:
 *                     self.update_css(node, False)             # <<<<<<<<<<<<<<
 * 
 *             else:
 */
        ((struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock *)__pyx_v_self->__pyx_vtab)->update_css(__pyx_v_self, __pyx_v_node, 0);

        /* "dragnet/blocks.pyx":644
 *                 # an anchor tag
 *                 self.add_anchor(node, doc)
 *                 if self.do_css:             # <<<<<<<<<<<<<<
 *                     self.update_css(node, False)
 * 
 */
      }

      /* "dragnet/blocks.pyx":641
 *                 self.add_text(node, CTAIL)
 * 
 *             elif tag == A:             # <<<<<<<<<<<<<<
 *                 # an anchor tag
 *                 self.add_anchor(node, doc)
 */
      goto __pyx_L10;
    }

    /* "dragnet/blocks.pyx":650
 *                 # a standard tag.
 *                 # we need to get its text and then recurse over the subtree
 *                 self.add_text(node, CTEXT)             # <<<<<<<<<<<<<<
 *                 if self.do_css:
 *                     self.update_css(node, False)
 */
    /*else*/ {
      ((struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock *)__pyx_v_self->__pyx_vtab)->add_text(__pyx_v_self, __pyx_v_node, __pyx_v_7dragnet_6blocks_CTEXT);

      /* "dragnet/blocks.pyx":651
 *                 # we need to get its text and then recurse over the subtree
 *                 self.add_text(node, CTEXT)
 *                 if self.do_css:             # <<<<<<<<<<<<<<
 *                     self.update_css(node, False)
 *                 self.recurse(node, results, doc)
 */
      __pyx_t_2 = (__pyx_v_self->do_css != 0);
      if (__pyx_t_2) {

        /* "dragnet/blocks.pyx":652
 *                 self.add_text(node, CTEXT)
 *                 if self.do_css:
 *                     self.update_css(node, False)             # <<<<<<<<<<<<<<
 *                 self.recurse(node, results, doc)
 *                 self.add_text(node, CTAIL)
 */
        ((struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock *)__pyx_v_self->__pyx_vtab)->update_css(__pyx_v_self, __pyx_v_node, 0);

        /* "dragnet/blocks.pyx":651
 *                 # we need to get its text and then recurse over the subtree
 *                 self.add_text(node, CTEXT)
 *                 if self.do_css:             # <<<<<<<<<<<<<<
 *                     self.update_css(node, False)
 *                 self.recurse(node, results, doc)
 */
      }

      /* "dragnet/blocks.pyx":653
 *                 if self.do_css:
 *                     self.update_css(node, False)
 *                 self.recurse(node, results, doc)             # <<<<<<<<<<<<<<
 *                 self.add_text(node, CTAIL)
 * 
 */
      ((struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock *)__pyx_v_self->__pyx_vtab)->recurse(__pyx_v_self, __pyx_v_node, __pyx_v_results, __pyx_v_doc);

      /* "dragnet/blocks.pyx":654
 *                     self.update_css(node, False)
 *                 self.recurse(node, results, doc)
 *                 self.add_text(node, CTAIL)             # <<<<<<<<<<<<<<
 * 
 *             # reset for next iteration
 */
      ((struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock *)__pyx_v_self->__pyx_vtab)->add_text(__pyx_v_self, __pyx_v_node, __pyx_v_7dragnet_6blocks_CTAIL);
    }
    __pyx_L10:;

    /* "dragnet/blocks.pyx":657
 * 
 *             # reset for next iteration
 *             next_node = cetree.nextElement(node)             # <<<<<<<<<<<<<<
 *             node = next_node
 * 
 */
    __pyx_v_next_node = nextElement(__pyx_v_node);

    /* "dragnet/blocks.pyx":658
 *             # reset for next iteration
 *             next_node = cetree.nextElement(node)
 *             node = next_node             # <<<<<<<<<<<<<<
 * 
 *         if self.do_css:
 */
    __pyx_v_node = __pyx_v_next_node;
  }

  /* "dragnet/blocks.pyx":660
 *             node = next_node
 * 
 *         if self.do_css:             # <<<<<<<<<<<<<<
 *             self.pop_css_tree()
 *         self._subtree_fe(-1)
 */
  __pyx_t_2 = (__pyx_v_self->do_css != 0);
  if (__pyx_t_2) {

    /* "dragnet/blocks.pyx":661
 * 
 *         if self.do_css:
 *             self.pop_css_tree()             # <<<<<<<<<<<<<<
 *         self._subtree_fe(-1)
 * 
 */
    ((struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock *)__pyx_v_self->__pyx_vtab)->pop_css_tree(__pyx_v_self);

    /* "dragnet/blocks.pyx":660
 *             node = next_node
 * 
 *         if self.do_css:             # <<<<<<<<<<<<<<
 *             self.pop_css_tree()
 *         self._subtree_fe(-1)
 */
  }

  /* "dragnet/blocks.pyx":662
 *         if self.do_css:
 *             self.pop_css_tree()
 *         self._subtree_fe(-1)             # <<<<<<<<<<<<<<
 * 
 *     cdef void update_css(self, cetree.tree.xmlNode *child, bool tree):
 */
  ((struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock *)__pyx_v_self->__pyx_vtab)->_subtree_fe(__pyx_v_self, -1);

  /* "dragnet/blocks.pyx":581
 *         self.ancestors_write = self.ancestors
 * 
 *     cdef void recurse(self, cetree.tree.xmlNode* subtree, list results,             # <<<<<<<<<<<<<<
 *         cetree._Document doc):
 * 
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_WriteUnraisable("dragnet.blocks.PartialBlock.recurse", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "dragnet/blocks.pyx":664
 *         self._subtree_fe(-1)
 * 
 *     cdef void update_css(self, cetree.tree.xmlNode *child, bool tree):             # <<<<<<<<<<<<<<
 *         """Add the child's tag to the id, class lists"""
 *         cdef cpp_map[string, vector[string]] *css_to_update
 */

static void __pyx_f_7dragnet_6blocks_12PartialBlock_update_css(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self, xmlNode *__pyx_v_child, bool __pyx_v_tree) {
  std::map<std::string,std::vector<std::string> >  *__pyx_v_css_to_update;
  size_t __pyx_v_k;
  std::string __pyx_v_attrib;
  xmlAttr *__pyx_v_attr;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  std::vector<std::string> ::size_type __pyx_t_2;
  std::vector<std::string> ::size_type __pyx_t_3;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  std::string __pyx_t_8;
  __Pyx_RefNannySetupContext("update_css", 0);

  /* "dragnet/blocks.pyx":667
 *         """Add the child's tag to the id, class lists"""
 *         cdef cpp_map[string, vector[string]] *css_to_update
 *         if tree:             # <<<<<<<<<<<<<<
 *             css_to_update = &(self.css_tree)
 *         else:
 */
  __pyx_t_1 = (__pyx_v_tree != 0);
  if (__pyx_t_1) {

    /* "dragnet/blocks.pyx":668
 *         cdef cpp_map[string, vector[string]] *css_to_update
 *         if tree:
 *             css_to_update = &(self.css_tree)             # <<<<<<<<<<<<<<
 *         else:
 *             css_to_update = &(self.css)
 */
    __pyx_v_css_to_update = (&__pyx_v_self->css_tree);

    /* "dragnet/blocks.pyx":667
 *         """Add the child's tag to the id, class lists"""
 *         cdef cpp_map[string, vector[string]] *css_to_update
 *         if tree:             # <<<<<<<<<<<<<<
 *             css_to_update = &(self.css_tree)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "dragnet/blocks.pyx":670
 *             css_to_update = &(self.css_tree)
 *         else:
 *             css_to_update = &(self.css)             # <<<<<<<<<<<<<<
 * 
 *         cdef size_t k
 */
  /*else*/ {
    __pyx_v_css_to_update = (&__pyx_v_self->css);
  }
  __pyx_L3:;

  /* "dragnet/blocks.pyx":676
 *         cdef cetree.tree.xmlAttr* attr
 * 
 *         for k in range(self.css_attrib.size()):             # <<<<<<<<<<<<<<
 *             attrib = self.css_attrib[k]
 *             attr = cetree.tree.xmlHasProp(child,
 */
  __pyx_t_2 = __pyx_v_self->css_attrib.size();
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_k = __pyx_t_4;

    /* "dragnet/blocks.pyx":677
 * 
 *         for k in range(self.css_attrib.size()):
 *             attrib = self.css_attrib[k]             # <<<<<<<<<<<<<<
 *             attr = cetree.tree.xmlHasProp(child,
 *                 <cetree.tree.const_xmlChar*> attrib.c_str())
 */
    __pyx_v_attrib = (__pyx_v_self->css_attrib[__pyx_v_k]);

    /* "dragnet/blocks.pyx":678
 *         for k in range(self.css_attrib.size()):
 *             attrib = self.css_attrib[k]
 *             attr = cetree.tree.xmlHasProp(child,             # <<<<<<<<<<<<<<
 *                 <cetree.tree.const_xmlChar*> attrib.c_str())
 *             if attr is not NULL:
 */
    __pyx_v_attr = xmlHasProp(__pyx_v_child, ((const xmlChar *)__pyx_v_attrib.c_str()));

    /* "dragnet/blocks.pyx":680
 *             attr = cetree.tree.xmlHasProp(child,
 *                 <cetree.tree.const_xmlChar*> attrib.c_str())
 *             if attr is not NULL:             # <<<<<<<<<<<<<<
 *                 deref(css_to_update)[attrib].push_back(
 *                     <string>cetree.attributeValue(child, attr).encode('utf-8'))
 */
    __pyx_t_1 = ((__pyx_v_attr != NULL) != 0);
    if (__pyx_t_1) {

      /* "dragnet/blocks.pyx":682
 *             if attr is not NULL:
 *                 deref(css_to_update)[attrib].push_back(
 *                     <string>cetree.attributeValue(child, attr).encode('utf-8'))             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_t_6 = attributeValue(__pyx_v_child, __pyx_v_attr); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 682, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_encode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 682, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_6, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_kp_s_utf_8);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 682, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_5); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 682, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "dragnet/blocks.pyx":681
 *                 <cetree.tree.const_xmlChar*> attrib.c_str())
 *             if attr is not NULL:
 *                 deref(css_to_update)[attrib].push_back(             # <<<<<<<<<<<<<<
 *                     <string>cetree.attributeValue(child, attr).encode('utf-8'))
 * 
 */
      try {
        ((*__pyx_v_css_to_update)[__pyx_v_attrib]).push_back(((std::string)__pyx_t_8));
      } catch(...) {
        __Pyx_CppExn2PyErr();
        __PYX_ERR(0, 681, __pyx_L1_error)
      }

      /* "dragnet/blocks.pyx":680
 *             attr = cetree.tree.xmlHasProp(child,
 *                 <cetree.tree.const_xmlChar*> attrib.c_str())
 *             if attr is not NULL:             # <<<<<<<<<<<<<<
 *                 deref(css_to_update)[attrib].push_back(
 *                     <string>cetree.attributeValue(child, attr).encode('utf-8'))
 */
    }
  }

  /* "dragnet/blocks.pyx":664
 *         self._subtree_fe(-1)
 * 
 *     cdef void update_css(self, cetree.tree.xmlNode *child, bool tree):             # <<<<<<<<<<<<<<
 *         """Add the child's tag to the id, class lists"""
 *         cdef cpp_map[string, vector[string]] *css_to_update
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_WriteUnraisable("dragnet.blocks.PartialBlock.update_css", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "dragnet/blocks.pyx":685
 * 
 * 
 *     cdef void pop_css_tree(self):             # <<<<<<<<<<<<<<
 *         """pop the last entry off the css lists"""
 *         cdef size_t k
 */

static void __pyx_f_7dragnet_6blocks_12PartialBlock_pop_css_tree(struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self) {
  size_t __pyx_v_k;
  __Pyx_RefNannyDeclarations
  std::vector<std::string> ::size_type __pyx_t_1;
  std::vector<std::string> ::size_type __pyx_t_2;
  size_t __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("pop_css_tree", 0);

  /* "dragnet/blocks.pyx":688
 *         """pop the last entry off the css lists"""
 *         cdef size_t k
 *         for k in range(self.css_attrib.size()):             # <<<<<<<<<<<<<<
 *             if self.css_tree[self.css_attrib[k]].size() > 0:
 *                 self.css_tree[self.css_attrib[k]].pop_back()
 */
  __pyx_t_1 = __pyx_v_self->css_attrib.size();
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_k = __pyx_t_3;

    /* "dragnet/blocks.pyx":689
 *         cdef size_t k
 *         for k in range(self.css_attrib.size()):
 *             if self.css_tree[self.css_attrib[k]].size() > 0:             # <<<<<<<<<<<<<<
 *                 self.css_tree[self.css_attrib[k]].pop_back()
 * 
 */
    __pyx_t_4 = (((__pyx_v_self->css_tree[(__pyx_v_self->css_attrib[__pyx_v_k])]).size() > 0) != 0);
    if (__pyx_t_4) {

      /* "dragnet/blocks.pyx":690
 *         for k in range(self.css_attrib.size()):
 *             if self.css_tree[self.css_attrib[k]].size() > 0:
 *                 self.css_tree[self.css_attrib[k]].pop_back()             # <<<<<<<<<<<<<<
 * 
 * 
 */
      (__pyx_v_self->css_tree[(__pyx_v_self->css_attrib[__pyx_v_k])]).pop_back();

      /* "dragnet/blocks.pyx":689
 *         cdef size_t k
 *         for k in range(self.css_attrib.size()):
 *             if self.css_tree[self.css_attrib[k]].size() > 0:             # <<<<<<<<<<<<<<
 *                 self.css_tree[self.css_attrib[k]].pop_back()
 * 
 */
    }
  }

  /* "dragnet/blocks.pyx":685
 * 
 * 
 *     cdef void pop_css_tree(self):             # <<<<<<<<<<<<<<
 *         """pop the last entry off the css lists"""
 *         cdef size_t k
 */

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

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7dragnet_6blocks_12PartialBlock_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7dragnet_6blocks_12PartialBlock_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7dragnet_6blocks_12PartialBlock_4__reduce_cython__(((struct __pyx_obj_7dragnet_6blocks_PartialBlock *)__pyx_v_self));

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

static PyObject *__pyx_pf_7dragnet_6blocks_12PartialBlock_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("dragnet.blocks.PartialBlock.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7dragnet_6blocks_12PartialBlock_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_7dragnet_6blocks_12PartialBlock_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7dragnet_6blocks_12PartialBlock_6__setstate_cython__(((struct __pyx_obj_7dragnet_6blocks_PartialBlock *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7dragnet_6blocks_12PartialBlock_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("dragnet.blocks.PartialBlock.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "dragnet/blocks.pyx":717
 *     cdef int _min_depth_last_block, _min_depth_last_block_pending
 * 
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         PartialBlock.__init__(self, *args, **kwargs)
 * 
 */

/* Python wrapper */
static int __pyx_pw_7dragnet_6blocks_10TagCountPB_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7dragnet_6blocks_10TagCountPB_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 1))) return -1;
  if (unlikely(__pyx_kwds)) {
    __pyx_v_kwargs = PyDict_Copy(__pyx_kwds); if (unlikely(!__pyx_v_kwargs)) return -1;
    __Pyx_GOTREF(__pyx_v_kwargs);
  } else {
    __pyx_v_kwargs = NULL;
  }
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_7dragnet_6blocks_10TagCountPB___init__(((struct __pyx_obj_7dragnet_6blocks_TagCountPB *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs);

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

static int __pyx_pf_7dragnet_6blocks_10TagCountPB___init__(struct __pyx_obj_7dragnet_6blocks_TagCountPB *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "dragnet/blocks.pyx":718
 * 
 *     def __init__(self, *args, **kwargs):
 *         PartialBlock.__init__(self, *args, **kwargs)             # <<<<<<<<<<<<<<
 * 
 *         # don't need to add reinit since it's empty
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7dragnet_6blocks_PartialBlock), __pyx_n_s_init); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 718, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 718, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self));
  __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_v_args); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 718, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 718, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "dragnet/blocks.pyx":722
 *         # don't need to add reinit since it's empty
 *         #self._reinit_func.push_back(<reinit_t>TagCountPB.reinit_tagcount)
 *         self._subtree_func.push_back(<subtree_t>TagCountPB.subtree_tagcount)             # <<<<<<<<<<<<<<
 *         self._name_func.push_back(<name_t>TagCountPB.tagcount)
 *         self._tag_func.push_back(<callback_t>TagCountPB.tag_tagcount)
 */
  try {
    __pyx_v_self->__pyx_base._subtree_func.push_back(((__pyx_t_7dragnet_6blocks_subtree_t)__pyx_f_7dragnet_6blocks_10TagCountPB_subtree_tagcount));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 722, __pyx_L1_error)
  }

  /* "dragnet/blocks.pyx":723
 *         #self._reinit_func.push_back(<reinit_t>TagCountPB.reinit_tagcount)
 *         self._subtree_func.push_back(<subtree_t>TagCountPB.subtree_tagcount)
 *         self._name_func.push_back(<name_t>TagCountPB.tagcount)             # <<<<<<<<<<<<<<
 *         self._tag_func.push_back(<callback_t>TagCountPB.tag_tagcount)
 * 
 */
  try {
    __pyx_v_self->__pyx_base._name_func.push_back(((__pyx_t_7dragnet_6blocks_name_t)__pyx_f_7dragnet_6blocks_10TagCountPB_tagcount));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 723, __pyx_L1_error)
  }

  /* "dragnet/blocks.pyx":724
 *         self._subtree_func.push_back(<subtree_t>TagCountPB.subtree_tagcount)
 *         self._name_func.push_back(<name_t>TagCountPB.tagcount)
 *         self._tag_func.push_back(<callback_t>TagCountPB.tag_tagcount)             # <<<<<<<<<<<<<<
 * 
 *         # will keep track of tag count and tag count since last block
 */
  try {
    __pyx_v_self->__pyx_base._tag_func.push_back(((__pyx_t_7dragnet_6blocks_callback_t)__pyx_f_7dragnet_6blocks_10TagCountPB_tag_tagcount));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 724, __pyx_L1_error)
  }

  /* "dragnet/blocks.pyx":727
 * 
 *         # will keep track of tag count and tag count since last block
 *         self._tc = 1  # for the top level HTML tag             # <<<<<<<<<<<<<<
 *         self._ac = 0  # anchor count
 *         self._tc_lb = 0
 */
  __pyx_v_self->_tc = 1;

  /* "dragnet/blocks.pyx":728
 *         # will keep track of tag count and tag count since last block
 *         self._tc = 1  # for the top level HTML tag
 *         self._ac = 0  # anchor count             # <<<<<<<<<<<<<<
 *         self._tc_lb = 0
 *         self._current_depth = 0
 */
  __pyx_v_self->_ac = 0;

  /* "dragnet/blocks.pyx":729
 *         self._tc = 1  # for the top level HTML tag
 *         self._ac = 0  # anchor count
 *         self._tc_lb = 0             # <<<<<<<<<<<<<<
 *         self._current_depth = 0
 *         self._min_depth_last_block = 0
 */
  __pyx_v_self->_tc_lb = 0;

  /* "dragnet/blocks.pyx":730
 *         self._ac = 0  # anchor count
 *         self._tc_lb = 0
 *         self._current_depth = 0             # <<<<<<<<<<<<<<
 *         self._min_depth_last_block = 0
 *         self._min_depth_last_block_pending = 0
 */
  __pyx_v_self->_current_depth = 0;

  /* "dragnet/blocks.pyx":731
 *         self._tc_lb = 0
 *         self._current_depth = 0
 *         self._min_depth_last_block = 0             # <<<<<<<<<<<<<<
 *         self._min_depth_last_block_pending = 0
 * 
 */
  __pyx_v_self->_min_depth_last_block = 0;

  /* "dragnet/blocks.pyx":732
 *         self._current_depth = 0
 *         self._min_depth_last_block = 0
 *         self._min_depth_last_block_pending = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef void reinit_tagcount(self):
 */
  __pyx_v_self->_min_depth_last_block_pending = 0;

  /* "dragnet/blocks.pyx":717
 *     cdef int _min_depth_last_block, _min_depth_last_block_pending
 * 
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         PartialBlock.__init__(self, *args, **kwargs)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("dragnet.blocks.TagCountPB.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "dragnet/blocks.pyx":734
 *         self._min_depth_last_block_pending = 0
 * 
 *     cdef void reinit_tagcount(self):             # <<<<<<<<<<<<<<
 *         pass
 * 
 */

static void __pyx_f_7dragnet_6blocks_10TagCountPB_reinit_tagcount(CYTHON_UNUSED struct __pyx_obj_7dragnet_6blocks_TagCountPB *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reinit_tagcount", 0);

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

/* "dragnet/blocks.pyx":737
 *         pass
 * 
 *     cdef void subtree_tagcount(self, int start_or_end):             # <<<<<<<<<<<<<<
 *         self._current_depth += start_or_end
 *         self._min_depth_last_block_pending = int_min(
 */

static void __pyx_f_7dragnet_6blocks_10TagCountPB_subtree_tagcount(struct __pyx_obj_7dragnet_6blocks_TagCountPB *__pyx_v_self, int __pyx_v_start_or_end) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("subtree_tagcount", 0);

  /* "dragnet/blocks.pyx":738
 * 
 *     cdef void subtree_tagcount(self, int start_or_end):
 *         self._current_depth += start_or_end             # <<<<<<<<<<<<<<
 *         self._min_depth_last_block_pending = int_min(
 *             self._min_depth_last_block_pending, self._current_depth)
 */
  __pyx_v_self->_current_depth = (__pyx_v_self->_current_depth + __pyx_v_start_or_end);

  /* "dragnet/blocks.pyx":739
 *     cdef void subtree_tagcount(self, int start_or_end):
 *         self._current_depth += start_or_end
 *         self._min_depth_last_block_pending = int_min(             # <<<<<<<<<<<<<<
 *             self._min_depth_last_block_pending, self._current_depth)
 * 
 */
  __pyx_v_self->_min_depth_last_block_pending = __pyx_f_7dragnet_6blocks_int_min(__pyx_v_self->_min_depth_last_block_pending, __pyx_v_self->_current_depth);

  /* "dragnet/blocks.pyx":737
 *         pass
 * 
 *     cdef void subtree_tagcount(self, int start_or_end):             # <<<<<<<<<<<<<<
 *         self._current_depth += start_or_end
 *         self._min_depth_last_block_pending = int_min(
 */

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

/* "dragnet/blocks.pyx":742
 *             self._min_depth_last_block_pending, self._current_depth)
 * 
 *     cdef cpp_map[string, int] tagcount(self, bool append):             # <<<<<<<<<<<<<<
 *         # here we assume that tc is updated
 *         # before features are extracted
 */

static std::map<std::string,int>  __pyx_f_7dragnet_6blocks_10TagCountPB_tagcount(struct __pyx_obj_7dragnet_6blocks_TagCountPB *__pyx_v_self, bool __pyx_v_append) {
  std::map<std::string,int>  __pyx_v_ret;
  std::map<std::string,int>  __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("tagcount", 0);

  /* "dragnet/blocks.pyx":750
 *         # since tc has already been updated
 *         cdef cpp_map[string, int] ret
 *         ret.clear()             # <<<<<<<<<<<<<<
 *         if append:
 *             ret[TAGCOUNT_SINCE_LAST_BLOCK] = self._tc_lb
 */
  __pyx_v_ret.clear();

  /* "dragnet/blocks.pyx":751
 *         cdef cpp_map[string, int] ret
 *         ret.clear()
 *         if append:             # <<<<<<<<<<<<<<
 *             ret[TAGCOUNT_SINCE_LAST_BLOCK] = self._tc_lb
 *             ret[TAGCOUNT] = self._tc - 1
 */
  __pyx_t_1 = (__pyx_v_append != 0);
  if (__pyx_t_1) {

    /* "dragnet/blocks.pyx":752
 *         ret.clear()
 *         if append:
 *             ret[TAGCOUNT_SINCE_LAST_BLOCK] = self._tc_lb             # <<<<<<<<<<<<<<
 *             ret[TAGCOUNT] = self._tc - 1
 *             ret[ANCHOR_COUNT] = self._ac
 */
    __pyx_t_2 = __pyx_v_self->_tc_lb;
    (__pyx_v_ret[__pyx_v_7dragnet_6blocks_TAGCOUNT_SINCE_LAST_BLOCK]) = __pyx_t_2;

    /* "dragnet/blocks.pyx":753
 *         if append:
 *             ret[TAGCOUNT_SINCE_LAST_BLOCK] = self._tc_lb
 *             ret[TAGCOUNT] = self._tc - 1             # <<<<<<<<<<<<<<
 *             ret[ANCHOR_COUNT] = self._ac
 *             ret[MIN_DEPTH_SINCE_LAST_BLOCK] = self._min_depth_last_block
 */
    (__pyx_v_ret[__pyx_v_7dragnet_6blocks_TAGCOUNT]) = (__pyx_v_self->_tc - 1);

    /* "dragnet/blocks.pyx":754
 *             ret[TAGCOUNT_SINCE_LAST_BLOCK] = self._tc_lb
 *             ret[TAGCOUNT] = self._tc - 1
 *             ret[ANCHOR_COUNT] = self._ac             # <<<<<<<<<<<<<<
 *             ret[MIN_DEPTH_SINCE_LAST_BLOCK] = self._min_depth_last_block
 *             self._tc_lb = 0
 */
    __pyx_t_2 = __pyx_v_self->_ac;
    (__pyx_v_ret[__pyx_v_7dragnet_6blocks_ANCHOR_COUNT]) = __pyx_t_2;

    /* "dragnet/blocks.pyx":755
 *             ret[TAGCOUNT] = self._tc - 1
 *             ret[ANCHOR_COUNT] = self._ac
 *             ret[MIN_DEPTH_SINCE_LAST_BLOCK] = self._min_depth_last_block             # <<<<<<<<<<<<<<
 *             self._tc_lb = 0
 *             self._tc = 1
 */
    __pyx_t_2 = __pyx_v_self->_min_depth_last_block;
    (__pyx_v_ret[__pyx_v_7dragnet_6blocks_MIN_DEPTH_SINCE_LAST_BLOCK]) = __pyx_t_2;

    /* "dragnet/blocks.pyx":756
 *             ret[ANCHOR_COUNT] = self._ac
 *             ret[MIN_DEPTH_SINCE_LAST_BLOCK] = self._min_depth_last_block
 *             self._tc_lb = 0             # <<<<<<<<<<<<<<
 *             self._tc = 1
 *             self._ac = 0
 */
    __pyx_v_self->_tc_lb = 0;

    /* "dragnet/blocks.pyx":757
 *             ret[MIN_DEPTH_SINCE_LAST_BLOCK] = self._min_depth_last_block
 *             self._tc_lb = 0
 *             self._tc = 1             # <<<<<<<<<<<<<<
 *             self._ac = 0
 *             self._min_depth_last_block_pending = self._current_depth
 */
    __pyx_v_self->_tc = 1;

    /* "dragnet/blocks.pyx":758
 *             self._tc_lb = 0
 *             self._tc = 1
 *             self._ac = 0             # <<<<<<<<<<<<<<
 *             self._min_depth_last_block_pending = self._current_depth
 *             self._min_depth_last_block = self._current_depth
 */
    __pyx_v_self->_ac = 0;

    /* "dragnet/blocks.pyx":759
 *             self._tc = 1
 *             self._ac = 0
 *             self._min_depth_last_block_pending = self._current_depth             # <<<<<<<<<<<<<<
 *             self._min_depth_last_block = self._current_depth
 *         else:
 */
    __pyx_t_2 = __pyx_v_self->_current_depth;
    __pyx_v_self->_min_depth_last_block_pending = __pyx_t_2;

    /* "dragnet/blocks.pyx":760
 *             self._ac = 0
 *             self._min_depth_last_block_pending = self._current_depth
 *             self._min_depth_last_block = self._current_depth             # <<<<<<<<<<<<<<
 *         else:
 *             self._tc_lb += (self._tc - 1)
 */
    __pyx_t_2 = __pyx_v_self->_current_depth;
    __pyx_v_self->_min_depth_last_block = __pyx_t_2;

    /* "dragnet/blocks.pyx":751
 *         cdef cpp_map[string, int] ret
 *         ret.clear()
 *         if append:             # <<<<<<<<<<<<<<
 *             ret[TAGCOUNT_SINCE_LAST_BLOCK] = self._tc_lb
 *             ret[TAGCOUNT] = self._tc - 1
 */
    goto __pyx_L3;
  }

  /* "dragnet/blocks.pyx":762
 *             self._min_depth_last_block = self._current_depth
 *         else:
 *             self._tc_lb += (self._tc - 1)             # <<<<<<<<<<<<<<
 *             self._tc = 1
 *             self._ac = 0
 */
  /*else*/ {
    __pyx_v_self->_tc_lb = (__pyx_v_self->_tc_lb + (__pyx_v_self->_tc - 1));

    /* "dragnet/blocks.pyx":763
 *         else:
 *             self._tc_lb += (self._tc - 1)
 *             self._tc = 1             # <<<<<<<<<<<<<<
 *             self._ac = 0
 *         return ret
 */
    __pyx_v_self->_tc = 1;

    /* "dragnet/blocks.pyx":764
 *             self._tc_lb += (self._tc - 1)
 *             self._tc = 1
 *             self._ac = 0             # <<<<<<<<<<<<<<
 *         return ret
 * 
 */
    __pyx_v_self->_ac = 0;
  }
  __pyx_L3:;

  /* "dragnet/blocks.pyx":765
 *             self._tc = 1
 *             self._ac = 0
 *         return ret             # <<<<<<<<<<<<<<
 * 
 *     cdef void tag_tagcount(self, string tag):
 */
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  /* "dragnet/blocks.pyx":742
 *             self._min_depth_last_block_pending, self._current_depth)
 * 
 *     cdef cpp_map[string, int] tagcount(self, bool append):             # <<<<<<<<<<<<<<
 *         # here we assume that tc is updated
 *         # before features are extracted
 */

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

/* "dragnet/blocks.pyx":767
 *         return ret
 * 
 *     cdef void tag_tagcount(self, string tag):             # <<<<<<<<<<<<<<
 *         self._tc += 1
 * 
 */

static void __pyx_f_7dragnet_6blocks_10TagCountPB_tag_tagcount(struct __pyx_obj_7dragnet_6blocks_TagCountPB *__pyx_v_self, std::string __pyx_v_tag) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("tag_tagcount", 0);

  /* "dragnet/blocks.pyx":768
 * 
 *     cdef void tag_tagcount(self, string tag):
 *         self._tc += 1             # <<<<<<<<<<<<<<
 * 
 *         if tag == A:
 */
  __pyx_v_self->_tc = (__pyx_v_self->_tc + 1);

  /* "dragnet/blocks.pyx":770
 *         self._tc += 1
 * 
 *         if tag == A:             # <<<<<<<<<<<<<<
 *             self._ac += 1
 * 
 */
  __pyx_t_1 = ((__pyx_v_tag == __pyx_v_7dragnet_6blocks_A) != 0);
  if (__pyx_t_1) {

    /* "dragnet/blocks.pyx":771
 * 
 *         if tag == A:
 *             self._ac += 1             # <<<<<<<<<<<<<<
 * 
 *         if BLOCKS.find(tag) == BLOCKS.end():
 */
    __pyx_v_self->_ac = (__pyx_v_self->_ac + 1);

    /* "dragnet/blocks.pyx":770
 *         self._tc += 1
 * 
 *         if tag == A:             # <<<<<<<<<<<<<<
 *             self._ac += 1
 * 
 */
  }

  /* "dragnet/blocks.pyx":773
 *             self._ac += 1
 * 
 *         if BLOCKS.find(tag) == BLOCKS.end():             # <<<<<<<<<<<<<<
 *             self._min_depth_last_block = self._min_depth_last_block_pending
 * 
 */
  __pyx_t_1 = ((__pyx_v_7dragnet_6blocks_BLOCKS.find(__pyx_v_tag) == __pyx_v_7dragnet_6blocks_BLOCKS.end()) != 0);
  if (__pyx_t_1) {

    /* "dragnet/blocks.pyx":774
 * 
 *         if BLOCKS.find(tag) == BLOCKS.end():
 *             self._min_depth_last_block = self._min_depth_last_block_pending             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_2 = __pyx_v_self->_min_depth_last_block_pending;
    __pyx_v_self->_min_depth_last_block = __pyx_t_2;

    /* "dragnet/blocks.pyx":773
 *             self._ac += 1
 * 
 *         if BLOCKS.find(tag) == BLOCKS.end():             # <<<<<<<<<<<<<<
 *             self._min_depth_last_block = self._min_depth_last_block_pending
 * 
 */
  }

  /* "dragnet/blocks.pyx":767
 *         return ret
 * 
 *     cdef void tag_tagcount(self, string tag):             # <<<<<<<<<<<<<<
 *         self._tc += 1
 * 
 */

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

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7dragnet_6blocks_10TagCountPB_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7dragnet_6blocks_10TagCountPB_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7dragnet_6blocks_10TagCountPB_2__reduce_cython__(((struct __pyx_obj_7dragnet_6blocks_TagCountPB *)__pyx_v_self));

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

static PyObject *__pyx_pf_7dragnet_6blocks_10TagCountPB_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7dragnet_6blocks_TagCountPB *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("dragnet.blocks.TagCountPB.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7dragnet_6blocks_10TagCountPB_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_7dragnet_6blocks_10TagCountPB_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7dragnet_6blocks_10TagCountPB_4__setstate_cython__(((struct __pyx_obj_7dragnet_6blocks_TagCountPB *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7dragnet_6blocks_10TagCountPB_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7dragnet_6blocks_TagCountPB *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("dragnet.blocks.TagCountPB.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "dragnet/blocks.pyx":777
 * 
 * 
 * def guess_encoding(markup, default='utf-8'):             # <<<<<<<<<<<<<<
 *     """
 *     Try to guess the encoding of ``markup`` by checking the XML declaration
 */

/* Python wrapper */
static PyObject *__pyx_pw_7dragnet_6blocks_5guess_encoding(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7dragnet_6blocks_4guess_encoding[] = "\n    Try to guess the encoding of ``markup`` by checking the XML declaration\n    and the HTML meta tag.\n\n    if default=CHARDET then use chardet to guess the default\n    ";
static PyMethodDef __pyx_mdef_7dragnet_6blocks_5guess_encoding = {"guess_encoding", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7dragnet_6blocks_5guess_encoding, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7dragnet_6blocks_4guess_encoding};
static PyObject *__pyx_pw_7dragnet_6blocks_5guess_encoding(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_markup = 0;
  PyObject *__pyx_v_default = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("guess_encoding (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_markup,&__pyx_n_s_default,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)__pyx_kp_s_utf_8);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_markup)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_default);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "guess_encoding") < 0)) __PYX_ERR(0, 777, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_markup = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("guess_encoding", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 777, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("dragnet.blocks.guess_encoding", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7dragnet_6blocks_4guess_encoding(__pyx_self, __pyx_v_markup, __pyx_v_default);

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

static PyObject *__pyx_pf_7dragnet_6blocks_4guess_encoding(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_markup, PyObject *__pyx_v_default) {
  long __pyx_v_xml_endpos;
  PyObject *__pyx_v_html_endpos = NULL;
  PyObject *__pyx_v_mo = NULL;
  PyObject *__pyx_v_moh = NULL;
  PyObject *__pyx_v_chardet = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  long __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("guess_encoding", 0);

  /* "dragnet/blocks.pyx":784
 *     if default=CHARDET then use chardet to guess the default
 *     """
 *     xml_endpos = 1024             # <<<<<<<<<<<<<<
 *     html_endpos = max(2048, int(len(markup) * 0.05))
 *     mo = RE_XML_ENCODING.search(markup, endpos=xml_endpos)
 */
  __pyx_v_xml_endpos = 0x400;

  /* "dragnet/blocks.pyx":785
 *     """
 *     xml_endpos = 1024
 *     html_endpos = max(2048, int(len(markup) * 0.05))             # <<<<<<<<<<<<<<
 *     mo = RE_XML_ENCODING.search(markup, endpos=xml_endpos)
 *     if mo:
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_markup); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 785, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_FromDouble((__pyx_t_1 * 0.05)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 785, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = 0x800;
  __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 785, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_5, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 785, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 785, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__pyx_t_7) {
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_4 = __pyx_t_2;
  } else {
    __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 785, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = __pyx_t_6;
    __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_t_4;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_html_endpos = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "dragnet/blocks.pyx":786
 *     xml_endpos = 1024
 *     html_endpos = max(2048, int(len(markup) * 0.05))
 *     mo = RE_XML_ENCODING.search(markup, endpos=xml_endpos)             # <<<<<<<<<<<<<<
 *     if mo:
 *         return mo.group(1)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_RE_XML_ENCODING); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 786, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_search); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 786, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 786, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_markup);
  __Pyx_GIVEREF(__pyx_v_markup);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_markup);
  __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 786, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_xml_endpos); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 786, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_endpos, __pyx_t_5) < 0) __PYX_ERR(0, 786, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 786, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_mo = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "dragnet/blocks.pyx":787
 *     html_endpos = max(2048, int(len(markup) * 0.05))
 *     mo = RE_XML_ENCODING.search(markup, endpos=xml_endpos)
 *     if mo:             # <<<<<<<<<<<<<<
 *         return mo.group(1)
 *     moh = RE_HTML_ENCODING.search(markup, endpos=html_endpos)
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_mo); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 787, __pyx_L1_error)
  if (__pyx_t_7) {

    /* "dragnet/blocks.pyx":788
 *     mo = RE_XML_ENCODING.search(markup, endpos=xml_endpos)
 *     if mo:
 *         return mo.group(1)             # <<<<<<<<<<<<<<
 *     moh = RE_HTML_ENCODING.search(markup, endpos=html_endpos)
 *     if moh:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_mo, __pyx_n_s_group); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 788, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_5 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_2, __pyx_int_1) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_int_1);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 788, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "dragnet/blocks.pyx":787
 *     html_endpos = max(2048, int(len(markup) * 0.05))
 *     mo = RE_XML_ENCODING.search(markup, endpos=xml_endpos)
 *     if mo:             # <<<<<<<<<<<<<<
 *         return mo.group(1)
 *     moh = RE_HTML_ENCODING.search(markup, endpos=html_endpos)
 */
  }

  /* "dragnet/blocks.pyx":789
 *     if mo:
 *         return mo.group(1)
 *     moh = RE_HTML_ENCODING.search(markup, endpos=html_endpos)             # <<<<<<<<<<<<<<
 *     if moh:
 *         return moh.group(1)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_RE_HTML_ENCODING); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 789, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_search); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 789, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 789, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_markup);
  __Pyx_GIVEREF(__pyx_v_markup);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_markup);
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 789, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_endpos, __pyx_v_html_endpos) < 0) __PYX_ERR(0, 789, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 789, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_moh = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "dragnet/blocks.pyx":790
 *         return mo.group(1)
 *     moh = RE_HTML_ENCODING.search(markup, endpos=html_endpos)
 *     if moh:             # <<<<<<<<<<<<<<
 *         return moh.group(1)
 *     if default.lower() == 'chardet':
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_moh); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 790, __pyx_L1_error)
  if (__pyx_t_7) {

    /* "dragnet/blocks.pyx":791
 *     moh = RE_HTML_ENCODING.search(markup, endpos=html_endpos)
 *     if moh:
 *         return moh.group(1)             # <<<<<<<<<<<<<<
 *     if default.lower() == 'chardet':
 *         import chardet
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_moh, __pyx_n_s_group); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 791, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_int_1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_int_1);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 791, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "dragnet/blocks.pyx":790
 *         return mo.group(1)
 *     moh = RE_HTML_ENCODING.search(markup, endpos=html_endpos)
 *     if moh:             # <<<<<<<<<<<<<<
 *         return moh.group(1)
 *     if default.lower() == 'chardet':
 */
  }

  /* "dragnet/blocks.pyx":792
 *     if moh:
 *         return moh.group(1)
 *     if default.lower() == 'chardet':             # <<<<<<<<<<<<<<
 *         import chardet
 *         return chardet.detect(markup)['encoding']
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_default, __pyx_n_s_lower); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 792, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 792, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = (__Pyx_PyString_Equals(__pyx_t_4, __pyx_n_s_chardet, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 792, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_7) {

    /* "dragnet/blocks.pyx":793
 *         return moh.group(1)
 *     if default.lower() == 'chardet':
 *         import chardet             # <<<<<<<<<<<<<<
 *         return chardet.detect(markup)['encoding']
 *     return default
 */
    __pyx_t_4 = __Pyx_Import(__pyx_n_s_chardet, 0, -1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 793, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_chardet = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "dragnet/blocks.pyx":794
 *     if default.lower() == 'chardet':
 *         import chardet
 *         return chardet.detect(markup)['encoding']             # <<<<<<<<<<<<<<
 *     return default
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_chardet, __pyx_n_s_detect); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 794, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_v_markup) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_markup);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 794, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_4, __pyx_n_s_encoding); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 794, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "dragnet/blocks.pyx":792
 *     if moh:
 *         return moh.group(1)
 *     if default.lower() == 'chardet':             # <<<<<<<<<<<<<<
 *         import chardet
 *         return chardet.detect(markup)['encoding']
 */
  }

  /* "dragnet/blocks.pyx":795
 *         import chardet
 *         return chardet.detect(markup)['encoding']
 *     return default             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_default);
  __pyx_r = __pyx_v_default;
  goto __pyx_L0;

  /* "dragnet/blocks.pyx":777
 * 
 * 
 * def guess_encoding(markup, default='utf-8'):             # <<<<<<<<<<<<<<
 *     """
 *     Try to guess the encoding of ``markup`` by checking the XML declaration
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("dragnet.blocks.guess_encoding", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_html_endpos);
  __Pyx_XDECREF(__pyx_v_mo);
  __Pyx_XDECREF(__pyx_v_moh);
  __Pyx_XDECREF(__pyx_v_chardet);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "dragnet/blocks.pyx":807
 * 
 *     @staticmethod
 *     def blocks_from_tree(tree, pb=PartialBlock, do_css=True, do_readability=False):             # <<<<<<<<<<<<<<
 *         cdef list results = []
 *         cdef cetree._Element ctree
 */

static PyObject *__pyx_pf_7dragnet_6blocks_6__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__defaults__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 807, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_pb);
  __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_pb);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_pb);
  __Pyx_INCREF(((PyObject *)Py_True));
  __Pyx_GIVEREF(((PyObject *)Py_True));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)Py_True));
  __Pyx_INCREF(((PyObject *)Py_False));
  __Pyx_GIVEREF(((PyObject *)Py_False));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)Py_False));
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 807, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
  __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_7dragnet_6blocks_10Blockifier_1blocks_from_tree(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7dragnet_6blocks_10Blockifier_1blocks_from_tree = {"blocks_from_tree", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7dragnet_6blocks_10Blockifier_1blocks_from_tree, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7dragnet_6blocks_10Blockifier_1blocks_from_tree(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tree = 0;
  PyObject *__pyx_v_pb = 0;
  PyObject *__pyx_v_do_css = 0;
  PyObject *__pyx_v_do_readability = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("blocks_from_tree (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tree,&__pyx_n_s_pb,&__pyx_n_s_do_css,&__pyx_n_s_do_readability,0};
    PyObject* values[4] = {0,0,0,0};
    __pyx_defaults *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self);
    values[1] = __pyx_dynamic_args->__pyx_arg_pb;
    values[2] = ((PyObject *)((PyObject *)Py_True));
    values[3] = ((PyObject *)((PyObject *)Py_False));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tree)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pb);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_do_css);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_do_readability);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "blocks_from_tree") < 0)) __PYX_ERR(0, 807, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_tree = values[0];
    __pyx_v_pb = values[1];
    __pyx_v_do_css = values[2];
    __pyx_v_do_readability = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("blocks_from_tree", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 807, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("dragnet.blocks.Blockifier.blocks_from_tree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7dragnet_6blocks_10Blockifier_blocks_from_tree(__pyx_self, __pyx_v_tree, __pyx_v_pb, __pyx_v_do_css, __pyx_v_do_readability);

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

static PyObject *__pyx_pf_7dragnet_6blocks_10Blockifier_blocks_from_tree(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tree, PyObject *__pyx_v_pb, PyObject *__pyx_v_do_css, PyObject *__pyx_v_do_readability) {
  PyObject *__pyx_v_results = 0;
  struct LxmlElement *__pyx_v_ctree = 0;
  struct __pyx_obj_7dragnet_6blocks_PartialBlock *__pyx_v_partial_block = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("blocks_from_tree", 0);

  /* "dragnet/blocks.pyx":808
 *     @staticmethod
 *     def blocks_from_tree(tree, pb=PartialBlock, do_css=True, do_readability=False):
 *         cdef list results = []             # <<<<<<<<<<<<<<
 *         cdef cetree._Element ctree
 * 
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 808, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_results = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "dragnet/blocks.pyx":811
 *         cdef cetree._Element ctree
 * 
 *         cdef PartialBlock partial_block = pb(do_css, do_readability)             # <<<<<<<<<<<<<<
 *         ctree = tree
 *         partial_block.recurse(ctree._c_node, results, ctree._doc)
 */
  __Pyx_INCREF(__pyx_v_pb);
  __pyx_t_2 = __pyx_v_pb; __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_do_css, __pyx_v_do_readability};
    __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, 811, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_do_css, __pyx_v_do_readability};
    __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, 811, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 811, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_do_css);
    __Pyx_GIVEREF(__pyx_v_do_css);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_do_css);
    __Pyx_INCREF(__pyx_v_do_readability);
    __Pyx_GIVEREF(__pyx_v_do_readability);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_do_readability);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 811, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7dragnet_6blocks_PartialBlock))))) __PYX_ERR(0, 811, __pyx_L1_error)
  __pyx_v_partial_block = ((struct __pyx_obj_7dragnet_6blocks_PartialBlock *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "dragnet/blocks.pyx":812
 * 
 *         cdef PartialBlock partial_block = pb(do_css, do_readability)
 *         ctree = tree             # <<<<<<<<<<<<<<
 *         partial_block.recurse(ctree._c_node, results, ctree._doc)
 * 
 */
  if (!(likely(((__pyx_v_tree) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_tree, __pyx_ptype_4lxml_8includes_11etreepublic__Element))))) __PYX_ERR(0, 812, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_tree;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_ctree = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "dragnet/blocks.pyx":813
 *         cdef PartialBlock partial_block = pb(do_css, do_readability)
 *         ctree = tree
 *         partial_block.recurse(ctree._c_node, results, ctree._doc)             # <<<<<<<<<<<<<<
 * 
 *         # make the final block
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_ctree->_doc);
  __Pyx_INCREF(__pyx_t_1);
  ((struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock *)__pyx_v_partial_block->__pyx_vtab)->recurse(__pyx_v_partial_block, __pyx_v_ctree->_c_node, __pyx_v_results, ((struct LxmlDocument *)__pyx_t_1));
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "dragnet/blocks.pyx":816
 * 
 *         # make the final block
 *         partial_block.add_block_to_results(results)             # <<<<<<<<<<<<<<
 * 
 *         return results
 */
  ((struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock *)__pyx_v_partial_block->__pyx_vtab)->add_block_to_results(__pyx_v_partial_block, __pyx_v_results);

  /* "dragnet/blocks.pyx":818
 *         partial_block.add_block_to_results(results)
 * 
 *         return results             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_results);
  __pyx_r = __pyx_v_results;
  goto __pyx_L0;

  /* "dragnet/blocks.pyx":807
 * 
 *     @staticmethod
 *     def blocks_from_tree(tree, pb=PartialBlock, do_css=True, do_readability=False):             # <<<<<<<<<<<<<<
 *         cdef list results = []
 *         cdef cetree._Element ctree
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("dragnet.blocks.Blockifier.blocks_from_tree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_results);
  __Pyx_XDECREF((PyObject *)__pyx_v_ctree);
  __Pyx_XDECREF((PyObject *)__pyx_v_partial_block);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "dragnet/blocks.pyx":821
 * 
 *     @staticmethod
 *     def blockify(s, encoding=None,             # <<<<<<<<<<<<<<
 *                  pb=PartialBlock, do_css=True, do_readability=False,
 *                  parse_callback=None):
 */

static PyObject *__pyx_pf_7dragnet_6blocks_8__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__defaults__", 0);
  __Pyx_XDECREF(__pyx_r);

  /* "dragnet/blocks.pyx":823
 *     def blockify(s, encoding=None,
 *                  pb=PartialBlock, do_css=True, do_readability=False,
 *                  parse_callback=None):             # <<<<<<<<<<<<<<
 *         """
 *         Given HTML string ``s`` return a sequence of blocks with text content.
 */
  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)Py_None));
  __Pyx_GIVEREF(((PyObject *)Py_None));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_None));
  __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_pb);
  __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_pb);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_pb);
  __Pyx_INCREF(((PyObject *)Py_True));
  __Pyx_GIVEREF(((PyObject *)Py_True));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)Py_True));
  __Pyx_INCREF(((PyObject *)Py_False));
  __Pyx_GIVEREF(((PyObject *)Py_False));
  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)Py_False));
  __Pyx_INCREF(((PyObject *)Py_None));
  __Pyx_GIVEREF(((PyObject *)Py_None));
  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)Py_None));

  /* "dragnet/blocks.pyx":821
 * 
 *     @staticmethod
 *     def blockify(s, encoding=None,             # <<<<<<<<<<<<<<
 *                  pb=PartialBlock, do_css=True, do_readability=False,
 *                  parse_callback=None):
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
  __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_7dragnet_6blocks_10Blockifier_3blockify(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7dragnet_6blocks_10Blockifier_2blockify[] = "\n        Given HTML string ``s`` return a sequence of blocks with text content.\n\n        Args:\n            s (str): HTML document as a string\n            encoding (str): encoding of ``s``; if None (encoding unknown), the\n                original encoding will be guessed from the HTML itself\n            pb\n            do_css (bool): if True, add CSS-related attributes to blocks\n            do_readability (bool): if True, add readability-related attributes\n                to blocks\n            parse_callback (Callable): if not None, will be called on the\n                result of parsing in order to modify state for [reasons]\n\n        Returns:\n            List[Block]: ordered sequence of blocks with text content\n        ";
static PyMethodDef __pyx_mdef_7dragnet_6blocks_10Blockifier_3blockify = {"blockify", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7dragnet_6blocks_10Blockifier_3blockify, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7dragnet_6blocks_10Blockifier_2blockify};
static PyObject *__pyx_pw_7dragnet_6blocks_10Blockifier_3blockify(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_v_encoding = 0;
  PyObject *__pyx_v_pb = 0;
  PyObject *__pyx_v_do_css = 0;
  PyObject *__pyx_v_do_readability = 0;
  PyObject *__pyx_v_parse_callback = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("blockify (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s,&__pyx_n_s_encoding,&__pyx_n_s_pb,&__pyx_n_s_do_css,&__pyx_n_s_do_readability,&__pyx_n_s_parse_callback,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    __pyx_defaults1 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self);
    values[1] = ((PyObject *)((PyObject *)Py_None));
    values[2] = __pyx_dynamic_args->__pyx_arg_pb;
    values[3] = ((PyObject *)((PyObject *)Py_True));
    values[4] = ((PyObject *)((PyObject *)Py_False));
    values[5] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_s)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_encoding);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pb);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_do_css);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_do_readability);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_parse_callback);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "blockify") < 0)) __PYX_ERR(0, 821, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_s = values[0];
    __pyx_v_encoding = values[1];
    __pyx_v_pb = values[2];
    __pyx_v_do_css = values[3];
    __pyx_v_do_readability = values[4];
    __pyx_v_parse_callback = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("blockify", 0, 1, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 821, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("dragnet.blocks.Blockifier.blockify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7dragnet_6blocks_10Blockifier_2blockify(__pyx_self, __pyx_v_s, __pyx_v_encoding, __pyx_v_pb, __pyx_v_do_css, __pyx_v_do_readability, __pyx_v_parse_callback);

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

static PyObject *__pyx_pf_7dragnet_6blocks_10Blockifier_2blockify(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s, PyObject *__pyx_v_encoding, PyObject *__pyx_v_pb, PyObject *__pyx_v_do_css, PyObject *__pyx_v_do_readability, PyObject *__pyx_v_parse_callback) {
  PyObject *__pyx_v_html = NULL;
  PyObject *__pyx_v_blocks = NULL;
  PyObject *__pyx_v_ele = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  PyObject *(*__pyx_t_13)(PyObject *);
  PyObject *__pyx_t_14 = NULL;
  __Pyx_RefNannySetupContext("blockify", 0);
  __Pyx_INCREF(__pyx_v_s);
  __Pyx_INCREF(__pyx_v_encoding);

  /* "dragnet/blocks.pyx":842
 *         """
 *         # First, we need to parse the thing
 *         s = bytes_cast(s) # ensure we're working w/ bytes             # <<<<<<<<<<<<<<
 *         encoding = encoding or guess_encoding(s, default='utf-8')
 *         try:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_bytes_cast); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 842, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_s) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_s);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 842, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "dragnet/blocks.pyx":843
 *         # First, we need to parse the thing
 *         s = bytes_cast(s) # ensure we're working w/ bytes
 *         encoding = encoding or guess_encoding(s, default='utf-8')             # <<<<<<<<<<<<<<
 *         try:
 *             html = etree.fromstring(s,
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_encoding); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 843, __pyx_L1_error)
  if (!__pyx_t_4) {
  } else {
    __Pyx_INCREF(__pyx_v_encoding);
    __pyx_t_1 = __pyx_v_encoding;
    goto __pyx_L3_bool_binop_done;
  }
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_guess_encoding); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_s);
  __Pyx_GIVEREF(__pyx_v_s);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_s);
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_default, __pyx_kp_s_utf_8) < 0) __PYX_ERR(0, 843, __pyx_L1_error)
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_INCREF(__pyx_t_6);
  __pyx_t_1 = __pyx_t_6;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_L3_bool_binop_done:;
  __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "dragnet/blocks.pyx":844
 *         s = bytes_cast(s) # ensure we're working w/ bytes
 *         encoding = encoding or guess_encoding(s, default='utf-8')
 *         try:             # <<<<<<<<<<<<<<
 *             html = etree.fromstring(s,
 *                 etree.HTMLParser(recover=True, encoding=encoding,
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_9);
    /*try:*/ {

      /* "dragnet/blocks.pyx":845
 *         encoding = encoding or guess_encoding(s, default='utf-8')
 *         try:
 *             html = etree.fromstring(s,             # <<<<<<<<<<<<<<
 *                 etree.HTMLParser(recover=True, encoding=encoding,
 *                 remove_comments=True, remove_pis=True))
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_7dragnet_6blocks_etree, __pyx_n_s_fromstring); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 845, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_6);

      /* "dragnet/blocks.pyx":846
 *         try:
 *             html = etree.fromstring(s,
 *                 etree.HTMLParser(recover=True, encoding=encoding,             # <<<<<<<<<<<<<<
 *                 remove_comments=True, remove_pis=True))
 *         except:
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_7dragnet_6blocks_etree, __pyx_n_s_HTMLParser); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 846, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 846, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_recover, Py_True) < 0) __PYX_ERR(0, 846, __pyx_L5_error)
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_encoding, __pyx_v_encoding) < 0) __PYX_ERR(0, 846, __pyx_L5_error)

      /* "dragnet/blocks.pyx":847
 *             html = etree.fromstring(s,
 *                 etree.HTMLParser(recover=True, encoding=encoding,
 *                 remove_comments=True, remove_pis=True))             # <<<<<<<<<<<<<<
 *         except:
 *             raise BlockifyError, 'Could not blockify HTML'
 */
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_remove_comments, Py_True) < 0) __PYX_ERR(0, 846, __pyx_L5_error)
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_remove_pis, Py_True) < 0) __PYX_ERR(0, 846, __pyx_L5_error)

      /* "dragnet/blocks.pyx":846
 *         try:
 *             html = etree.fromstring(s,
 *                 etree.HTMLParser(recover=True, encoding=encoding,             # <<<<<<<<<<<<<<
 *                 remove_comments=True, remove_pis=True))
 *         except:
 */
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 846, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      __pyx_t_10 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
          __pyx_t_10 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_s, __pyx_t_2};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 845, __pyx_L5_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_s, __pyx_t_2};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 845, __pyx_L5_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else
      #endif
      {
        __pyx_t_5 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 845, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_5);
        if (__pyx_t_3) {
          __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
        }
        __Pyx_INCREF(__pyx_v_s);
        __Pyx_GIVEREF(__pyx_v_s);
        PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_10, __pyx_v_s);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_10, __pyx_t_2);
        __pyx_t_2 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 845, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_v_html = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "dragnet/blocks.pyx":844
 *         s = bytes_cast(s) # ensure we're working w/ bytes
 *         encoding = encoding or guess_encoding(s, default='utf-8')
 *         try:             # <<<<<<<<<<<<<<
 *             html = etree.fromstring(s,
 *                 etree.HTMLParser(recover=True, encoding=encoding,
 */
    }
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L10_try_end;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "dragnet/blocks.pyx":848
 *                 etree.HTMLParser(recover=True, encoding=encoding,
 *                 remove_comments=True, remove_pis=True))
 *         except:             # <<<<<<<<<<<<<<
 *             raise BlockifyError, 'Could not blockify HTML'
 *         if html is None:
 */
    /*except:*/ {
      __Pyx_AddTraceback("dragnet.blocks.Blockifier.blockify", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_6, &__pyx_t_5) < 0) __PYX_ERR(0, 848, __pyx_L7_except_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_5);

      /* "dragnet/blocks.pyx":849
 *                 remove_comments=True, remove_pis=True))
 *         except:
 *             raise BlockifyError, 'Could not blockify HTML'             # <<<<<<<<<<<<<<
 *         if html is None:
 *             # lxml sometimes doesn't raise an error but returns None
 */
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_BlockifyError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 849, __pyx_L7_except_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_Raise(__pyx_t_2, __pyx_kp_s_Could_not_blockify_HTML, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(0, 849, __pyx_L7_except_error)
    }
    __pyx_L7_except_error:;

    /* "dragnet/blocks.pyx":844
 *         s = bytes_cast(s) # ensure we're working w/ bytes
 *         encoding = encoding or guess_encoding(s, default='utf-8')
 *         try:             # <<<<<<<<<<<<<<
 *             html = etree.fromstring(s,
 *                 etree.HTMLParser(recover=True, encoding=encoding,
 */
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
    goto __pyx_L1_error;
    __pyx_L10_try_end:;
  }

  /* "dragnet/blocks.pyx":850
 *         except:
 *             raise BlockifyError, 'Could not blockify HTML'
 *         if html is None:             # <<<<<<<<<<<<<<
 *             # lxml sometimes doesn't raise an error but returns None
 *             raise BlockifyError, 'Could not blockify HTML'
 */
  __pyx_t_4 = (__pyx_v_html == Py_None);
  __pyx_t_11 = (__pyx_t_4 != 0);
  if (unlikely(__pyx_t_11)) {

    /* "dragnet/blocks.pyx":852
 *         if html is None:
 *             # lxml sometimes doesn't raise an error but returns None
 *             raise BlockifyError, 'Could not blockify HTML'             # <<<<<<<<<<<<<<
 * 
 *         blocks = Blockifier.blocks_from_tree(html, pb, do_css, do_readability)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_BlockifyError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 852, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_Raise(__pyx_t_5, __pyx_kp_s_Could_not_blockify_HTML, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(0, 852, __pyx_L1_error)

    /* "dragnet/blocks.pyx":850
 *         except:
 *             raise BlockifyError, 'Could not blockify HTML'
 *         if html is None:             # <<<<<<<<<<<<<<
 *             # lxml sometimes doesn't raise an error but returns None
 *             raise BlockifyError, 'Could not blockify HTML'
 */
  }

  /* "dragnet/blocks.pyx":854
 *             raise BlockifyError, 'Could not blockify HTML'
 * 
 *         blocks = Blockifier.blocks_from_tree(html, pb, do_css, do_readability)             # <<<<<<<<<<<<<<
 * 
 *         if parse_callback is not None:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Blockifier); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 854, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_blocks_from_tree); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 854, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_10 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[5] = {__pyx_t_6, __pyx_v_html, __pyx_v_pb, __pyx_v_do_css, __pyx_v_do_readability};
    __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 4+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 854, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_5);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[5] = {__pyx_t_6, __pyx_v_html, __pyx_v_pb, __pyx_v_do_css, __pyx_v_do_readability};
    __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 4+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 854, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_5);
  } else
  #endif
  {
    __pyx_t_2 = PyTuple_New(4+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 854, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_INCREF(__pyx_v_html);
    __Pyx_GIVEREF(__pyx_v_html);
    PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_10, __pyx_v_html);
    __Pyx_INCREF(__pyx_v_pb);
    __Pyx_GIVEREF(__pyx_v_pb);
    PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_10, __pyx_v_pb);
    __Pyx_INCREF(__pyx_v_do_css);
    __Pyx_GIVEREF(__pyx_v_do_css);
    PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_10, __pyx_v_do_css);
    __Pyx_INCREF(__pyx_v_do_readability);
    __Pyx_GIVEREF(__pyx_v_do_readability);
    PyTuple_SET_ITEM(__pyx_t_2, 3+__pyx_t_10, __pyx_v_do_readability);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 854, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_blocks = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "dragnet/blocks.pyx":856
 *         blocks = Blockifier.blocks_from_tree(html, pb, do_css, do_readability)
 * 
 *         if parse_callback is not None:             # <<<<<<<<<<<<<<
 *             parse_callback(html)
 * 
 */
  __pyx_t_11 = (__pyx_v_parse_callback != Py_None);
  __pyx_t_4 = (__pyx_t_11 != 0);
  if (__pyx_t_4) {

    /* "dragnet/blocks.pyx":857
 * 
 *         if parse_callback is not None:
 *             parse_callback(html)             # <<<<<<<<<<<<<<
 * 
 *         # only return blocks with some text content
 */
    __Pyx_INCREF(__pyx_v_parse_callback);
    __pyx_t_1 = __pyx_v_parse_callback; __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_5 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_v_html) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_html);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 857, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "dragnet/blocks.pyx":856
 *         blocks = Blockifier.blocks_from_tree(html, pb, do_css, do_readability)
 * 
 *         if parse_callback is not None:             # <<<<<<<<<<<<<<
 *             parse_callback(html)
 * 
 */
  }

  /* "dragnet/blocks.pyx":860
 * 
 *         # only return blocks with some text content
 *         return [ele for ele in str_block_list_cast(blocks) if RE_TEXT.search(ele.text)]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 860, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_str_block_list_cast); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 860, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_6, __pyx_v_blocks) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_blocks);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 860, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_12 = 0;
    __pyx_t_13 = NULL;
  } else {
    __pyx_t_12 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 860, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_13 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 860, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_13)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_12); __Pyx_INCREF(__pyx_t_1); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 860, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 860, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_12); __Pyx_INCREF(__pyx_t_1); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 860, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 860, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_13(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 860, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_ele, __pyx_t_1);
    __pyx_t_1 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_RE_TEXT); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 860, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_search); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 860, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_ele, __pyx_n_s_text); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 860, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_14 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_14)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_14);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_1 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_14, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 860, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 860, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_4) {
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_v_ele))) __PYX_ERR(0, 860, __pyx_L1_error)
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "dragnet/blocks.pyx":821
 * 
 *     @staticmethod
 *     def blockify(s, encoding=None,             # <<<<<<<<<<<<<<
 *                  pb=PartialBlock, do_css=True, do_readability=False,
 *                  parse_callback=None):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("dragnet.blocks.Blockifier.blockify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_html);
  __Pyx_XDECREF(__pyx_v_blocks);
  __Pyx_XDECREF(__pyx_v_ele);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_encoding);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "dragnet/blocks.pyx":865
 * class TagCountBlockifier(Blockifier):
 *     @staticmethod
 *     def blockify(s, encoding=None, parse_callback=None):             # <<<<<<<<<<<<<<
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,
 *                                    do_css=True, do_readability=False,
 */

/* Python wrapper */
static PyObject *__pyx_pw_7dragnet_6blocks_18TagCountBlockifier_1blockify(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7dragnet_6blocks_18TagCountBlockifier_1blockify = {"blockify", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7dragnet_6blocks_18TagCountBlockifier_1blockify, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7dragnet_6blocks_18TagCountBlockifier_1blockify(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_v_encoding = 0;
  PyObject *__pyx_v_parse_callback = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("blockify (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s,&__pyx_n_s_encoding,&__pyx_n_s_parse_callback,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)((PyObject *)Py_None));
    values[2] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_s)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_encoding);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_parse_callback);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "blockify") < 0)) __PYX_ERR(0, 865, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_s = values[0];
    __pyx_v_encoding = values[1];
    __pyx_v_parse_callback = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("blockify", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 865, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("dragnet.blocks.TagCountBlockifier.blockify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7dragnet_6blocks_18TagCountBlockifier_blockify(__pyx_self, __pyx_v_s, __pyx_v_encoding, __pyx_v_parse_callback);

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

static PyObject *__pyx_pf_7dragnet_6blocks_18TagCountBlockifier_blockify(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s, PyObject *__pyx_v_encoding, PyObject *__pyx_v_parse_callback) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("blockify", 0);

  /* "dragnet/blocks.pyx":866
 *     @staticmethod
 *     def blockify(s, encoding=None, parse_callback=None):
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,             # <<<<<<<<<<<<<<
 *                                    do_css=True, do_readability=False,
 *                                    parse_callback=parse_callback)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Blockifier); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 866, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_blockify); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 866, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 866, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_s);
  __Pyx_GIVEREF(__pyx_v_s);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_s);
  __pyx_t_3 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 866, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_encoding, __pyx_v_encoding) < 0) __PYX_ERR(0, 866, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_pb, ((PyObject *)__pyx_ptype_7dragnet_6blocks_TagCountPB)) < 0) __PYX_ERR(0, 866, __pyx_L1_error)

  /* "dragnet/blocks.pyx":867
 *     def blockify(s, encoding=None, parse_callback=None):
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,
 *                                    do_css=True, do_readability=False,             # <<<<<<<<<<<<<<
 *                                    parse_callback=parse_callback)
 * 
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_do_css, Py_True) < 0) __PYX_ERR(0, 866, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_do_readability, Py_False) < 0) __PYX_ERR(0, 866, __pyx_L1_error)

  /* "dragnet/blocks.pyx":868
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,
 *                                    do_css=True, do_readability=False,
 *                                    parse_callback=parse_callback)             # <<<<<<<<<<<<<<
 * 
 * class TagCountNoCSSBlockifier(Blockifier):
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_parse_callback, __pyx_v_parse_callback) < 0) __PYX_ERR(0, 866, __pyx_L1_error)

  /* "dragnet/blocks.pyx":866
 *     @staticmethod
 *     def blockify(s, encoding=None, parse_callback=None):
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,             # <<<<<<<<<<<<<<
 *                                    do_css=True, do_readability=False,
 *                                    parse_callback=parse_callback)
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 866, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "dragnet/blocks.pyx":865
 * class TagCountBlockifier(Blockifier):
 *     @staticmethod
 *     def blockify(s, encoding=None, parse_callback=None):             # <<<<<<<<<<<<<<
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,
 *                                    do_css=True, do_readability=False,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("dragnet.blocks.TagCountBlockifier.blockify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "dragnet/blocks.pyx":872
 * class TagCountNoCSSBlockifier(Blockifier):
 *     @staticmethod
 *     def blockify(s, encoding=None, parse_callback=None):             # <<<<<<<<<<<<<<
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,
 *                                    do_css=False, do_readability=False,
 */

/* Python wrapper */
static PyObject *__pyx_pw_7dragnet_6blocks_23TagCountNoCSSBlockifier_1blockify(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7dragnet_6blocks_23TagCountNoCSSBlockifier_1blockify = {"blockify", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7dragnet_6blocks_23TagCountNoCSSBlockifier_1blockify, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7dragnet_6blocks_23TagCountNoCSSBlockifier_1blockify(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_v_encoding = 0;
  PyObject *__pyx_v_parse_callback = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("blockify (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s,&__pyx_n_s_encoding,&__pyx_n_s_parse_callback,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)((PyObject *)Py_None));
    values[2] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_s)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_encoding);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_parse_callback);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "blockify") < 0)) __PYX_ERR(0, 872, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_s = values[0];
    __pyx_v_encoding = values[1];
    __pyx_v_parse_callback = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("blockify", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 872, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("dragnet.blocks.TagCountNoCSSBlockifier.blockify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7dragnet_6blocks_23TagCountNoCSSBlockifier_blockify(__pyx_self, __pyx_v_s, __pyx_v_encoding, __pyx_v_parse_callback);

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

static PyObject *__pyx_pf_7dragnet_6blocks_23TagCountNoCSSBlockifier_blockify(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s, PyObject *__pyx_v_encoding, PyObject *__pyx_v_parse_callback) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("blockify", 0);

  /* "dragnet/blocks.pyx":873
 *     @staticmethod
 *     def blockify(s, encoding=None, parse_callback=None):
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,             # <<<<<<<<<<<<<<
 *                                    do_css=False, do_readability=False,
 *                                    parse_callback=parse_callback)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Blockifier); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 873, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_blockify); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 873, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 873, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_s);
  __Pyx_GIVEREF(__pyx_v_s);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_s);
  __pyx_t_3 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 873, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_encoding, __pyx_v_encoding) < 0) __PYX_ERR(0, 873, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_pb, ((PyObject *)__pyx_ptype_7dragnet_6blocks_TagCountPB)) < 0) __PYX_ERR(0, 873, __pyx_L1_error)

  /* "dragnet/blocks.pyx":874
 *     def blockify(s, encoding=None, parse_callback=None):
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,
 *                                    do_css=False, do_readability=False,             # <<<<<<<<<<<<<<
 *                                    parse_callback=parse_callback)
 * 
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_do_css, Py_False) < 0) __PYX_ERR(0, 873, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_do_readability, Py_False) < 0) __PYX_ERR(0, 873, __pyx_L1_error)

  /* "dragnet/blocks.pyx":875
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,
 *                                    do_css=False, do_readability=False,
 *                                    parse_callback=parse_callback)             # <<<<<<<<<<<<<<
 * 
 * class TagCountReadabilityBlockifier(Blockifier):
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_parse_callback, __pyx_v_parse_callback) < 0) __PYX_ERR(0, 873, __pyx_L1_error)

  /* "dragnet/blocks.pyx":873
 *     @staticmethod
 *     def blockify(s, encoding=None, parse_callback=None):
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,             # <<<<<<<<<<<<<<
 *                                    do_css=False, do_readability=False,
 *                                    parse_callback=parse_callback)
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 873, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "dragnet/blocks.pyx":872
 * class TagCountNoCSSBlockifier(Blockifier):
 *     @staticmethod
 *     def blockify(s, encoding=None, parse_callback=None):             # <<<<<<<<<<<<<<
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,
 *                                    do_css=False, do_readability=False,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("dragnet.blocks.TagCountNoCSSBlockifier.blockify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "dragnet/blocks.pyx":879
 * class TagCountReadabilityBlockifier(Blockifier):
 *     @staticmethod
 *     def blockify(s, encoding=None, parse_callback=None):             # <<<<<<<<<<<<<<
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,
 *                                    do_css=True, do_readability=True,
 */

/* Python wrapper */
static PyObject *__pyx_pw_7dragnet_6blocks_29TagCountReadabilityBlockifier_1blockify(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7dragnet_6blocks_29TagCountReadabilityBlockifier_1blockify = {"blockify", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7dragnet_6blocks_29TagCountReadabilityBlockifier_1blockify, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7dragnet_6blocks_29TagCountReadabilityBlockifier_1blockify(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_v_encoding = 0;
  PyObject *__pyx_v_parse_callback = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("blockify (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s,&__pyx_n_s_encoding,&__pyx_n_s_parse_callback,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)((PyObject *)Py_None));
    values[2] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_s)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_encoding);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_parse_callback);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "blockify") < 0)) __PYX_ERR(0, 879, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_s = values[0];
    __pyx_v_encoding = values[1];
    __pyx_v_parse_callback = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("blockify", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 879, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("dragnet.blocks.TagCountReadabilityBlockifier.blockify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7dragnet_6blocks_29TagCountReadabilityBlockifier_blockify(__pyx_self, __pyx_v_s, __pyx_v_encoding, __pyx_v_parse_callback);

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

static PyObject *__pyx_pf_7dragnet_6blocks_29TagCountReadabilityBlockifier_blockify(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s, PyObject *__pyx_v_encoding, PyObject *__pyx_v_parse_callback) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("blockify", 0);

  /* "dragnet/blocks.pyx":880
 *     @staticmethod
 *     def blockify(s, encoding=None, parse_callback=None):
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,             # <<<<<<<<<<<<<<
 *                                    do_css=True, do_readability=True,
 *                                    parse_callback=parse_callback)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Blockifier); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 880, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_blockify); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 880, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 880, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_s);
  __Pyx_GIVEREF(__pyx_v_s);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_s);
  __pyx_t_3 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 880, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_encoding, __pyx_v_encoding) < 0) __PYX_ERR(0, 880, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_pb, ((PyObject *)__pyx_ptype_7dragnet_6blocks_TagCountPB)) < 0) __PYX_ERR(0, 880, __pyx_L1_error)

  /* "dragnet/blocks.pyx":881
 *     def blockify(s, encoding=None, parse_callback=None):
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,
 *                                    do_css=True, do_readability=True,             # <<<<<<<<<<<<<<
 *                                    parse_callback=parse_callback)
 * 
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_do_css, Py_True) < 0) __PYX_ERR(0, 880, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_do_readability, Py_True) < 0) __PYX_ERR(0, 880, __pyx_L1_error)

  /* "dragnet/blocks.pyx":882
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,
 *                                    do_css=True, do_readability=True,
 *                                    parse_callback=parse_callback)             # <<<<<<<<<<<<<<
 * 
 * class TagCountNoCSSReadabilityBlockifier(Blockifier):
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_parse_callback, __pyx_v_parse_callback) < 0) __PYX_ERR(0, 880, __pyx_L1_error)

  /* "dragnet/blocks.pyx":880
 *     @staticmethod
 *     def blockify(s, encoding=None, parse_callback=None):
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,             # <<<<<<<<<<<<<<
 *                                    do_css=True, do_readability=True,
 *                                    parse_callback=parse_callback)
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 880, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "dragnet/blocks.pyx":879
 * class TagCountReadabilityBlockifier(Blockifier):
 *     @staticmethod
 *     def blockify(s, encoding=None, parse_callback=None):             # <<<<<<<<<<<<<<
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,
 *                                    do_css=True, do_readability=True,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("dragnet.blocks.TagCountReadabilityBlockifier.blockify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "dragnet/blocks.pyx":886
 * class TagCountNoCSSReadabilityBlockifier(Blockifier):
 *     @staticmethod
 *     def blockify(s, encoding=None, parse_callback=None):             # <<<<<<<<<<<<<<
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,
 *                                    do_css=False, do_readability=True,
 */

/* Python wrapper */
static PyObject *__pyx_pw_7dragnet_6blocks_34TagCountNoCSSReadabilityBlockifier_1blockify(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7dragnet_6blocks_34TagCountNoCSSReadabilityBlockifier_1blockify = {"blockify", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7dragnet_6blocks_34TagCountNoCSSReadabilityBlockifier_1blockify, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7dragnet_6blocks_34TagCountNoCSSReadabilityBlockifier_1blockify(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_v_encoding = 0;
  PyObject *__pyx_v_parse_callback = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("blockify (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s,&__pyx_n_s_encoding,&__pyx_n_s_parse_callback,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)((PyObject *)Py_None));
    values[2] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_s)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_encoding);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_parse_callback);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "blockify") < 0)) __PYX_ERR(0, 886, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_s = values[0];
    __pyx_v_encoding = values[1];
    __pyx_v_parse_callback = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("blockify", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 886, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("dragnet.blocks.TagCountNoCSSReadabilityBlockifier.blockify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7dragnet_6blocks_34TagCountNoCSSReadabilityBlockifier_blockify(__pyx_self, __pyx_v_s, __pyx_v_encoding, __pyx_v_parse_callback);

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

static PyObject *__pyx_pf_7dragnet_6blocks_34TagCountNoCSSReadabilityBlockifier_blockify(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s, PyObject *__pyx_v_encoding, PyObject *__pyx_v_parse_callback) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("blockify", 0);

  /* "dragnet/blocks.pyx":887
 *     @staticmethod
 *     def blockify(s, encoding=None, parse_callback=None):
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,             # <<<<<<<<<<<<<<
 *                                    do_css=False, do_readability=True,
 *                                    parse_callback=parse_callback)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Blockifier); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_blockify); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_s);
  __Pyx_GIVEREF(__pyx_v_s);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_s);
  __pyx_t_3 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_encoding, __pyx_v_encoding) < 0) __PYX_ERR(0, 887, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_pb, ((PyObject *)__pyx_ptype_7dragnet_6blocks_TagCountPB)) < 0) __PYX_ERR(0, 887, __pyx_L1_error)

  /* "dragnet/blocks.pyx":888
 *     def blockify(s, encoding=None, parse_callback=None):
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,
 *                                    do_css=False, do_readability=True,             # <<<<<<<<<<<<<<
 *                                    parse_callback=parse_callback)
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_do_css, Py_False) < 0) __PYX_ERR(0, 887, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_do_readability, Py_True) < 0) __PYX_ERR(0, 887, __pyx_L1_error)

  /* "dragnet/blocks.pyx":889
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,
 *                                    do_css=False, do_readability=True,
 *                                    parse_callback=parse_callback)             # <<<<<<<<<<<<<<
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_parse_callback, __pyx_v_parse_callback) < 0) __PYX_ERR(0, 887, __pyx_L1_error)

  /* "dragnet/blocks.pyx":887
 *     @staticmethod
 *     def blockify(s, encoding=None, parse_callback=None):
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,             # <<<<<<<<<<<<<<
 *                                    do_css=False, do_readability=True,
 *                                    parse_callback=parse_callback)
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "dragnet/blocks.pyx":886
 * class TagCountNoCSSReadabilityBlockifier(Blockifier):
 *     @staticmethod
 *     def blockify(s, encoding=None, parse_callback=None):             # <<<<<<<<<<<<<<
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,
 *                                    do_css=False, do_readability=True,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("dragnet.blocks.TagCountNoCSSReadabilityBlockifier.blockify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.from_py":13
 * 
 * @cname("__pyx_convert_string_from_py_std__in_string")
 * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t length
 *     cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length)
 */

static std::string __pyx_convert_string_from_py_std__in_string(PyObject *__pyx_v_o) {
  Py_ssize_t __pyx_v_length;
  char const *__pyx_v_data;
  std::string __pyx_r;
  __Pyx_RefNannyDeclarations
  char const *__pyx_t_1;
  __Pyx_RefNannySetupContext("__pyx_convert_string_from_py_std__in_string", 0);

  /* "string.from_py":15
 * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *:
 *     cdef Py_ssize_t length
 *     cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length)             # <<<<<<<<<<<<<<
 *     return string(data, length)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_AsStringAndSize(__pyx_v_o, (&__pyx_v_length)); if (unlikely(__pyx_t_1 == ((char const *)NULL))) __PYX_ERR(1, 15, __pyx_L1_error)
  __pyx_v_data = __pyx_t_1;

  /* "string.from_py":16
 *     cdef Py_ssize_t length
 *     cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length)
 *     return string(data, length)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = std::string(__pyx_v_data, __pyx_v_length);
  goto __pyx_L0;

  /* "string.from_py":13
 * 
 * @cname("__pyx_convert_string_from_py_std__in_string")
 * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t length
 *     cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("string.from_py.__pyx_convert_string_from_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "set.from_py":108
 * 
 * @cname("__pyx_convert_set_from_py_std_3a__3a_string")
 * cdef set[X] __pyx_convert_set_from_py_std_3a__3a_string(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef set[X] s
 *     for item in o:
 */

static std::set<std::string>  __pyx_convert_set_from_py_std_3a__3a_string(PyObject *__pyx_v_o) {
  std::set<std::string>  __pyx_v_s;
  PyObject *__pyx_v_item = NULL;
  std::set<std::string>  __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  std::string __pyx_t_5;
  __Pyx_RefNannySetupContext("__pyx_convert_set_from_py_std_3a__3a_string", 0);

  /* "set.from_py":110
 * cdef set[X] __pyx_convert_set_from_py_std_3a__3a_string(object o) except *:
 *     cdef set[X] s
 *     for item in o:             # <<<<<<<<<<<<<<
 *         s.insert(<X>item)
 *     return s
 */
  if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) {
    __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 110, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 110, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 110, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 110, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 110, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 110, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(1, 110, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "set.from_py":111
 *     cdef set[X] s
 *     for item in o:
 *         s.insert(<X>item)             # <<<<<<<<<<<<<<
 *     return s
 * 
 */
    __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_item); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 111, __pyx_L1_error)
    __pyx_v_s.insert(((std::string)__pyx_t_5));

    /* "set.from_py":110
 * cdef set[X] __pyx_convert_set_from_py_std_3a__3a_string(object o) except *:
 *     cdef set[X] s
 *     for item in o:             # <<<<<<<<<<<<<<
 *         s.insert(<X>item)
 *     return s
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "set.from_py":112
 *     for item in o:
 *         s.insert(<X>item)
 *     return s             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_s;
  goto __pyx_L0;

  /* "set.from_py":108
 * 
 * @cname("__pyx_convert_set_from_py_std_3a__3a_string")
 * cdef set[X] __pyx_convert_set_from_py_std_3a__3a_string(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef set[X] s
 *     for item in o:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("set.from_py.__pyx_convert_set_from_py_std_3a__3a_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static std::set<char>  __pyx_convert_set_from_py_char(PyObject *__pyx_v_o) {
  std::set<char>  __pyx_v_s;
  PyObject *__pyx_v_item = NULL;
  std::set<char>  __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  char __pyx_t_5;
  __Pyx_RefNannySetupContext("__pyx_convert_set_from_py_char", 0);

  /* "set.from_py":110
 * cdef set[X] __pyx_convert_set_from_py_char(object o) except *:
 *     cdef set[X] s
 *     for item in o:             # <<<<<<<<<<<<<<
 *         s.insert(<X>item)
 *     return s
 */
  if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) {
    __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 110, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 110, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 110, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 110, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 110, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 110, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(1, 110, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "set.from_py":111
 *     cdef set[X] s
 *     for item in o:
 *         s.insert(<X>item)             # <<<<<<<<<<<<<<
 *     return s
 * 
 */
    __pyx_t_5 = __Pyx_PyInt_As_char(__pyx_v_item); if (unlikely((__pyx_t_5 == (char)-1) && PyErr_Occurred())) __PYX_ERR(1, 111, __pyx_L1_error)
    __pyx_v_s.insert(((char)__pyx_t_5));

    /* "set.from_py":110
 * cdef set[X] __pyx_convert_set_from_py_char(object o) except *:
 *     cdef set[X] s
 *     for item in o:             # <<<<<<<<<<<<<<
 *         s.insert(<X>item)
 *     return s
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "set.from_py":112
 *     for item in o:
 *         s.insert(<X>item)
 *     return s             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_s;
  goto __pyx_L0;

  /* "set.from_py":108
 * 
 * @cname("__pyx_convert_set_from_py_char")
 * cdef set[X] __pyx_convert_set_from_py_char(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef set[X] s
 *     for item in o:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("set.from_py.__pyx_convert_set_from_py_char", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.to_py":31
 * 
 * @cname("__pyx_convert_PyObject_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyObject_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_PyObject_string_to_py_std__in_string", 0);

  /* "string.to_py":32
 * @cname("__pyx_convert_PyObject_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s):
 *     return __Pyx_PyObject_FromStringAndSize(s.data(), s.size())             # <<<<<<<<<<<<<<
 * cdef extern from *:
 *     cdef object __Pyx_PyUnicode_FromStringAndSize(const char*, size_t)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "string.to_py":31
 * 
 * @cname("__pyx_convert_PyObject_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyObject_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("string.to_py.__pyx_convert_PyObject_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.to_py":37
 * 
 * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(std::string const &__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_PyUnicode_string_to_py_std__in_string", 0);

  /* "string.to_py":38
 * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s):
 *     return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size())             # <<<<<<<<<<<<<<
 * cdef extern from *:
 *     cdef object __Pyx_PyStr_FromStringAndSize(const char*, size_t)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyUnicode_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "string.to_py":37
 * 
 * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("string.to_py.__pyx_convert_PyUnicode_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.to_py":43
 * 
 * @cname("__pyx_convert_PyStr_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyStr_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_PyStr_string_to_py_std__in_string", 0);

  /* "string.to_py":44
 * @cname("__pyx_convert_PyStr_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s):
 *     return __Pyx_PyStr_FromStringAndSize(s.data(), s.size())             # <<<<<<<<<<<<<<
 * cdef extern from *:
 *     cdef object __Pyx_PyBytes_FromStringAndSize(const char*, size_t)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyStr_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "string.to_py":43
 * 
 * @cname("__pyx_convert_PyStr_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyStr_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("string.to_py.__pyx_convert_PyStr_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.to_py":49
 * 
 * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(std::string const &__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_PyBytes_string_to_py_std__in_string", 0);

  /* "string.to_py":50
 * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s):
 *     return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size())             # <<<<<<<<<<<<<<
 * cdef extern from *:
 *     cdef object __Pyx_PyByteArray_FromStringAndSize(const char*, size_t)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "string.to_py":49
 * 
 * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("string.to_py.__pyx_convert_PyBytes_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.to_py":55
 * 
 * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size())
 * 
 */

static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_PyByteArray_string_to_py_std__in_string", 0);

  /* "string.to_py":56
 * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s):
 *     return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size())             # <<<<<<<<<<<<<<
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyByteArray_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "string.to_py":55
 * 
 * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size())
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("string.to_py.__pyx_convert_PyByteArray_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_uint32_t")
 * cdef object __pyx_convert_vector_to_py_uint32_t(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */

static PyObject *__pyx_convert_vector_to_py_uint32_t(const std::vector<uint32_t>  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_uint32_t", 0);

  /* "vector.to_py":61
 * @cname("__pyx_convert_vector_to_py_uint32_t")
 * cdef object __pyx_convert_vector_to_py_uint32_t(vector[X]& v):
 *     return [v[i] for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;
    __pyx_t_5 = __Pyx_PyInt_From_uint32_t((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 61, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 61, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_uint32_t")
 * cdef object __pyx_convert_vector_to_py_uint32_t(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_uint32_t", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pair.to_py":158
 * 
 * @cname("__pyx_convert_pair_to_py_uint32_t____int")
 * cdef object __pyx_convert_pair_to_py_uint32_t____int(const pair[X,Y]& p):             # <<<<<<<<<<<<<<
 *     return p.first, p.second
 * 
 */

static PyObject *__pyx_convert_pair_to_py_uint32_t____int(std::pair<uint32_t,int>  const &__pyx_v_p) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_pair_to_py_uint32_t____int", 0);

  /* "pair.to_py":159
 * @cname("__pyx_convert_pair_to_py_uint32_t____int")
 * cdef object __pyx_convert_pair_to_py_uint32_t____int(const pair[X,Y]& p):
 *     return p.first, p.second             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_uint32_t(__pyx_v_p.first); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_p.second); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "pair.to_py":158
 * 
 * @cname("__pyx_convert_pair_to_py_uint32_t____int")
 * cdef object __pyx_convert_pair_to_py_uint32_t____int(const pair[X,Y]& p):             # <<<<<<<<<<<<<<
 *     return p.first, p.second
 * 
 */

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

/* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_pair_3c_uint32_t_2c_int_3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_pair_3c_uint32_t_2c_int_3e___(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */

static PyObject *__pyx_convert_vector_to_py_std_3a__3a_pair_3c_uint32_t_2c_int_3e___(const std::vector<std::pair<uint32_t,int> >  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_std_3a__3a_pair_3c_uint32_t_2c_int_3e___", 0);

  /* "vector.to_py":61
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_pair_3c_uint32_t_2c_int_3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_pair_3c_uint32_t_2c_int_3e___(vector[X]& v):
 *     return [v[i] for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;
    __pyx_t_5 = __pyx_convert_pair_to_py_uint32_t____int((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 61, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 61, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_pair_3c_uint32_t_2c_int_3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_pair_3c_uint32_t_2c_int_3e___(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_std_3a__3a_pair_3c_uint32_t_2c_int_3e___", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_convert_vector_to_py_std_3a__3a_string(const std::vector<std::string>  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_std_3a__3a_string", 0);

  /* "vector.to_py":61
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_string")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_string(vector[X]& v):
 *     return [v[i] for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;
    __pyx_t_5 = __pyx_convert_PyBytes_string_to_py_std__in_string((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 61, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 61, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_string")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_string(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_std_3a__3a_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock __pyx_vtable_7dragnet_6blocks_PartialBlock;

static PyObject *__pyx_tp_new_7dragnet_6blocks_PartialBlock(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7dragnet_6blocks_PartialBlock *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7dragnet_6blocks_PartialBlock *)o);
  p->__pyx_vtab = __pyx_vtabptr_7dragnet_6blocks_PartialBlock;
  new((void*)&(p->css_attrib)) std::vector<std::string> ();
  new((void*)&(p->text)) std::vector<std::string> ();
  new((void*)&(p->link_tokens)) std::vector<std::string> ();
  new((void*)&(p->css_tree)) std::map<std::string,std::vector<std::string> > ();
  new((void*)&(p->css)) std::map<std::string,std::vector<std::string> > ();
  new((void*)&(p->block_start_tag)) std::string();
  new((void*)&(p->_tag_func)) std::vector<__pyx_t_7dragnet_6blocks_callback_t> ();
  new((void*)&(p->_reinit_func)) std::vector<__pyx_t_7dragnet_6blocks_reinit_t> ();
  new((void*)&(p->_name_func)) std::vector<__pyx_t_7dragnet_6blocks_name_t> ();
  new((void*)&(p->_subtree_func)) std::vector<__pyx_t_7dragnet_6blocks_subtree_t> ();
  new((void*)&(p->ancestors)) std::vector<uint32_t> ();
  new((void*)&(p->ancestors_write)) std::vector<uint32_t> ();
  new((void*)&(p->class_weights_written)) std::set<uint32_t> ();
  new((void*)&(p->class_weights)) std::vector<std::pair<uint32_t,int> > ();
  p->anchors = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->block_start_element = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_7dragnet_6blocks_12PartialBlock_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_7dragnet_6blocks_PartialBlock(PyObject *o) {
  struct __pyx_obj_7dragnet_6blocks_PartialBlock *p = (struct __pyx_obj_7dragnet_6blocks_PartialBlock *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->css_attrib);
  __Pyx_call_destructor(p->text);
  __Pyx_call_destructor(p->link_tokens);
  __Pyx_call_destructor(p->css_tree);
  __Pyx_call_destructor(p->css);
  __Pyx_call_destructor(p->block_start_tag);
  __Pyx_call_destructor(p->_tag_func);
  __Pyx_call_destructor(p->_reinit_func);
  __Pyx_call_destructor(p->_name_func);
  __Pyx_call_destructor(p->_subtree_func);
  __Pyx_call_destructor(p->ancestors);
  __Pyx_call_destructor(p->ancestors_write);
  __Pyx_call_destructor(p->class_weights_written);
  __Pyx_call_destructor(p->class_weights);
  Py_CLEAR(p->anchors);
  Py_CLEAR(p->block_start_element);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_7dragnet_6blocks_PartialBlock(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7dragnet_6blocks_PartialBlock *p = (struct __pyx_obj_7dragnet_6blocks_PartialBlock *)o;
  if (p->anchors) {
    e = (*v)(p->anchors, a); if (e) return e;
  }
  if (p->block_start_element) {
    e = (*v)(p->block_start_element, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7dragnet_6blocks_PartialBlock(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7dragnet_6blocks_PartialBlock *p = (struct __pyx_obj_7dragnet_6blocks_PartialBlock *)o;
  tmp = ((PyObject*)p->anchors);
  p->anchors = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->block_start_element);
  p->block_start_element = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_7dragnet_6blocks_PartialBlock[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7dragnet_6blocks_12PartialBlock_5__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7dragnet_6blocks_12PartialBlock_7__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7dragnet_6blocks_PartialBlock = {
  PyVarObject_HEAD_INIT(0, 0)
  "dragnet.blocks.PartialBlock", /*tp_name*/
  sizeof(struct __pyx_obj_7dragnet_6blocks_PartialBlock), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7dragnet_6blocks_PartialBlock, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "As we create blocks by recursing through subtrees\n    in Blockifier, we need to maintain some state\n    of the incomplete blocks.\n\n    This class maintains that state, as well as provides methods\n    to modify it.\n\n    The recurse method works as follows:\n        given a root node, iterate over the children\n        when we encounter <div>, <p>, etc, start a new block.\n            when starting a new block do the following:\n                call name(self) with the partialblock instance just\n                    before creating the block. this returns a key->int\n                    map that is added to the block\n                after creating the block and adding to output, call reinit()\n                    to reset the partialblock\n\n    To generalize, subclasses do the following:\n        define a set of \"feature extractors\".  These are given\n        a string name and specified by the following methods:\n\n        reinit_name() = r\n        name(self) = compute the features as a dict\n                    that is passed into the Block constructor, called\n                    just before the block is added to the results\n        tag_name(self, child) = called with each tag as we iterate through\n            the tree\n        subtree_name(1) called once before iterating over each subtree\n        subtree_name(-1) called once after iterating over the subtree\n\n    Can specify a set of call backs that are called with\n    the partial block instance just before the block is added\n    to the results.  These compute the features as a dict\n    that is passed into the Block constructor.  These are implemented\n    by subclasses.\n    ", /*tp_doc*/
  __pyx_tp_traverse_7dragnet_6blocks_PartialBlock, /*tp_traverse*/
  __pyx_tp_clear_7dragnet_6blocks_PartialBlock, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7dragnet_6blocks_PartialBlock, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_7dragnet_6blocks_12PartialBlock_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7dragnet_6blocks_PartialBlock, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_7dragnet_6blocks_TagCountPB __pyx_vtable_7dragnet_6blocks_TagCountPB;

static PyObject *__pyx_tp_new_7dragnet_6blocks_TagCountPB(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7dragnet_6blocks_TagCountPB *p;
  PyObject *o = __pyx_tp_new_7dragnet_6blocks_PartialBlock(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7dragnet_6blocks_TagCountPB *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7dragnet_6blocks_PartialBlock*)__pyx_vtabptr_7dragnet_6blocks_TagCountPB;
  return o;
}

static PyMethodDef __pyx_methods_7dragnet_6blocks_TagCountPB[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7dragnet_6blocks_10TagCountPB_3__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7dragnet_6blocks_10TagCountPB_5__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7dragnet_6blocks_TagCountPB = {
  PyVarObject_HEAD_INIT(0, 0)
  "dragnet.blocks.TagCountPB", /*tp_name*/
  sizeof(struct __pyx_obj_7dragnet_6blocks_TagCountPB), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7dragnet_6blocks_PartialBlock, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "Counts tags to compute content-tag ratios", /*tp_doc*/
  __pyx_tp_traverse_7dragnet_6blocks_PartialBlock, /*tp_traverse*/
  __pyx_tp_clear_7dragnet_6blocks_PartialBlock, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7dragnet_6blocks_TagCountPB, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_7dragnet_6blocks_10TagCountPB_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7dragnet_6blocks_TagCountPB, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec_blocks(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec_blocks},
  {0, NULL}
};
#endif

static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    "blocks",
    __pyx_k_Implementation_of_the_blockifie, /* m_doc */
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    0, /* m_size */
  #else
    -1, /* m_size */
  #endif
    __pyx_methods /* m_methods */,
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    __pyx_moduledef_slots, /* m_slots */
  #else
    NULL, /* m_reload */
  #endif
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif
#ifndef CYTHON_SMALL_CODE
#if defined(__clang__)
    #define CYTHON_SMALL_CODE
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
    #define CYTHON_SMALL_CODE __attribute__((cold))
#else
    #define CYTHON_SMALL_CODE
#endif
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_s_A_blockifier_for_web_page_de_ch, __pyx_k_A_blockifier_for_web_page_de_ch, sizeof(__pyx_k_A_blockifier_for_web_page_de_ch), 0, 0, 1, 0},
  {&__pyx_n_s_Block, __pyx_k_Block, sizeof(__pyx_k_Block), 0, 0, 1, 1},
  {&__pyx_n_s_Block___init, __pyx_k_Block___init, sizeof(__pyx_k_Block___init), 0, 0, 1, 1},
  {&__pyx_n_s_Blockifier, __pyx_k_Blockifier, sizeof(__pyx_k_Blockifier), 0, 0, 1, 1},
  {&__pyx_n_s_Blockifier_blockify, __pyx_k_Blockifier_blockify, sizeof(__pyx_k_Blockifier_blockify), 0, 0, 1, 1},
  {&__pyx_n_s_Blockifier_blocks_from_tree, __pyx_k_Blockifier_blocks_from_tree, sizeof(__pyx_k_Blockifier_blocks_from_tree), 0, 0, 1, 1},
  {&__pyx_n_s_BlockifyError, __pyx_k_BlockifyError, sizeof(__pyx_k_BlockifyError), 0, 0, 1, 1},
  {&__pyx_kp_s_Could_not_blockify_HTML, __pyx_k_Could_not_blockify_HTML, sizeof(__pyx_k_Could_not_blockify_HTML), 0, 0, 1, 0},
  {&__pyx_n_s_HTMLParser, __pyx_k_HTMLParser, sizeof(__pyx_k_HTMLParser), 0, 0, 1, 1},
  {&__pyx_n_s_I, __pyx_k_I, sizeof(__pyx_k_I), 0, 0, 1, 1},
  {&__pyx_n_s_IGNORECASE, __pyx_k_IGNORECASE, sizeof(__pyx_k_IGNORECASE), 0, 0, 1, 1},
  {&__pyx_n_s_PartialBlock, __pyx_k_PartialBlock, sizeof(__pyx_k_PartialBlock), 0, 0, 1, 1},
  {&__pyx_n_s_RE_HTML_ENCODING, __pyx_k_RE_HTML_ENCODING, sizeof(__pyx_k_RE_HTML_ENCODING), 0, 0, 1, 1},
  {&__pyx_n_s_RE_TEXT, __pyx_k_RE_TEXT, sizeof(__pyx_k_RE_TEXT), 0, 0, 1, 1},
  {&__pyx_n_s_RE_XML_ENCODING, __pyx_k_RE_XML_ENCODING, sizeof(__pyx_k_RE_XML_ENCODING), 0, 0, 1, 1},
  {&__pyx_kp_s_Raised_when_there_is_a_fatal_pro, __pyx_k_Raised_when_there_is_a_fatal_pro, sizeof(__pyx_k_Raised_when_there_is_a_fatal_pro), 0, 0, 1, 0},
  {&__pyx_n_s_TagCountBlockifier, __pyx_k_TagCountBlockifier, sizeof(__pyx_k_TagCountBlockifier), 0, 0, 1, 1},
  {&__pyx_n_s_TagCountBlockifier_blockify, __pyx_k_TagCountBlockifier_blockify, sizeof(__pyx_k_TagCountBlockifier_blockify), 0, 0, 1, 1},
  {&__pyx_n_s_TagCountNoCSSBlockifier, __pyx_k_TagCountNoCSSBlockifier, sizeof(__pyx_k_TagCountNoCSSBlockifier), 0, 0, 1, 1},
  {&__pyx_n_s_TagCountNoCSSBlockifier_blockify, __pyx_k_TagCountNoCSSBlockifier_blockify, sizeof(__pyx_k_TagCountNoCSSBlockifier_blockify), 0, 0, 1, 1},
  {&__pyx_n_s_TagCountNoCSSReadabilityBlockifi, __pyx_k_TagCountNoCSSReadabilityBlockifi, sizeof(__pyx_k_TagCountNoCSSReadabilityBlockifi), 0, 0, 1, 1},
  {&__pyx_n_s_TagCountNoCSSReadabilityBlockifi_2, __pyx_k_TagCountNoCSSReadabilityBlockifi_2, sizeof(__pyx_k_TagCountNoCSSReadabilityBlockifi_2), 0, 0, 1, 1},
  {&__pyx_n_s_TagCountPB, __pyx_k_TagCountPB, sizeof(__pyx_k_TagCountPB), 0, 0, 1, 1},
  {&__pyx_n_s_TagCountReadabilityBlockifier, __pyx_k_TagCountReadabilityBlockifier, sizeof(__pyx_k_TagCountReadabilityBlockifier), 0, 0, 1, 1},
  {&__pyx_n_s_TagCountReadabilityBlockifier_bl, __pyx_k_TagCountReadabilityBlockifier_bl, sizeof(__pyx_k_TagCountReadabilityBlockifier_bl), 0, 0, 1, 1},
  {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  {&__pyx_n_s_UNICODE, __pyx_k_UNICODE, sizeof(__pyx_k_UNICODE), 0, 0, 1, 1},
  {&__pyx_n_s_UnicodeDecodeError, __pyx_k_UnicodeDecodeError, sizeof(__pyx_k_UnicodeDecodeError), 0, 0, 1, 1},
  {&__pyx_kp_s_W, __pyx_k_W, sizeof(__pyx_k_W), 0, 0, 1, 0},
  {&__pyx_kp_b_W_2, __pyx_k_W_2, sizeof(__pyx_k_W_2), 0, 0, 0, 0},
  {&__pyx_kp_s_W_2, __pyx_k_W_2, sizeof(__pyx_k_W_2), 0, 0, 1, 0},
  {&__pyx_kp_b__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 0, 0},
  {&__pyx_kp_s__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 1, 0},
  {&__pyx_kp_b__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 0, 0},
  {&__pyx_n_b_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 0, 0, 1},
  {&__pyx_n_b_address, __pyx_k_address, sizeof(__pyx_k_address), 0, 0, 0, 1},
  {&__pyx_n_s_ancestors, __pyx_k_ancestors, sizeof(__pyx_k_ancestors), 0, 0, 1, 1},
  {&__pyx_n_b_anchor_count, __pyx_k_anchor_count, sizeof(__pyx_k_anchor_count), 0, 0, 0, 1},
  {&__pyx_n_s_anchors, __pyx_k_anchors, sizeof(__pyx_k_anchors), 0, 0, 1, 1},
  {&__pyx_n_b_applet, __pyx_k_applet, sizeof(__pyx_k_applet), 0, 0, 0, 1},
  {&__pyx_n_b_area, __pyx_k_area, sizeof(__pyx_k_area), 0, 0, 0, 1},
  {&__pyx_kp_s_article_body_content_entry_hentr, __pyx_k_article_body_content_entry_hentr, sizeof(__pyx_k_article_body_content_entry_hentr), 0, 0, 1, 0},
  {&__pyx_n_b_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 0, 1},
  {&__pyx_n_b_basefont, __pyx_k_basefont, sizeof(__pyx_k_basefont), 0, 0, 0, 1},
  {&__pyx_n_b_bdo, __pyx_k_bdo, sizeof(__pyx_k_bdo), 0, 0, 0, 1},
  {&__pyx_n_s_block_start_element, __pyx_k_block_start_element, sizeof(__pyx_k_block_start_element), 0, 0, 1, 1},
  {&__pyx_n_s_block_start_tag, __pyx_k_block_start_tag, sizeof(__pyx_k_block_start_tag), 0, 0, 1, 1},
  {&__pyx_n_s_blockify, __pyx_k_blockify, sizeof(__pyx_k_blockify), 0, 0, 1, 1},
  {&__pyx_n_b_blockquote, __pyx_k_blockquote, sizeof(__pyx_k_blockquote), 0, 0, 0, 1},
  {&__pyx_n_s_blocks, __pyx_k_blocks, sizeof(__pyx_k_blocks), 0, 0, 1, 1},
  {&__pyx_n_s_blocks_from_tree, __pyx_k_blocks_from_tree, sizeof(__pyx_k_blocks_from_tree), 0, 0, 1, 1},
  {&__pyx_n_b_button, __pyx_k_button, sizeof(__pyx_k_button), 0, 0, 0, 1},
  {&__pyx_n_s_bytes_cast, __pyx_k_bytes_cast, sizeof(__pyx_k_bytes_cast), 0, 0, 1, 1},
  {&__pyx_n_s_callback, __pyx_k_callback, sizeof(__pyx_k_callback), 0, 0, 1, 1},
  {&__pyx_n_b_caption, __pyx_k_caption, sizeof(__pyx_k_caption), 0, 0, 0, 1},
  {&__pyx_n_s_ceil, __pyx_k_ceil, sizeof(__pyx_k_ceil), 0, 0, 1, 1},
  {&__pyx_n_s_chardet, __pyx_k_chardet, sizeof(__pyx_k_chardet), 0, 0, 1, 1},
  {&__pyx_n_s_child, __pyx_k_child, sizeof(__pyx_k_child), 0, 0, 1, 1},
  {&__pyx_n_b_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 0, 1},
  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  {&__pyx_kp_s_combx_comment_com_contact_foot_f, __pyx_k_combx_comment_com_contact_foot_f, sizeof(__pyx_k_combx_comment_com_contact_foot_f), 0, 0, 1, 0},
  {&__pyx_n_s_compat, __pyx_k_compat, sizeof(__pyx_k_compat), 0, 0, 1, 1},
  {&__pyx_n_s_compile, __pyx_k_compile, sizeof(__pyx_k_compile), 0, 0, 1, 1},
  {&__pyx_n_s_css, __pyx_k_css, sizeof(__pyx_k_css), 0, 0, 1, 1},
  {&__pyx_n_s_ctree, __pyx_k_ctree, sizeof(__pyx_k_ctree), 0, 0, 1, 1},
  {&__pyx_n_b_dd, __pyx_k_dd, sizeof(__pyx_k_dd), 0, 0, 0, 1},
  {&__pyx_n_s_default, __pyx_k_default, sizeof(__pyx_k_default), 0, 0, 1, 1},
  {&__pyx_n_s_detect, __pyx_k_detect, sizeof(__pyx_k_detect), 0, 0, 1, 1},
  {&__pyx_n_b_div, __pyx_k_div, sizeof(__pyx_k_div), 0, 0, 0, 1},
  {&__pyx_n_b_dl, __pyx_k_dl, sizeof(__pyx_k_dl), 0, 0, 0, 1},
  {&__pyx_n_s_do_css, __pyx_k_do_css, sizeof(__pyx_k_do_css), 0, 0, 1, 1},
  {&__pyx_n_s_do_readability, __pyx_k_do_readability, sizeof(__pyx_k_do_readability), 0, 0, 1, 1},
  {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
  {&__pyx_n_s_dragnet_blocks, __pyx_k_dragnet_blocks, sizeof(__pyx_k_dragnet_blocks), 0, 0, 1, 1},
  {&__pyx_kp_s_dragnet_blocks_pyx, __pyx_k_dragnet_blocks_pyx, sizeof(__pyx_k_dragnet_blocks_pyx), 0, 0, 1, 0},
  {&__pyx_n_b_dt, __pyx_k_dt, sizeof(__pyx_k_dt), 0, 0, 0, 1},
  {&__pyx_n_s_ele, __pyx_k_ele, sizeof(__pyx_k_ele), 0, 0, 1, 1},
  {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
  {&__pyx_n_s_encoding, __pyx_k_encoding, sizeof(__pyx_k_encoding), 0, 0, 1, 1},
  {&__pyx_kp_b_encoding_s_s, __pyx_k_encoding_s_s, sizeof(__pyx_k_encoding_s_s), 0, 0, 0, 0},
  {&__pyx_n_s_endpos, __pyx_k_endpos, sizeof(__pyx_k_endpos), 0, 0, 1, 1},
  {&__pyx_n_s_etree, __pyx_k_etree, sizeof(__pyx_k_etree), 0, 0, 1, 1},
  {&__pyx_n_s_features, __pyx_k_features, sizeof(__pyx_k_features), 0, 0, 1, 1},
  {&__pyx_n_b_fieldset, __pyx_k_fieldset, sizeof(__pyx_k_fieldset), 0, 0, 0, 1},
  {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
  {&__pyx_n_b_form, __pyx_k_form, sizeof(__pyx_k_form), 0, 0, 0, 1},
  {&__pyx_n_b_fram, __pyx_k_fram, sizeof(__pyx_k_fram), 0, 0, 0, 1},
  {&__pyx_n_b_frameset, __pyx_k_frameset, sizeof(__pyx_k_frameset), 0, 0, 0, 1},
  {&__pyx_n_s_fromstring, __pyx_k_fromstring, sizeof(__pyx_k_fromstring), 0, 0, 1, 1},
  {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
  {&__pyx_n_s_group, __pyx_k_group, sizeof(__pyx_k_group), 0, 0, 1, 1},
  {&__pyx_n_s_guess_encoding, __pyx_k_guess_encoding, sizeof(__pyx_k_guess_encoding), 0, 0, 1, 1},
  {&__pyx_n_b_h1, __pyx_k_h1, sizeof(__pyx_k_h1), 0, 0, 0, 1},
  {&__pyx_n_b_h2, __pyx_k_h2, sizeof(__pyx_k_h2), 0, 0, 0, 1},
  {&__pyx_n_b_h3, __pyx_k_h3, sizeof(__pyx_k_h3), 0, 0, 0, 1},
  {&__pyx_n_b_h4, __pyx_k_h4, sizeof(__pyx_k_h4), 0, 0, 0, 1},
  {&__pyx_n_b_h5, __pyx_k_h5, sizeof(__pyx_k_h5), 0, 0, 0, 1},
  {&__pyx_n_b_h6, __pyx_k_h6, sizeof(__pyx_k_h6), 0, 0, 0, 1},
  {&__pyx_n_s_html, __pyx_k_html, sizeof(__pyx_k_html), 0, 0, 1, 1},
  {&__pyx_n_s_html_endpos, __pyx_k_html_endpos, sizeof(__pyx_k_html_endpos), 0, 0, 1, 1},
  {&__pyx_n_b_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 0, 1},
  {&__pyx_n_b_iframe, __pyx_k_iframe, sizeof(__pyx_k_iframe), 0, 0, 0, 1},
  {&__pyx_n_b_img, __pyx_k_img, sizeof(__pyx_k_img), 0, 0, 0, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
  {&__pyx_n_b_input, __pyx_k_input, sizeof(__pyx_k_input), 0, 0, 0, 1},
  {&__pyx_n_s_iterchildren, __pyx_k_iterchildren, sizeof(__pyx_k_iterchildren), 0, 0, 1, 1},
  {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1},
  {&__pyx_n_s_kwargs, __pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 0, 1, 1},
  {&__pyx_n_b_legend, __pyx_k_legend, sizeof(__pyx_k_legend), 0, 0, 0, 1},
  {&__pyx_n_b_li, __pyx_k_li, sizeof(__pyx_k_li), 0, 0, 0, 1},
  {&__pyx_n_b_like, __pyx_k_like, sizeof(__pyx_k_like), 0, 0, 0, 1},
  {&__pyx_kp_b_like_box, __pyx_k_like_box, sizeof(__pyx_k_like_box), 0, 0, 0, 0},
  {&__pyx_n_b_link, __pyx_k_link, sizeof(__pyx_k_link), 0, 0, 0, 1},
  {&__pyx_n_s_link_density, __pyx_k_link_density, sizeof(__pyx_k_link_density), 0, 0, 1, 1},
  {&__pyx_n_s_link_tokens, __pyx_k_link_tokens, sizeof(__pyx_k_link_tokens), 0, 0, 1, 1},
  {&__pyx_n_s_lower, __pyx_k_lower, sizeof(__pyx_k_lower), 0, 0, 1, 1},
  {&__pyx_n_s_lxml, __pyx_k_lxml, sizeof(__pyx_k_lxml), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_b_map, __pyx_k_map, sizeof(__pyx_k_map), 0, 0, 0, 1},
  {&__pyx_n_s_markup, __pyx_k_markup, sizeof(__pyx_k_markup), 0, 0, 1, 1},
  {&__pyx_n_b_math, __pyx_k_math, sizeof(__pyx_k_math), 0, 0, 0, 1},
  {&__pyx_n_s_math, __pyx_k_math, sizeof(__pyx_k_math), 0, 0, 1, 1},
  {&__pyx_n_b_menu, __pyx_k_menu, sizeof(__pyx_k_menu), 0, 0, 0, 1},
  {&__pyx_n_b_meta, __pyx_k_meta, sizeof(__pyx_k_meta), 0, 0, 0, 1},
  {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
  {&__pyx_n_b_min_depth_since_last_block, __pyx_k_min_depth_since_last_block, sizeof(__pyx_k_min_depth_since_last_block), 0, 0, 0, 1},
  {&__pyx_n_s_mo, __pyx_k_mo, sizeof(__pyx_k_mo), 0, 0, 1, 1},
  {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
  {&__pyx_n_s_moh, __pyx_k_moh, sizeof(__pyx_k_moh), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
  {&__pyx_n_b_noframes, __pyx_k_noframes, sizeof(__pyx_k_noframes), 0, 0, 0, 1},
  {&__pyx_n_b_noscript, __pyx_k_noscript, sizeof(__pyx_k_noscript), 0, 0, 0, 1},
  {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
  {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
  {&__pyx_n_b_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 0, 1},
  {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1},
  {&__pyx_n_b_ol, __pyx_k_ol, sizeof(__pyx_k_ol), 0, 0, 0, 1},
  {&__pyx_n_b_optgroup, __pyx_k_optgroup, sizeof(__pyx_k_optgroup), 0, 0, 0, 1},
  {&__pyx_n_b_option, __pyx_k_option, sizeof(__pyx_k_option), 0, 0, 0, 1},
  {&__pyx_n_b_p, __pyx_k_p, sizeof(__pyx_k_p), 0, 0, 0, 1},
  {&__pyx_n_b_param, __pyx_k_param, sizeof(__pyx_k_param), 0, 0, 0, 1},
  {&__pyx_n_s_parse_callback, __pyx_k_parse_callback, sizeof(__pyx_k_parse_callback), 0, 0, 1, 1},
  {&__pyx_n_s_partial_block, __pyx_k_partial_block, sizeof(__pyx_k_partial_block), 0, 0, 1, 1},
  {&__pyx_n_s_pb, __pyx_k_pb, sizeof(__pyx_k_pb), 0, 0, 1, 1},
  {&__pyx_n_b_plusone, __pyx_k_plusone, sizeof(__pyx_k_plusone), 0, 0, 0, 1},
  {&__pyx_n_b_pre, __pyx_k_pre, sizeof(__pyx_k_pre), 0, 0, 0, 1},
  {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
  {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_re, __pyx_k_re, sizeof(__pyx_k_re), 0, 0, 1, 1},
  {&__pyx_n_s_re_readability_negative, __pyx_k_re_readability_negative, sizeof(__pyx_k_re_readability_negative), 0, 0, 1, 1},
  {&__pyx_n_s_re_readability_positive, __pyx_k_re_readability_positive, sizeof(__pyx_k_re_readability_positive), 0, 0, 1, 1},
  {&__pyx_n_s_re_tokenizer, __pyx_k_re_tokenizer, sizeof(__pyx_k_re_tokenizer), 0, 0, 1, 1},
  {&__pyx_n_s_re_tokenizer_nounicode, __pyx_k_re_tokenizer_nounicode, sizeof(__pyx_k_re_tokenizer_nounicode), 0, 0, 1, 1},
  {&__pyx_n_s_readability_class_weights, __pyx_k_readability_class_weights, sizeof(__pyx_k_readability_class_weights), 0, 0, 1, 1},
  {&__pyx_n_s_recover, __pyx_k_recover, sizeof(__pyx_k_recover), 0, 0, 1, 1},
  {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
  {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
  {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
  {&__pyx_n_s_remove_comments, __pyx_k_remove_comments, sizeof(__pyx_k_remove_comments), 0, 0, 1, 1},
  {&__pyx_n_s_remove_pis, __pyx_k_remove_pis, sizeof(__pyx_k_remove_pis), 0, 0, 1, 1},
  {&__pyx_n_s_results, __pyx_k_results, sizeof(__pyx_k_results), 0, 0, 1, 1},
  {&__pyx_n_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 1},
  {&__pyx_kp_b_s_meta_charset_s_s, __pyx_k_s_meta_charset_s_s, sizeof(__pyx_k_s_meta_charset_s_s), 0, 0, 0, 0},
  {&__pyx_n_b_script, __pyx_k_script, sizeof(__pyx_k_script), 0, 0, 0, 1},
  {&__pyx_n_s_search, __pyx_k_search, sizeof(__pyx_k_search), 0, 0, 1, 1},
  {&__pyx_n_b_select, __pyx_k_select, sizeof(__pyx_k_select), 0, 0, 0, 1},
  {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
  {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
  {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
  {&__pyx_n_s_simple_tokenizer, __pyx_k_simple_tokenizer, sizeof(__pyx_k_simple_tokenizer), 0, 0, 1, 1},
  {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
  {&__pyx_n_s_staticmethod, __pyx_k_staticmethod, sizeof(__pyx_k_staticmethod), 0, 0, 1, 1},
  {&__pyx_n_s_str_block_cast, __pyx_k_str_block_cast, sizeof(__pyx_k_str_block_cast), 0, 0, 1, 1},
  {&__pyx_n_s_str_block_list_cast, __pyx_k_str_block_list_cast, sizeof(__pyx_k_str_block_list_cast), 0, 0, 1, 1},
  {&__pyx_n_s_str_cast, __pyx_k_str_cast, sizeof(__pyx_k_str_cast), 0, 0, 1, 1},
  {&__pyx_n_s_str_dict_cast, __pyx_k_str_dict_cast, sizeof(__pyx_k_str_dict_cast), 0, 0, 1, 1},
  {&__pyx_n_s_str_list_cast, __pyx_k_str_list_cast, sizeof(__pyx_k_str_list_cast), 0, 0, 1, 1},
  {&__pyx_n_b_style, __pyx_k_style, sizeof(__pyx_k_style), 0, 0, 0, 1},
  {&__pyx_n_b_svg, __pyx_k_svg, sizeof(__pyx_k_svg), 0, 0, 0, 1},
  {&__pyx_n_b_table, __pyx_k_table, sizeof(__pyx_k_table), 0, 0, 0, 1},
  {&__pyx_n_s_tag, __pyx_k_tag, sizeof(__pyx_k_tag), 0, 0, 1, 1},
  {&__pyx_n_b_tagcount, __pyx_k_tagcount, sizeof(__pyx_k_tagcount), 0, 0, 0, 1},
  {&__pyx_n_b_tagcount_since_last_block, __pyx_k_tagcount_since_last_block, sizeof(__pyx_k_tagcount_since_last_block), 0, 0, 0, 1},
  {&__pyx_n_s_tags_exclude, __pyx_k_tags_exclude, sizeof(__pyx_k_tags_exclude), 0, 0, 1, 1},
  {&__pyx_n_b_tail, __pyx_k_tail, sizeof(__pyx_k_tail), 0, 0, 0, 1},
  {&__pyx_n_s_tail, __pyx_k_tail, sizeof(__pyx_k_tail), 0, 0, 1, 1},
  {&__pyx_n_b_td, __pyx_k_td, sizeof(__pyx_k_td), 0, 0, 0, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_b_text, __pyx_k_text, sizeof(__pyx_k_text), 0, 0, 0, 1},
  {&__pyx_n_s_text, __pyx_k_text, sizeof(__pyx_k_text), 0, 0, 1, 1},
  {&__pyx_n_s_text_density, __pyx_k_text_density, sizeof(__pyx_k_text_density), 0, 0, 1, 1},
  {&__pyx_n_s_text_from_subtree, __pyx_k_text_from_subtree, sizeof(__pyx_k_text_from_subtree), 0, 0, 1, 1},
  {&__pyx_n_b_textarea, __pyx_k_textarea, sizeof(__pyx_k_textarea), 0, 0, 0, 1},
  {&__pyx_n_b_th, __pyx_k_th, sizeof(__pyx_k_th), 0, 0, 0, 1},
  {&__pyx_n_s_tree, __pyx_k_tree, sizeof(__pyx_k_tree), 0, 0, 1, 1},
  {&__pyx_n_b_ul, __pyx_k_ul, sizeof(__pyx_k_ul), 0, 0, 0, 1},
  {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
  {&__pyx_kp_s_utf_8, __pyx_k_utf_8, sizeof(__pyx_k_utf_8), 0, 0, 1, 0},
  {&__pyx_n_b_var, __pyx_k_var, sizeof(__pyx_k_var), 0, 0, 0, 1},
  {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
  {&__pyx_n_s_xml_endpos, __pyx_k_xml_endpos, sizeof(__pyx_k_xml_endpos), 0, 0, 1, 1},
  {&__pyx_n_b_xmp, __pyx_k_xmp, sizeof(__pyx_k_xmp), 0, 0, 0, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(0, 136, __pyx_L1_error)
  __pyx_builtin_staticmethod = __Pyx_GetBuiltinName(__pyx_n_s_staticmethod); if (!__pyx_builtin_staticmethod) __PYX_ERR(0, 806, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 116, __pyx_L1_error)
  __pyx_builtin_UnicodeDecodeError = __Pyx_GetBuiltinName(__pyx_n_s_UnicodeDecodeError); if (!__pyx_builtin_UnicodeDecodeError) __PYX_ERR(0, 169, __pyx_L1_error)
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__5);
  __Pyx_GIVEREF(__pyx_tuple__5);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__7);
  __Pyx_GIVEREF(__pyx_tuple__7);

  /* "dragnet/blocks.pyx":34
 * from compat import str_list_cast, str_dict_cast, str_block_cast, str_block_list_cast, str_cast, bytes_cast
 * 
 * RE_HTML_ENCODING = re.compile(             # <<<<<<<<<<<<<<
 *     b'<\s*meta[^>]+charset\s*?=\s*?[\'"]?([^>]*?)[ /;\'">]',
 *     flags=re.IGNORECASE)
 */
  __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_b_s_meta_charset_s_s); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__8);
  __Pyx_GIVEREF(__pyx_tuple__8);

  /* "dragnet/blocks.pyx":37
 *     b'<\s*meta[^>]+charset\s*?=\s*?[\'"]?([^>]*?)[ /;\'">]',
 *     flags=re.IGNORECASE)
 * RE_XML_ENCODING = re.compile(             # <<<<<<<<<<<<<<
 *     b'^<\?.*?encoding\s*?=\s*?[\'"](.*?)[\'"].*?\?>',
 *     flags=re.IGNORECASE)
 */
  __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_b_encoding_s_s); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__9);
  __Pyx_GIVEREF(__pyx_tuple__9);

  /* "dragnet/blocks.pyx":40
 *     b'^<\?.*?encoding\s*?=\s*?[\'"](.*?)[\'"].*?\?>',
 *     flags=re.IGNORECASE)
 * RE_TEXT = re.compile(r'[^\W_]+', flags=re.UNICODE)             # <<<<<<<<<<<<<<
 * re_tokenizer = re.compile(r'[\W_]+', re.UNICODE)
 * re_tokenizer_nounicode = re.compile(b'[\W_]+')
 */
  __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_W); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);

  /* "dragnet/blocks.pyx":42
 * RE_TEXT = re.compile(r'[^\W_]+', flags=re.UNICODE)
 * re_tokenizer = re.compile(r'[\W_]+', re.UNICODE)
 * re_tokenizer_nounicode = re.compile(b'[\W_]+')             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_b_W_2); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 42, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__11);
  __Pyx_GIVEREF(__pyx_tuple__11);

  /* "dragnet/blocks.pyx":45
 * 
 * 
 * def simple_tokenizer(x):             # <<<<<<<<<<<<<<
 *     return [ele for ele in re_tokenizer.split(x) if len(ele) > 0]
 * 
 */
  __pyx_tuple__12 = PyTuple_Pack(2, __pyx_n_s_x, __pyx_n_s_ele); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);
  __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 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_dragnet_blocks_pyx, __pyx_n_s_simple_tokenizer, 45, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 45, __pyx_L1_error)

  /* "dragnet/blocks.pyx":136
 * 
 * 
 * class Block(object):             # <<<<<<<<<<<<<<
 *     def __init__(self, text, link_density, text_density,
 *             anchors, link_tokens, css, **kwargs):
 */
  __pyx_tuple__14 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);

  /* "dragnet/blocks.pyx":137
 * 
 * class Block(object):
 *     def __init__(self, text, link_density, text_density,             # <<<<<<<<<<<<<<
 *             anchors, link_tokens, css, **kwargs):
 *         self.text = text
 */
  __pyx_tuple__15 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_text, __pyx_n_s_link_density, __pyx_n_s_text_density, __pyx_n_s_anchors, __pyx_n_s_link_tokens, __pyx_n_s_css, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 137, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);
  __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(7, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_dragnet_blocks_pyx, __pyx_n_s_init, 137, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 137, __pyx_L1_error)

  /* "dragnet/blocks.pyx":219
 * 
 * 
 * def text_from_subtree(tree, tags_exclude=set(), tail=True, callback=None):             # <<<<<<<<<<<<<<
 *     """Get all the text
 *     from the subtree, excluding tags_exclude
 */
  __pyx_tuple__17 = PyTuple_Pack(6, __pyx_n_s_tree, __pyx_n_s_tags_exclude, __pyx_n_s_tail, __pyx_n_s_callback, __pyx_n_s_text, __pyx_n_s_child); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 219, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);
  __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(4, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_dragnet_blocks_pyx, __pyx_n_s_text_from_subtree, 219, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 219, __pyx_L1_error)

  /* "dragnet/blocks.pyx":777
 * 
 * 
 * def guess_encoding(markup, default='utf-8'):             # <<<<<<<<<<<<<<
 *     """
 *     Try to guess the encoding of ``markup`` by checking the XML declaration
 */
  __pyx_tuple__19 = PyTuple_Pack(7, __pyx_n_s_markup, __pyx_n_s_default, __pyx_n_s_xml_endpos, __pyx_n_s_html_endpos, __pyx_n_s_mo, __pyx_n_s_moh, __pyx_n_s_chardet); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 777, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);
  __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(2, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_dragnet_blocks_pyx, __pyx_n_s_guess_encoding, 777, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 777, __pyx_L1_error)

  /* "dragnet/blocks.pyx":798
 * 
 * 
 * class Blockifier(object):             # <<<<<<<<<<<<<<
 *     """
 *     A blockifier for web-page de-chroming that loosely follows the approach in
 */
  __pyx_tuple__21 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 798, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);

  /* "dragnet/blocks.pyx":807
 * 
 *     @staticmethod
 *     def blocks_from_tree(tree, pb=PartialBlock, do_css=True, do_readability=False):             # <<<<<<<<<<<<<<
 *         cdef list results = []
 *         cdef cetree._Element ctree
 */
  __pyx_tuple__22 = PyTuple_Pack(7, __pyx_n_s_tree, __pyx_n_s_pb, __pyx_n_s_do_css, __pyx_n_s_do_readability, __pyx_n_s_results, __pyx_n_s_ctree, __pyx_n_s_partial_block); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 807, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__22);
  __Pyx_GIVEREF(__pyx_tuple__22);
  __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(4, 0, 7, 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_dragnet_blocks_pyx, __pyx_n_s_blocks_from_tree, 807, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 807, __pyx_L1_error)

  /* "dragnet/blocks.pyx":821
 * 
 *     @staticmethod
 *     def blockify(s, encoding=None,             # <<<<<<<<<<<<<<
 *                  pb=PartialBlock, do_css=True, do_readability=False,
 *                  parse_callback=None):
 */
  __pyx_tuple__24 = PyTuple_Pack(9, __pyx_n_s_s, __pyx_n_s_encoding, __pyx_n_s_pb, __pyx_n_s_do_css, __pyx_n_s_do_readability, __pyx_n_s_parse_callback, __pyx_n_s_html, __pyx_n_s_blocks, __pyx_n_s_ele); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__24);
  __Pyx_GIVEREF(__pyx_tuple__24);
  __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(6, 0, 9, 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_dragnet_blocks_pyx, __pyx_n_s_blockify, 821, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 821, __pyx_L1_error)

  /* "dragnet/blocks.pyx":865
 * class TagCountBlockifier(Blockifier):
 *     @staticmethod
 *     def blockify(s, encoding=None, parse_callback=None):             # <<<<<<<<<<<<<<
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,
 *                                    do_css=True, do_readability=False,
 */
  __pyx_tuple__26 = PyTuple_Pack(3, __pyx_n_s_s, __pyx_n_s_encoding, __pyx_n_s_parse_callback); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 865, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__26);
  __Pyx_GIVEREF(__pyx_tuple__26);
  __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 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_dragnet_blocks_pyx, __pyx_n_s_blockify, 865, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 865, __pyx_L1_error)
  __pyx_tuple__28 = PyTuple_Pack(2, ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 865, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__28);
  __Pyx_GIVEREF(__pyx_tuple__28);

  /* "dragnet/blocks.pyx":872
 * class TagCountNoCSSBlockifier(Blockifier):
 *     @staticmethod
 *     def blockify(s, encoding=None, parse_callback=None):             # <<<<<<<<<<<<<<
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,
 *                                    do_css=False, do_readability=False,
 */
  __pyx_tuple__29 = PyTuple_Pack(3, __pyx_n_s_s, __pyx_n_s_encoding, __pyx_n_s_parse_callback); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 872, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__29);
  __Pyx_GIVEREF(__pyx_tuple__29);
  __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 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_dragnet_blocks_pyx, __pyx_n_s_blockify, 872, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 872, __pyx_L1_error)
  __pyx_tuple__31 = PyTuple_Pack(2, ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 872, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);

  /* "dragnet/blocks.pyx":879
 * class TagCountReadabilityBlockifier(Blockifier):
 *     @staticmethod
 *     def blockify(s, encoding=None, parse_callback=None):             # <<<<<<<<<<<<<<
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,
 *                                    do_css=True, do_readability=True,
 */
  __pyx_tuple__32 = PyTuple_Pack(3, __pyx_n_s_s, __pyx_n_s_encoding, __pyx_n_s_parse_callback); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 879, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__32);
  __Pyx_GIVEREF(__pyx_tuple__32);
  __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_dragnet_blocks_pyx, __pyx_n_s_blockify, 879, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 879, __pyx_L1_error)
  __pyx_tuple__34 = PyTuple_Pack(2, ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 879, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__34);
  __Pyx_GIVEREF(__pyx_tuple__34);

  /* "dragnet/blocks.pyx":886
 * class TagCountNoCSSReadabilityBlockifier(Blockifier):
 *     @staticmethod
 *     def blockify(s, encoding=None, parse_callback=None):             # <<<<<<<<<<<<<<
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,
 *                                    do_css=False, do_readability=True,
 */
  __pyx_tuple__35 = PyTuple_Pack(3, __pyx_n_s_s, __pyx_n_s_encoding, __pyx_n_s_parse_callback); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 886, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__35);
  __Pyx_GIVEREF(__pyx_tuple__35);
  __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_dragnet_blocks_pyx, __pyx_n_s_blockify, 886, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 886, __pyx_L1_error)
  __pyx_tuple__37 = PyTuple_Pack(2, ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 886, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__37);
  __Pyx_GIVEREF(__pyx_tuple__37);
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  __pyx_float_1_0 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_float_1_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_80 = PyInt_FromLong(80); if (unlikely(!__pyx_int_80)) __PYX_ERR(0, 1, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/

static int __Pyx_modinit_global_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  /*--- Global init code ---*/
  __pyx_v_7dragnet_6blocks_etree = Py_None; Py_INCREF(Py_None);
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_type_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  __pyx_vtabptr_7dragnet_6blocks_PartialBlock = &__pyx_vtable_7dragnet_6blocks_PartialBlock;
  __pyx_vtable_7dragnet_6blocks_PartialBlock._fe_reinit = (void (*)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *))__pyx_f_7dragnet_6blocks_12PartialBlock__fe_reinit;
  __pyx_vtable_7dragnet_6blocks_PartialBlock.reinit = (void (*)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *))__pyx_f_7dragnet_6blocks_12PartialBlock_reinit;
  __pyx_vtable_7dragnet_6blocks_PartialBlock.reinit_css = (void (*)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *, bool))__pyx_f_7dragnet_6blocks_12PartialBlock_reinit_css;
  __pyx_vtable_7dragnet_6blocks_PartialBlock._extract_features = (PyObject *(*)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *, bool))__pyx_f_7dragnet_6blocks_12PartialBlock__extract_features;
  __pyx_vtable_7dragnet_6blocks_PartialBlock._add_readability = (PyObject *(*)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *))__pyx_f_7dragnet_6blocks_12PartialBlock__add_readability;
  __pyx_vtable_7dragnet_6blocks_PartialBlock.add_block_to_results = (void (*)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *, PyObject *))__pyx_f_7dragnet_6blocks_12PartialBlock_add_block_to_results;
  __pyx_vtable_7dragnet_6blocks_PartialBlock.add_text = (void (*)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *, xmlNode *, std::string))__pyx_f_7dragnet_6blocks_12PartialBlock_add_text;
  __pyx_vtable_7dragnet_6blocks_PartialBlock.add_anchor = (void (*)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *, xmlNode *, struct LxmlDocument *))__pyx_f_7dragnet_6blocks_12PartialBlock_add_anchor;
  __pyx_vtable_7dragnet_6blocks_PartialBlock._tag_fe = (void (*)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *, std::string))__pyx_f_7dragnet_6blocks_12PartialBlock__tag_fe;
  __pyx_vtable_7dragnet_6blocks_PartialBlock._subtree_fe = (void (*)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *, int))__pyx_f_7dragnet_6blocks_12PartialBlock__subtree_fe;
  __pyx_vtable_7dragnet_6blocks_PartialBlock.subtree_readability = (void (*)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *, int))__pyx_f_7dragnet_6blocks_12PartialBlock_subtree_readability;
  __pyx_vtable_7dragnet_6blocks_PartialBlock.readability_score_node = (void (*)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *, xmlNode *))__pyx_f_7dragnet_6blocks_12PartialBlock_readability_score_node;
  __pyx_vtable_7dragnet_6blocks_PartialBlock.reinit_readability = (void (*)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *))__pyx_f_7dragnet_6blocks_12PartialBlock_reinit_readability;
  __pyx_vtable_7dragnet_6blocks_PartialBlock.recurse = (void (*)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *, xmlNode *, PyObject *, struct LxmlDocument *))__pyx_f_7dragnet_6blocks_12PartialBlock_recurse;
  __pyx_vtable_7dragnet_6blocks_PartialBlock.update_css = (void (*)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *, xmlNode *, bool))__pyx_f_7dragnet_6blocks_12PartialBlock_update_css;
  __pyx_vtable_7dragnet_6blocks_PartialBlock.pop_css_tree = (void (*)(struct __pyx_obj_7dragnet_6blocks_PartialBlock *))__pyx_f_7dragnet_6blocks_12PartialBlock_pop_css_tree;
  if (PyType_Ready(&__pyx_type_7dragnet_6blocks_PartialBlock) < 0) __PYX_ERR(0, 250, __pyx_L1_error)
  __pyx_type_7dragnet_6blocks_PartialBlock.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7dragnet_6blocks_PartialBlock.tp_dictoffset && __pyx_type_7dragnet_6blocks_PartialBlock.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7dragnet_6blocks_PartialBlock.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_7dragnet_6blocks_PartialBlock.tp_dict, __pyx_vtabptr_7dragnet_6blocks_PartialBlock) < 0) __PYX_ERR(0, 250, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_PartialBlock, (PyObject *)&__pyx_type_7dragnet_6blocks_PartialBlock) < 0) __PYX_ERR(0, 250, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7dragnet_6blocks_PartialBlock) < 0) __PYX_ERR(0, 250, __pyx_L1_error)
  __pyx_ptype_7dragnet_6blocks_PartialBlock = &__pyx_type_7dragnet_6blocks_PartialBlock;
  __pyx_vtabptr_7dragnet_6blocks_TagCountPB = &__pyx_vtable_7dragnet_6blocks_TagCountPB;
  __pyx_vtable_7dragnet_6blocks_TagCountPB.__pyx_base = *__pyx_vtabptr_7dragnet_6blocks_PartialBlock;
  __pyx_vtable_7dragnet_6blocks_TagCountPB.reinit_tagcount = (void (*)(struct __pyx_obj_7dragnet_6blocks_TagCountPB *))__pyx_f_7dragnet_6blocks_10TagCountPB_reinit_tagcount;
  __pyx_vtable_7dragnet_6blocks_TagCountPB.subtree_tagcount = (void (*)(struct __pyx_obj_7dragnet_6blocks_TagCountPB *, int))__pyx_f_7dragnet_6blocks_10TagCountPB_subtree_tagcount;
  __pyx_vtable_7dragnet_6blocks_TagCountPB.tagcount = (std::map<std::string,int>  (*)(struct __pyx_obj_7dragnet_6blocks_TagCountPB *, bool))__pyx_f_7dragnet_6blocks_10TagCountPB_tagcount;
  __pyx_vtable_7dragnet_6blocks_TagCountPB.tag_tagcount = (void (*)(struct __pyx_obj_7dragnet_6blocks_TagCountPB *, std::string))__pyx_f_7dragnet_6blocks_10TagCountPB_tag_tagcount;
  __pyx_type_7dragnet_6blocks_TagCountPB.tp_base = __pyx_ptype_7dragnet_6blocks_PartialBlock;
  if (PyType_Ready(&__pyx_type_7dragnet_6blocks_TagCountPB) < 0) __PYX_ERR(0, 693, __pyx_L1_error)
  __pyx_type_7dragnet_6blocks_TagCountPB.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7dragnet_6blocks_TagCountPB.tp_dictoffset && __pyx_type_7dragnet_6blocks_TagCountPB.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7dragnet_6blocks_TagCountPB.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_7dragnet_6blocks_TagCountPB.tp_dict, __pyx_vtabptr_7dragnet_6blocks_TagCountPB) < 0) __PYX_ERR(0, 693, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_TagCountPB, (PyObject *)&__pyx_type_7dragnet_6blocks_TagCountPB) < 0) __PYX_ERR(0, 693, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7dragnet_6blocks_TagCountPB) < 0) __PYX_ERR(0, 693, __pyx_L1_error)
  __pyx_ptype_7dragnet_6blocks_TagCountPB = &__pyx_type_7dragnet_6blocks_TagCountPB;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_import_code(void) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  /*--- Type import code ---*/
  __pyx_t_1 = PyImport_ImportModule("lxml.etree"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4lxml_8includes_11etreepublic__Document = __Pyx_ImportType(__pyx_t_1, "lxml.etree", "_Document", sizeof(struct LxmlDocument), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4lxml_8includes_11etreepublic__Document) __PYX_ERR(2, 30, __pyx_L1_error)
  __pyx_ptype_4lxml_8includes_11etreepublic__Element = __Pyx_ImportType(__pyx_t_1, "lxml.etree", "_Element", sizeof(struct LxmlElement), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4lxml_8includes_11etreepublic__Element) __PYX_ERR(2, 33, __pyx_L1_error)
  __pyx_ptype_4lxml_8includes_11etreepublic_ElementBase = __Pyx_ImportType(__pyx_t_1, "lxml.etree", "ElementBase", sizeof(struct LxmlElementBase), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4lxml_8includes_11etreepublic_ElementBase) __PYX_ERR(2, 37, __pyx_L1_error)
  __pyx_ptype_4lxml_8includes_11etreepublic__ElementTree = __Pyx_ImportType(__pyx_t_1, "lxml.etree", "_ElementTree", sizeof(struct LxmlElementTree), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4lxml_8includes_11etreepublic__ElementTree) __PYX_ERR(2, 40, __pyx_L1_error)
  __pyx_ptype_4lxml_8includes_11etreepublic_ElementClassLookup = __Pyx_ImportType(__pyx_t_1, "lxml.etree", "ElementClassLookup", sizeof(struct LxmlElementClassLookup), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4lxml_8includes_11etreepublic_ElementClassLookup) __PYX_ERR(2, 44, __pyx_L1_error)
  __pyx_ptype_4lxml_8includes_11etreepublic_FallbackElementClassLookup = __Pyx_ImportType(__pyx_t_1, "lxml.etree", "FallbackElementClassLookup", sizeof(struct LxmlFallbackElementClassLookup), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4lxml_8includes_11etreepublic_FallbackElementClassLookup) __PYX_ERR(2, 47, __pyx_L1_error)
  __pyx_ptype_4lxml_8includes_11etreepublic__ElementTagMatcher = __Pyx_ImportType(__pyx_t_1, "lxml.etree", "_ElementTagMatcher", sizeof(struct LxmlElementTagMatcher), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4lxml_8includes_11etreepublic__ElementTagMatcher) __PYX_ERR(2, 159, __pyx_L1_error)
  __pyx_ptype_4lxml_8includes_11etreepublic__ElementIterator = __Pyx_ImportType(__pyx_t_1, "lxml.etree", "_ElementIterator", sizeof(struct LxmlElementIterator), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4lxml_8includes_11etreepublic__ElementIterator) __PYX_ERR(2, 168, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_variable_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  /*--- Variable import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}


#if PY_MAJOR_VERSION < 3
#ifdef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC void
#else
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#endif
#else
#ifdef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC PyObject *
#else
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#endif
#endif


#if PY_MAJOR_VERSION < 3
__Pyx_PyMODINIT_FUNC initblocks(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC initblocks(void)
#else
__Pyx_PyMODINIT_FUNC PyInit_blocks(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit_blocks(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
  return PyModuleDef_Init(&__pyx_moduledef);
}
static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
    #if PY_VERSION_HEX >= 0x030700A1
    static PY_INT64_T main_interpreter_id = -1;
    PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
    if (main_interpreter_id == -1) {
        main_interpreter_id = current_id;
        return (unlikely(current_id == -1)) ? -1 : 0;
    } else if (unlikely(main_interpreter_id != current_id))
    #else
    static PyInterpreterState *main_interpreter = NULL;
    PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
    if (!main_interpreter) {
        main_interpreter = current_interpreter;
    } else if (unlikely(main_interpreter != current_interpreter))
    #endif
    {
        PyErr_SetString(
            PyExc_ImportError,
            "Interpreter change detected - this module can only be loaded into one interpreter per process.");
        return -1;
    }
    return 0;
}
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) {
    PyObject *value = PyObject_GetAttrString(spec, from_name);
    int result = 0;
    if (likely(value)) {
        if (allow_none || value != Py_None) {
            result = PyDict_SetItemString(moddict, to_name, value);
        }
        Py_DECREF(value);
    } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Clear();
    } else {
        result = -1;
    }
    return result;
}
static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
    PyObject *module = NULL, *moddict, *modname;
    if (__Pyx_check_single_interpreter())
        return NULL;
    if (__pyx_m)
        return __Pyx_NewRef(__pyx_m);
    modname = PyObject_GetAttrString(spec, "name");
    if (unlikely(!modname)) goto bad;
    module = PyModule_NewObject(modname);
    Py_DECREF(modname);
    if (unlikely(!module)) goto bad;
    moddict = PyModule_GetDict(module);
    if (unlikely(!moddict)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
    return module;
bad:
    Py_XDECREF(module);
    return NULL;
}


static CYTHON_SMALL_CODE int __pyx_pymod_exec_blocks(PyObject *__pyx_pyinit_module)
#endif
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  std::set<std::string>  __pyx_t_6;
  std::string __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  std::set<char>  __pyx_t_11;
  __Pyx_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m) {
    if (__pyx_m == __pyx_pyinit_module) return 0;
    PyErr_SetString(PyExc_RuntimeError, "Module 'blocks' has already been imported. Re-initialisation is not supported.");
    return -1;
  }
  #elif PY_MAJOR_VERSION >= 3
  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  #endif
  #if CYTHON_REFNANNY
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
if (!__Pyx_RefNanny) {
  PyErr_Clear();
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  if (!__Pyx_RefNanny)
      Py_FatalError("failed to import 'refnanny' module");
}
#endif
  __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_blocks(void)", 0);
  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pxy_PyFrame_Initialize_Offsets
  __Pxy_PyFrame_Initialize_Offsets();
  #endif
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_AsyncGen_USED
  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_StopAsyncIteration_USED
  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __pyx_m = __pyx_pyinit_module;
  Py_INCREF(__pyx_m);
  #else
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("blocks", __pyx_methods, __pyx_k_Implementation_of_the_blockifie, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_b);
  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_cython_runtime);
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  if (__pyx_module_is_main_dragnet__blocks) {
    if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "dragnet.blocks")) {
      if (unlikely(PyDict_SetItemString(modules, "dragnet.blocks", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Global type/function init code ---*/
  (void)__Pyx_modinit_global_init_code();
  (void)__Pyx_modinit_variable_export_code();
  (void)__Pyx_modinit_function_export_code();
  if (unlikely(__Pyx_modinit_type_init_code() != 0)) goto __pyx_L1_error;
  if (unlikely(__Pyx_modinit_type_import_code() != 0)) goto __pyx_L1_error;
  (void)__Pyx_modinit_variable_import_code();
  (void)__Pyx_modinit_function_import_code();
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif

  /* "dragnet/blocks.pyx":24
 * cimport lxml.includes.etreepublic as cetree
 * cdef object etree
 * from lxml import etree             # <<<<<<<<<<<<<<
 * cetree.import_lxml__etree()
 * 
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_etree);
  __Pyx_GIVEREF(__pyx_n_s_etree);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_etree);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_lxml, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_etree); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_XGOTREF(__pyx_v_7dragnet_6blocks_etree);
  __Pyx_DECREF_SET(__pyx_v_7dragnet_6blocks_etree, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "dragnet/blocks.pyx":25
 * cdef object etree
 * from lxml import etree
 * cetree.import_lxml__etree()             # <<<<<<<<<<<<<<
 * 
 * # python imports
 */
  __pyx_t_3 = import_lxml__etree(); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 25, __pyx_L1_error)

  /* "dragnet/blocks.pyx":28
 * 
 * # python imports
 * import re             # <<<<<<<<<<<<<<
 * import numpy as np
 * import math
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_re, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_re, __pyx_t_2) < 0) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "dragnet/blocks.pyx":29
 * # python imports
 * import re
 * import numpy as np             # <<<<<<<<<<<<<<
 * import math
 * 
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_2) < 0) __PYX_ERR(0, 29, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "dragnet/blocks.pyx":30
 * import re
 * import numpy as np
 * import math             # <<<<<<<<<<<<<<
 * 
 * from compat import str_list_cast, str_dict_cast, str_block_cast, str_block_list_cast, str_cast, bytes_cast
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_math, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_math, __pyx_t_2) < 0) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "dragnet/blocks.pyx":32
 * import math
 * 
 * from compat import str_list_cast, str_dict_cast, str_block_cast, str_block_list_cast, str_cast, bytes_cast             # <<<<<<<<<<<<<<
 * 
 * RE_HTML_ENCODING = re.compile(
 */
  __pyx_t_2 = PyList_New(6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_str_list_cast);
  __Pyx_GIVEREF(__pyx_n_s_str_list_cast);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_str_list_cast);
  __Pyx_INCREF(__pyx_n_s_str_dict_cast);
  __Pyx_GIVEREF(__pyx_n_s_str_dict_cast);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_str_dict_cast);
  __Pyx_INCREF(__pyx_n_s_str_block_cast);
  __Pyx_GIVEREF(__pyx_n_s_str_block_cast);
  PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_str_block_cast);
  __Pyx_INCREF(__pyx_n_s_str_block_list_cast);
  __Pyx_GIVEREF(__pyx_n_s_str_block_list_cast);
  PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_s_str_block_list_cast);
  __Pyx_INCREF(__pyx_n_s_str_cast);
  __Pyx_GIVEREF(__pyx_n_s_str_cast);
  PyList_SET_ITEM(__pyx_t_2, 4, __pyx_n_s_str_cast);
  __Pyx_INCREF(__pyx_n_s_bytes_cast);
  __Pyx_GIVEREF(__pyx_n_s_bytes_cast);
  PyList_SET_ITEM(__pyx_t_2, 5, __pyx_n_s_bytes_cast);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_compat, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_str_list_cast); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_str_list_cast, __pyx_t_2) < 0) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_str_dict_cast); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_str_dict_cast, __pyx_t_2) < 0) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_str_block_cast); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_str_block_cast, __pyx_t_2) < 0) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_str_block_list_cast); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_str_block_list_cast, __pyx_t_2) < 0) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_str_cast); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_str_cast, __pyx_t_2) < 0) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_bytes_cast); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_bytes_cast, __pyx_t_2) < 0) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "dragnet/blocks.pyx":34
 * from compat import str_list_cast, str_dict_cast, str_block_cast, str_block_list_cast, str_cast, bytes_cast
 * 
 * RE_HTML_ENCODING = re.compile(             # <<<<<<<<<<<<<<
 *     b'<\s*meta[^>]+charset\s*?=\s*?[\'"]?([^>]*?)[ /;\'">]',
 *     flags=re.IGNORECASE)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_re); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_compile); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "dragnet/blocks.pyx":36
 * RE_HTML_ENCODING = re.compile(
 *     b'<\s*meta[^>]+charset\s*?=\s*?[\'"]?([^>]*?)[ /;\'">]',
 *     flags=re.IGNORECASE)             # <<<<<<<<<<<<<<
 * RE_XML_ENCODING = re.compile(
 *     b'^<\?.*?encoding\s*?=\s*?[\'"](.*?)[\'"].*?\?>',
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_re); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_IGNORECASE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_flags, __pyx_t_5) < 0) __PYX_ERR(0, 36, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "dragnet/blocks.pyx":34
 * from compat import str_list_cast, str_dict_cast, str_block_cast, str_block_list_cast, str_cast, bytes_cast
 * 
 * RE_HTML_ENCODING = re.compile(             # <<<<<<<<<<<<<<
 *     b'<\s*meta[^>]+charset\s*?=\s*?[\'"]?([^>]*?)[ /;\'">]',
 *     flags=re.IGNORECASE)
 */
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__8, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RE_HTML_ENCODING, __pyx_t_5) < 0) __PYX_ERR(0, 34, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "dragnet/blocks.pyx":37
 *     b'<\s*meta[^>]+charset\s*?=\s*?[\'"]?([^>]*?)[ /;\'">]',
 *     flags=re.IGNORECASE)
 * RE_XML_ENCODING = re.compile(             # <<<<<<<<<<<<<<
 *     b'^<\?.*?encoding\s*?=\s*?[\'"](.*?)[\'"].*?\?>',
 *     flags=re.IGNORECASE)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_re); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_compile); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "dragnet/blocks.pyx":39
 * RE_XML_ENCODING = re.compile(
 *     b'^<\?.*?encoding\s*?=\s*?[\'"](.*?)[\'"].*?\?>',
 *     flags=re.IGNORECASE)             # <<<<<<<<<<<<<<
 * RE_TEXT = re.compile(r'[^\W_]+', flags=re.UNICODE)
 * re_tokenizer = re.compile(r'[\W_]+', re.UNICODE)
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 39, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_re); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_IGNORECASE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 39, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_flags, __pyx_t_4) < 0) __PYX_ERR(0, 39, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "dragnet/blocks.pyx":37
 *     b'<\s*meta[^>]+charset\s*?=\s*?[\'"]?([^>]*?)[ /;\'">]',
 *     flags=re.IGNORECASE)
 * RE_XML_ENCODING = re.compile(             # <<<<<<<<<<<<<<
 *     b'^<\?.*?encoding\s*?=\s*?[\'"](.*?)[\'"].*?\?>',
 *     flags=re.IGNORECASE)
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__9, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RE_XML_ENCODING, __pyx_t_4) < 0) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "dragnet/blocks.pyx":40
 *     b'^<\?.*?encoding\s*?=\s*?[\'"](.*?)[\'"].*?\?>',
 *     flags=re.IGNORECASE)
 * RE_TEXT = re.compile(r'[^\W_]+', flags=re.UNICODE)             # <<<<<<<<<<<<<<
 * re_tokenizer = re.compile(r'[\W_]+', re.UNICODE)
 * re_tokenizer_nounicode = re.compile(b'[\W_]+')
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_re); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_compile); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_re); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_UNICODE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_flags, __pyx_t_2) < 0) __PYX_ERR(0, 40, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__10, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RE_TEXT, __pyx_t_2) < 0) __PYX_ERR(0, 40, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "dragnet/blocks.pyx":41
 *     flags=re.IGNORECASE)
 * RE_TEXT = re.compile(r'[^\W_]+', flags=re.UNICODE)
 * re_tokenizer = re.compile(r'[\W_]+', re.UNICODE)             # <<<<<<<<<<<<<<
 * re_tokenizer_nounicode = re.compile(b'[\W_]+')
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_re); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_compile); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 41, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_re); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_UNICODE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 41, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_kp_s_W_2);
  __Pyx_GIVEREF(__pyx_kp_s_W_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_s_W_2);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 41, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_re_tokenizer, __pyx_t_5) < 0) __PYX_ERR(0, 41, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "dragnet/blocks.pyx":42
 * RE_TEXT = re.compile(r'[^\W_]+', flags=re.UNICODE)
 * re_tokenizer = re.compile(r'[\W_]+', re.UNICODE)
 * re_tokenizer_nounicode = re.compile(b'[\W_]+')             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_re); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 42, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_compile); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 42, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_re_tokenizer_nounicode, __pyx_t_5) < 0) __PYX_ERR(0, 42, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "dragnet/blocks.pyx":45
 * 
 * 
 * def simple_tokenizer(x):             # <<<<<<<<<<<<<<
 *     return [ele for ele in re_tokenizer.split(x) if len(ele) > 0]
 * 
 */
  __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_7dragnet_6blocks_1simple_tokenizer, NULL, __pyx_n_s_dragnet_blocks); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_simple_tokenizer, __pyx_t_5) < 0) __PYX_ERR(0, 45, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "dragnet/blocks.pyx":65
 * cdef cpp_set[string] BLACKLIST
 * BLACKLIST = {
 *     b'applet', b'area', b'base', b'basefont', b'bdo', b'button',             # <<<<<<<<<<<<<<
 *     b'caption', b'fieldset', b'fram', b'frameset',
 *     b'iframe', b'img', b'input', b'legend', b'link', b'menu', b'meta',
 */
  __pyx_t_5 = PySet_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 65, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PySet_Add(__pyx_t_5, __pyx_n_b_applet) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_area) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_base) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_basefont) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_bdo) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_button) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_caption) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_fieldset) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_fram) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_frameset) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_iframe) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_img) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_input) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_legend) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_link) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_menu) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_meta) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_noframes) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_noscript) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_object) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_optgroup) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_option) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_param) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_script) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_select) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_style) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_textarea) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_var) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_xmp) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_like) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_kp_b_like_box) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_plusone) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_svg) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_math) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  __pyx_t_6 = __pyx_convert_set_from_py_std_3a__3a_string(__pyx_t_5); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 65, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_7dragnet_6blocks_BLACKLIST = __pyx_t_6;

  /* "dragnet/blocks.pyx":77
 * # tags defining the blocks we'll extract
 * cdef cpp_set[string] BLOCKS
 * BLOCKS = {b'h1', b'h2', b'h3', b'h4', b'h5', b'h6', b'p', b'div', b'table', b'map'}             # <<<<<<<<<<<<<<
 * 
 * # define some commonly used strings here, otherwise Cython will always add
 */
  __pyx_t_5 = PySet_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PySet_Add(__pyx_t_5, __pyx_n_b_h1) < 0) __PYX_ERR(0, 77, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_h2) < 0) __PYX_ERR(0, 77, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_h3) < 0) __PYX_ERR(0, 77, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_h4) < 0) __PYX_ERR(0, 77, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_h5) < 0) __PYX_ERR(0, 77, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_h6) < 0) __PYX_ERR(0, 77, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_p) < 0) __PYX_ERR(0, 77, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_div) < 0) __PYX_ERR(0, 77, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_table) < 0) __PYX_ERR(0, 77, __pyx_L1_error)
  if (PySet_Add(__pyx_t_5, __pyx_n_b_map) < 0) __PYX_ERR(0, 77, __pyx_L1_error)
  __pyx_t_6 = __pyx_convert_set_from_py_std_3a__3a_string(__pyx_t_5); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 77, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_7dragnet_6blocks_BLOCKS = __pyx_t_6;

  /* "dragnet/blocks.pyx":81
 * # define some commonly used strings here, otherwise Cython will always add
 * # a little python overhead when using them even though they are constant
 * cdef string CTEXT = <string>'text'             # <<<<<<<<<<<<<<
 * cdef string CTAIL = <string>'tail'
 * cdef string A = <string>'a'
 */
  __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_text); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 81, __pyx_L1_error)
  __pyx_v_7dragnet_6blocks_CTEXT = ((std::string)__pyx_t_7);

  /* "dragnet/blocks.pyx":82
 * # a little python overhead when using them even though they are constant
 * cdef string CTEXT = <string>'text'
 * cdef string CTAIL = <string>'tail'             # <<<<<<<<<<<<<<
 * cdef string A = <string>'a'
 * cdef string TAGCOUNT_SINCE_LAST_BLOCK = <string>'tagcount_since_last_block'
 */
  __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_tail); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 82, __pyx_L1_error)
  __pyx_v_7dragnet_6blocks_CTAIL = ((std::string)__pyx_t_7);

  /* "dragnet/blocks.pyx":83
 * cdef string CTEXT = <string>'text'
 * cdef string CTAIL = <string>'tail'
 * cdef string A = <string>'a'             # <<<<<<<<<<<<<<
 * cdef string TAGCOUNT_SINCE_LAST_BLOCK = <string>'tagcount_since_last_block'
 * cdef string TAGCOUNT = <string>'tagcount'
 */
  __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_a); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 83, __pyx_L1_error)
  __pyx_v_7dragnet_6blocks_A = ((std::string)__pyx_t_7);

  /* "dragnet/blocks.pyx":84
 * cdef string CTAIL = <string>'tail'
 * cdef string A = <string>'a'
 * cdef string TAGCOUNT_SINCE_LAST_BLOCK = <string>'tagcount_since_last_block'             # <<<<<<<<<<<<<<
 * cdef string TAGCOUNT = <string>'tagcount'
 * cdef string ANCHOR_COUNT = <string>'anchor_count'
 */
  __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_tagcount_since_last_block); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 84, __pyx_L1_error)
  __pyx_v_7dragnet_6blocks_TAGCOUNT_SINCE_LAST_BLOCK = ((std::string)__pyx_t_7);

  /* "dragnet/blocks.pyx":85
 * cdef string A = <string>'a'
 * cdef string TAGCOUNT_SINCE_LAST_BLOCK = <string>'tagcount_since_last_block'
 * cdef string TAGCOUNT = <string>'tagcount'             # <<<<<<<<<<<<<<
 * cdef string ANCHOR_COUNT = <string>'anchor_count'
 * cdef string MIN_DEPTH_SINCE_LAST_BLOCK = <string>'min_depth_since_last_block'
 */
  __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_tagcount); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 85, __pyx_L1_error)
  __pyx_v_7dragnet_6blocks_TAGCOUNT = ((std::string)__pyx_t_7);

  /* "dragnet/blocks.pyx":86
 * cdef string TAGCOUNT_SINCE_LAST_BLOCK = <string>'tagcount_since_last_block'
 * cdef string TAGCOUNT = <string>'tagcount'
 * cdef string ANCHOR_COUNT = <string>'anchor_count'             # <<<<<<<<<<<<<<
 * cdef string MIN_DEPTH_SINCE_LAST_BLOCK = <string>'min_depth_since_last_block'
 * 
 */
  __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_anchor_count); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 86, __pyx_L1_error)
  __pyx_v_7dragnet_6blocks_ANCHOR_COUNT = ((std::string)__pyx_t_7);

  /* "dragnet/blocks.pyx":87
 * cdef string TAGCOUNT = <string>'tagcount'
 * cdef string ANCHOR_COUNT = <string>'anchor_count'
 * cdef string MIN_DEPTH_SINCE_LAST_BLOCK = <string>'min_depth_since_last_block'             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_min_depth_since_last_block); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 87, __pyx_L1_error)
  __pyx_v_7dragnet_6blocks_MIN_DEPTH_SINCE_LAST_BLOCK = ((std::string)__pyx_t_7);

  /* "dragnet/blocks.pyx":91
 * 
 * # for the class/id readability score
 * re_readability_negative = re.compile('combx|comment|com-|contact|foot|footer|footnote|masthead|media|meta|outbrain|promo|related|scroll|shoutbox|sidebar|sponsor|shopping|tags|tool|widget', re.I)             # <<<<<<<<<<<<<<
 * re_readability_positive = re.compile('article|body|content|entry|hentry|main|page|pagination|post|text|blog|story', re.I)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_re); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_compile); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_re); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_I); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_kp_s_combx_comment_com_contact_foot_f);
  __Pyx_GIVEREF(__pyx_kp_s_combx_comment_com_contact_foot_f);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_s_combx_comment_com_contact_foot_f);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_re_readability_negative, __pyx_t_4) < 0) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "dragnet/blocks.pyx":92
 * # for the class/id readability score
 * re_readability_negative = re.compile('combx|comment|com-|contact|foot|footer|footnote|masthead|media|meta|outbrain|promo|related|scroll|shoutbox|sidebar|sponsor|shopping|tags|tool|widget', re.I)
 * re_readability_positive = re.compile('article|body|content|entry|hentry|main|page|pagination|post|text|blog|story', re.I)             # <<<<<<<<<<<<<<
 * 
 * cdef string DIV = <string>'div'
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_re); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_compile); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_re); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_I); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_kp_s_article_body_content_entry_hentr);
  __Pyx_GIVEREF(__pyx_kp_s_article_body_content_entry_hentr);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_s_article_body_content_entry_hentr);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_re_readability_positive, __pyx_t_2) < 0) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "dragnet/blocks.pyx":94
 * re_readability_positive = re.compile('article|body|content|entry|hentry|main|page|pagination|post|text|blog|story', re.I)
 * 
 * cdef string DIV = <string>'div'             # <<<<<<<<<<<<<<
 * 
 * cdef cpp_set[string] READABILITY_PLUS3
 */
  __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_div); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 94, __pyx_L1_error)
  __pyx_v_7dragnet_6blocks_DIV = ((std::string)__pyx_t_7);

  /* "dragnet/blocks.pyx":97
 * 
 * cdef cpp_set[string] READABILITY_PLUS3
 * READABILITY_PLUS3 = {b'pre', b'td', b'blockquote'}             # <<<<<<<<<<<<<<
 * 
 * cdef cpp_set[string] READABILITY_MINUS3
 */
  __pyx_t_2 = PySet_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PySet_Add(__pyx_t_2, __pyx_n_b_pre) < 0) __PYX_ERR(0, 97, __pyx_L1_error)
  if (PySet_Add(__pyx_t_2, __pyx_n_b_td) < 0) __PYX_ERR(0, 97, __pyx_L1_error)
  if (PySet_Add(__pyx_t_2, __pyx_n_b_blockquote) < 0) __PYX_ERR(0, 97, __pyx_L1_error)
  __pyx_t_6 = __pyx_convert_set_from_py_std_3a__3a_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_7dragnet_6blocks_READABILITY_PLUS3 = __pyx_t_6;

  /* "dragnet/blocks.pyx":100
 * 
 * cdef cpp_set[string] READABILITY_MINUS3
 * READABILITY_MINUS3 = {b'address', b'ol', b'ul', b'dl', b'dd', b'dt', b'li', b'form'}             # <<<<<<<<<<<<<<
 * 
 * cdef cpp_set[string] READABILITY_MINUS5
 */
  __pyx_t_2 = PySet_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PySet_Add(__pyx_t_2, __pyx_n_b_address) < 0) __PYX_ERR(0, 100, __pyx_L1_error)
  if (PySet_Add(__pyx_t_2, __pyx_n_b_ol) < 0) __PYX_ERR(0, 100, __pyx_L1_error)
  if (PySet_Add(__pyx_t_2, __pyx_n_b_ul) < 0) __PYX_ERR(0, 100, __pyx_L1_error)
  if (PySet_Add(__pyx_t_2, __pyx_n_b_dl) < 0) __PYX_ERR(0, 100, __pyx_L1_error)
  if (PySet_Add(__pyx_t_2, __pyx_n_b_dd) < 0) __PYX_ERR(0, 100, __pyx_L1_error)
  if (PySet_Add(__pyx_t_2, __pyx_n_b_dt) < 0) __PYX_ERR(0, 100, __pyx_L1_error)
  if (PySet_Add(__pyx_t_2, __pyx_n_b_li) < 0) __PYX_ERR(0, 100, __pyx_L1_error)
  if (PySet_Add(__pyx_t_2, __pyx_n_b_form) < 0) __PYX_ERR(0, 100, __pyx_L1_error)
  __pyx_t_6 = __pyx_convert_set_from_py_std_3a__3a_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 100, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_7dragnet_6blocks_READABILITY_MINUS3 = __pyx_t_6;

  /* "dragnet/blocks.pyx":103
 * 
 * cdef cpp_set[string] READABILITY_MINUS5
 * READABILITY_MINUS5 = {b'h1', b'h2', b'h3', b'h4', b'h5', b'h6', b'th'}             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = PySet_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PySet_Add(__pyx_t_2, __pyx_n_b_h1) < 0) __PYX_ERR(0, 103, __pyx_L1_error)
  if (PySet_Add(__pyx_t_2, __pyx_n_b_h2) < 0) __PYX_ERR(0, 103, __pyx_L1_error)
  if (PySet_Add(__pyx_t_2, __pyx_n_b_h3) < 0) __PYX_ERR(0, 103, __pyx_L1_error)
  if (PySet_Add(__pyx_t_2, __pyx_n_b_h4) < 0) __PYX_ERR(0, 103, __pyx_L1_error)
  if (PySet_Add(__pyx_t_2, __pyx_n_b_h5) < 0) __PYX_ERR(0, 103, __pyx_L1_error)
  if (PySet_Add(__pyx_t_2, __pyx_n_b_h6) < 0) __PYX_ERR(0, 103, __pyx_L1_error)
  if (PySet_Add(__pyx_t_2, __pyx_n_b_th) < 0) __PYX_ERR(0, 103, __pyx_L1_error)
  __pyx_t_6 = __pyx_convert_set_from_py_std_3a__3a_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 103, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_7dragnet_6blocks_READABILITY_MINUS5 = __pyx_t_6;

  /* "dragnet/blocks.pyx":106
 * 
 * 
 * cdef cpp_set[char] WHITESPACE = set([<char>' ', <char>'\t', <char>'\n',             # <<<<<<<<<<<<<<
 *     <char>'\r', <char>'\f', <char>'\v'])
 * 
 */
  __pyx_t_2 = __Pyx_PyInt_From_char(((char)' ')); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyInt_From_char(((char)'\t')); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_char(((char)'\n')); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "dragnet/blocks.pyx":107
 * 
 * cdef cpp_set[char] WHITESPACE = set([<char>' ', <char>'\t', <char>'\n',
 *     <char>'\r', <char>'\f', <char>'\v'])             # <<<<<<<<<<<<<<
 * 
 * cdef vector[string] _tokens_from_text(vector[string] text):
 */
  __pyx_t_1 = __Pyx_PyInt_From_char(((char)'\r')); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = __Pyx_PyInt_From_char(((char)'\x0C')); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = __Pyx_PyInt_From_char(((char)'\x0B')); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PySet_New(0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (PySet_Add(__pyx_t_10, __pyx_t_2) < 0) __PYX_ERR(0, 106, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PySet_Add(__pyx_t_10, __pyx_t_4) < 0) __PYX_ERR(0, 106, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PySet_Add(__pyx_t_10, __pyx_t_5) < 0) __PYX_ERR(0, 106, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PySet_Add(__pyx_t_10, __pyx_t_1) < 0) __PYX_ERR(0, 106, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PySet_Add(__pyx_t_10, __pyx_t_8) < 0) __PYX_ERR(0, 106, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (PySet_Add(__pyx_t_10, __pyx_t_9) < 0) __PYX_ERR(0, 106, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "dragnet/blocks.pyx":106
 * 
 * 
 * cdef cpp_set[char] WHITESPACE = set([<char>' ', <char>'\t', <char>'\n',             # <<<<<<<<<<<<<<
 *     <char>'\r', <char>'\f', <char>'\v'])
 * 
 */
  __pyx_t_11 = __pyx_convert_set_from_py_char(__pyx_t_10); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 106, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_v_7dragnet_6blocks_WHITESPACE = __pyx_t_11;

  /* "dragnet/blocks.pyx":136
 * 
 * 
 * class Block(object):             # <<<<<<<<<<<<<<
 *     def __init__(self, text, link_density, text_density,
 *             anchors, link_tokens, css, **kwargs):
 */
  __pyx_t_10 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__14); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_9 = __Pyx_Py3MetaclassPrepare(__pyx_t_10, __pyx_tuple__14, __pyx_n_s_Block, __pyx_n_s_Block, (PyObject *) NULL, __pyx_n_s_dragnet_blocks, (PyObject *) NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);

  /* "dragnet/blocks.pyx":137
 * 
 * class Block(object):
 *     def __init__(self, text, link_density, text_density,             # <<<<<<<<<<<<<<
 *             anchors, link_tokens, css, **kwargs):
 *         self.text = text
 */
  __pyx_t_8 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7dragnet_6blocks_5Block_1__init__, 0, __pyx_n_s_Block___init, NULL, __pyx_n_s_dragnet_blocks, __pyx_d, ((PyObject *)__pyx_codeobj__16)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 137, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (__Pyx_SetNameInClass(__pyx_t_9, __pyx_n_s_init, __pyx_t_8) < 0) __PYX_ERR(0, 137, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "dragnet/blocks.pyx":136
 * 
 * 
 * class Block(object):             # <<<<<<<<<<<<<<
 *     def __init__(self, text, link_density, text_density,
 *             anchors, link_tokens, css, **kwargs):
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_10, __pyx_n_s_Block, __pyx_tuple__14, __pyx_t_9, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Block, __pyx_t_8) < 0) __PYX_ERR(0, 136, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "dragnet/blocks.pyx":148
 * 
 * 
 * class BlockifyError(Exception):             # <<<<<<<<<<<<<<
 *     """Raised when there is a fatal problem in blockify
 *     (if lxml fails to parse the document)
 */
  __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_INCREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
  __Pyx_GIVEREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
  PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
  __pyx_t_9 = __Pyx_CalculateMetaclass(NULL, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_8 = __Pyx_Py3MetaclassPrepare(__pyx_t_9, __pyx_t_10, __pyx_n_s_BlockifyError, __pyx_n_s_BlockifyError, (PyObject *) NULL, __pyx_n_s_dragnet_blocks, __pyx_kp_s_Raised_when_there_is_a_fatal_pro); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_9, __pyx_n_s_BlockifyError, __pyx_t_10, __pyx_t_8, NULL, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_BlockifyError, __pyx_t_1) < 0) __PYX_ERR(0, 148, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "dragnet/blocks.pyx":219
 * 
 * 
 * def text_from_subtree(tree, tags_exclude=set(), tail=True, callback=None):             # <<<<<<<<<<<<<<
 *     """Get all the text
 *     from the subtree, excluding tags_exclude
 */
  __pyx_t_10 = PySet_New(0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 219, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_k_ = __pyx_t_10;
  __Pyx_GIVEREF(__pyx_t_10);
  __pyx_t_10 = 0;
  __pyx_t_10 = PyCFunction_NewEx(&__pyx_mdef_7dragnet_6blocks_3text_from_subtree, NULL, __pyx_n_s_dragnet_blocks); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 219, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_text_from_subtree, __pyx_t_10) < 0) __PYX_ERR(0, 219, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "dragnet/blocks.pyx":777
 * 
 * 
 * def guess_encoding(markup, default='utf-8'):             # <<<<<<<<<<<<<<
 *     """
 *     Try to guess the encoding of ``markup`` by checking the XML declaration
 */
  __pyx_t_10 = PyCFunction_NewEx(&__pyx_mdef_7dragnet_6blocks_5guess_encoding, NULL, __pyx_n_s_dragnet_blocks); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 777, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_guess_encoding, __pyx_t_10) < 0) __PYX_ERR(0, 777, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "dragnet/blocks.pyx":798
 * 
 * 
 * class Blockifier(object):             # <<<<<<<<<<<<<<
 *     """
 *     A blockifier for web-page de-chroming that loosely follows the approach in
 */
  __pyx_t_10 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__21); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 798, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_9 = __Pyx_Py3MetaclassPrepare(__pyx_t_10, __pyx_tuple__21, __pyx_n_s_Blockifier, __pyx_n_s_Blockifier, (PyObject *) NULL, __pyx_n_s_dragnet_blocks, __pyx_kp_s_A_blockifier_for_web_page_de_ch); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 798, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);

  /* "dragnet/blocks.pyx":807
 * 
 *     @staticmethod
 *     def blocks_from_tree(tree, pb=PartialBlock, do_css=True, do_readability=False):             # <<<<<<<<<<<<<<
 *         cdef list results = []
 *         cdef cetree._Element ctree
 */
  __pyx_t_8 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7dragnet_6blocks_10Blockifier_1blocks_from_tree, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_Blockifier_blocks_from_tree, NULL, __pyx_n_s_dragnet_blocks, __pyx_d, ((PyObject *)__pyx_codeobj__23)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 807, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (!__Pyx_CyFunction_InitDefaults(__pyx_t_8, sizeof(__pyx_defaults), 1)) __PYX_ERR(0, 807, __pyx_L1_error)
  __Pyx_INCREF(((PyObject *)__pyx_ptype_7dragnet_6blocks_PartialBlock));
  __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_8)->__pyx_arg_pb = ((PyObject *)__pyx_ptype_7dragnet_6blocks_PartialBlock);
  __Pyx_GIVEREF(__pyx_ptype_7dragnet_6blocks_PartialBlock);
  __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_8, __pyx_pf_7dragnet_6blocks_6__defaults__);

  /* "dragnet/blocks.pyx":806
 *     """
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def blocks_from_tree(tree, pb=PartialBlock, do_css=True, do_readability=False):
 *         cdef list results = []
 */
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 806, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_9, __pyx_n_s_blocks_from_tree, __pyx_t_1) < 0) __PYX_ERR(0, 807, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "dragnet/blocks.pyx":821
 * 
 *     @staticmethod
 *     def blockify(s, encoding=None,             # <<<<<<<<<<<<<<
 *                  pb=PartialBlock, do_css=True, do_readability=False,
 *                  parse_callback=None):
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7dragnet_6blocks_10Blockifier_3blockify, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_Blockifier_blockify, NULL, __pyx_n_s_dragnet_blocks, __pyx_d, ((PyObject *)__pyx_codeobj__25)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!__Pyx_CyFunction_InitDefaults(__pyx_t_1, sizeof(__pyx_defaults1), 1)) __PYX_ERR(0, 821, __pyx_L1_error)

  /* "dragnet/blocks.pyx":822
 *     @staticmethod
 *     def blockify(s, encoding=None,
 *                  pb=PartialBlock, do_css=True, do_readability=False,             # <<<<<<<<<<<<<<
 *                  parse_callback=None):
 *         """
 */
  __Pyx_INCREF(((PyObject *)__pyx_ptype_7dragnet_6blocks_PartialBlock));
  __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_t_1)->__pyx_arg_pb = ((PyObject *)__pyx_ptype_7dragnet_6blocks_PartialBlock);
  __Pyx_GIVEREF(__pyx_ptype_7dragnet_6blocks_PartialBlock);
  __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_1, __pyx_pf_7dragnet_6blocks_8__defaults__);

  /* "dragnet/blocks.pyx":820
 *         return results
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def blockify(s, encoding=None,
 *                  pb=PartialBlock, do_css=True, do_readability=False,
 */
  __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_9, __pyx_n_s_blockify, __pyx_t_8) < 0) __PYX_ERR(0, 821, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "dragnet/blocks.pyx":798
 * 
 * 
 * class Blockifier(object):             # <<<<<<<<<<<<<<
 *     """
 *     A blockifier for web-page de-chroming that loosely follows the approach in
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_10, __pyx_n_s_Blockifier, __pyx_tuple__21, __pyx_t_9, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 798, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Blockifier, __pyx_t_8) < 0) __PYX_ERR(0, 798, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "dragnet/blocks.pyx":863
 * 
 * 
 * class TagCountBlockifier(Blockifier):             # <<<<<<<<<<<<<<
 *     @staticmethod
 *     def blockify(s, encoding=None, parse_callback=None):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_Blockifier); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 863, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 863, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_10);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10);
  __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_CalculateMetaclass(NULL, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 863, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_8 = __Pyx_Py3MetaclassPrepare(__pyx_t_10, __pyx_t_9, __pyx_n_s_TagCountBlockifier, __pyx_n_s_TagCountBlockifier, (PyObject *) NULL, __pyx_n_s_dragnet_blocks, (PyObject *) NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 863, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);

  /* "dragnet/blocks.pyx":865
 * class TagCountBlockifier(Blockifier):
 *     @staticmethod
 *     def blockify(s, encoding=None, parse_callback=None):             # <<<<<<<<<<<<<<
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,
 *                                    do_css=True, do_readability=False,
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7dragnet_6blocks_18TagCountBlockifier_1blockify, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_TagCountBlockifier_blockify, NULL, __pyx_n_s_dragnet_blocks, __pyx_d, ((PyObject *)__pyx_codeobj__27)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 865, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__28);

  /* "dragnet/blocks.pyx":864
 * 
 * class TagCountBlockifier(Blockifier):
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def blockify(s, encoding=None, parse_callback=None):
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,
 */
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 864, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_8, __pyx_n_s_blockify, __pyx_t_5) < 0) __PYX_ERR(0, 865, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "dragnet/blocks.pyx":863
 * 
 * 
 * class TagCountBlockifier(Blockifier):             # <<<<<<<<<<<<<<
 *     @staticmethod
 *     def blockify(s, encoding=None, parse_callback=None):
 */
  __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_10, __pyx_n_s_TagCountBlockifier, __pyx_t_9, __pyx_t_8, NULL, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 863, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_TagCountBlockifier, __pyx_t_5) < 0) __PYX_ERR(0, 863, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "dragnet/blocks.pyx":870
 *                                    parse_callback=parse_callback)
 * 
 * class TagCountNoCSSBlockifier(Blockifier):             # <<<<<<<<<<<<<<
 *     @staticmethod
 *     def blockify(s, encoding=None, parse_callback=None):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_Blockifier); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 870, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 870, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9);
  __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_CalculateMetaclass(NULL, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 870, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_8 = __Pyx_Py3MetaclassPrepare(__pyx_t_9, __pyx_t_10, __pyx_n_s_TagCountNoCSSBlockifier, __pyx_n_s_TagCountNoCSSBlockifier, (PyObject *) NULL, __pyx_n_s_dragnet_blocks, (PyObject *) NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 870, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);

  /* "dragnet/blocks.pyx":872
 * class TagCountNoCSSBlockifier(Blockifier):
 *     @staticmethod
 *     def blockify(s, encoding=None, parse_callback=None):             # <<<<<<<<<<<<<<
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,
 *                                    do_css=False, do_readability=False,
 */
  __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7dragnet_6blocks_23TagCountNoCSSBlockifier_1blockify, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_TagCountNoCSSBlockifier_blockify, NULL, __pyx_n_s_dragnet_blocks, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 872, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__31);

  /* "dragnet/blocks.pyx":871
 * 
 * class TagCountNoCSSBlockifier(Blockifier):
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def blockify(s, encoding=None, parse_callback=None):
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,
 */
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_8, __pyx_n_s_blockify, __pyx_t_1) < 0) __PYX_ERR(0, 872, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "dragnet/blocks.pyx":870
 *                                    parse_callback=parse_callback)
 * 
 * class TagCountNoCSSBlockifier(Blockifier):             # <<<<<<<<<<<<<<
 *     @staticmethod
 *     def blockify(s, encoding=None, parse_callback=None):
 */
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_9, __pyx_n_s_TagCountNoCSSBlockifier, __pyx_t_10, __pyx_t_8, NULL, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 870, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_TagCountNoCSSBlockifier, __pyx_t_1) < 0) __PYX_ERR(0, 870, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "dragnet/blocks.pyx":877
 *                                    parse_callback=parse_callback)
 * 
 * class TagCountReadabilityBlockifier(Blockifier):             # <<<<<<<<<<<<<<
 *     @staticmethod
 *     def blockify(s, encoding=None, parse_callback=None):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_Blockifier); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_10);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10);
  __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_CalculateMetaclass(NULL, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_8 = __Pyx_Py3MetaclassPrepare(__pyx_t_10, __pyx_t_9, __pyx_n_s_TagCountReadabilityBlockifier, __pyx_n_s_TagCountReadabilityBlockifier, (PyObject *) NULL, __pyx_n_s_dragnet_blocks, (PyObject *) NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);

  /* "dragnet/blocks.pyx":879
 * class TagCountReadabilityBlockifier(Blockifier):
 *     @staticmethod
 *     def blockify(s, encoding=None, parse_callback=None):             # <<<<<<<<<<<<<<
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,
 *                                    do_css=True, do_readability=True,
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7dragnet_6blocks_29TagCountReadabilityBlockifier_1blockify, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_TagCountReadabilityBlockifier_bl, NULL, __pyx_n_s_dragnet_blocks, __pyx_d, ((PyObject *)__pyx_codeobj__33)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 879, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__34);

  /* "dragnet/blocks.pyx":878
 * 
 * class TagCountReadabilityBlockifier(Blockifier):
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def blockify(s, encoding=None, parse_callback=None):
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,
 */
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 878, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_8, __pyx_n_s_blockify, __pyx_t_5) < 0) __PYX_ERR(0, 879, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "dragnet/blocks.pyx":877
 *                                    parse_callback=parse_callback)
 * 
 * class TagCountReadabilityBlockifier(Blockifier):             # <<<<<<<<<<<<<<
 *     @staticmethod
 *     def blockify(s, encoding=None, parse_callback=None):
 */
  __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_10, __pyx_n_s_TagCountReadabilityBlockifier, __pyx_t_9, __pyx_t_8, NULL, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_TagCountReadabilityBlockifier, __pyx_t_5) < 0) __PYX_ERR(0, 877, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "dragnet/blocks.pyx":884
 *                                    parse_callback=parse_callback)
 * 
 * class TagCountNoCSSReadabilityBlockifier(Blockifier):             # <<<<<<<<<<<<<<
 *     @staticmethod
 *     def blockify(s, encoding=None, parse_callback=None):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_Blockifier); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9);
  __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_CalculateMetaclass(NULL, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_8 = __Pyx_Py3MetaclassPrepare(__pyx_t_9, __pyx_t_10, __pyx_n_s_TagCountNoCSSReadabilityBlockifi, __pyx_n_s_TagCountNoCSSReadabilityBlockifi, (PyObject *) NULL, __pyx_n_s_dragnet_blocks, (PyObject *) NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);

  /* "dragnet/blocks.pyx":886
 * class TagCountNoCSSReadabilityBlockifier(Blockifier):
 *     @staticmethod
 *     def blockify(s, encoding=None, parse_callback=None):             # <<<<<<<<<<<<<<
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,
 *                                    do_css=False, do_readability=True,
 */
  __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7dragnet_6blocks_34TagCountNoCSSReadabilityBlockifier_1blockify, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_TagCountNoCSSReadabilityBlockifi_2, NULL, __pyx_n_s_dragnet_blocks, __pyx_d, ((PyObject *)__pyx_codeobj__36)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 886, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__37);

  /* "dragnet/blocks.pyx":885
 * 
 * class TagCountNoCSSReadabilityBlockifier(Blockifier):
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def blockify(s, encoding=None, parse_callback=None):
 *         return Blockifier.blockify(s, encoding=encoding, pb=TagCountPB,
 */
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 885, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_8, __pyx_n_s_blockify, __pyx_t_1) < 0) __PYX_ERR(0, 886, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "dragnet/blocks.pyx":884
 *                                    parse_callback=parse_callback)
 * 
 * class TagCountNoCSSReadabilityBlockifier(Blockifier):             # <<<<<<<<<<<<<<
 *     @staticmethod
 *     def blockify(s, encoding=None, parse_callback=None):
 */
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_9, __pyx_n_s_TagCountNoCSSReadabilityBlockifi, __pyx_t_10, __pyx_t_8, NULL, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_TagCountNoCSSReadabilityBlockifi, __pyx_t_1) < 0) __PYX_ERR(0, 884, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "dragnet/blocks.pyx":1
 * """             # <<<<<<<<<<<<<<
 * Implementation of the blockifier interface and some classes
 * to manipulate blocks
 */
  __pyx_t_10 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_10) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_string")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_string(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */

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

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init dragnet.blocks", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_CLEAR(__pyx_m);
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init dragnet.blocks");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  return (__pyx_m != NULL) ? 0 : -1;
  #elif PY_MAJOR_VERSION >= 3
  return __pyx_m;
  #else
  return;
  #endif
}

/* --- Runtime support code --- */
/* Refnanny */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule(modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, "RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

/* PyObjectGetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_getattr))
        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
    return PyObject_GetAttr(obj, attr_name);
}
#endif

/* GetBuiltinName */
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
    if (unlikely(!result)) {
        PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
            "name '%U' is not defined", name);
#else
            "name '%.200s' is not defined", PyString_AS_STRING(name));
#endif
    }
    return result;
}

/* PyDictVersioning */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
    PyObject **dictptr = NULL;
    Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
    if (offset) {
#if CYTHON_COMPILING_IN_CPYTHON
        dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
#else
        dictptr = _PyObject_GetDictPtr(obj);
#endif
    }
    return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
}
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
        return 0;
    return obj_dict_version == __Pyx_get_object_dict_version(obj);
}
#endif

/* GetModuleGlobalName */
#if CYTHON_USE_DICT_VERSIONS
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
#else
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
#endif
{
    PyObject *result;
#if !CYTHON_AVOID_BORROWED_REFS
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
    result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    } else if (unlikely(PyErr_Occurred())) {
        return NULL;
    }
#else
    result = PyDict_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
#endif
#else
    result = PyObject_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
    PyErr_Clear();
#endif
    return __Pyx_GetBuiltinName(name);
}

/* PyCFunctionFastCall */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
    PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
    PyObject *self = PyCFunction_GET_SELF(func);
    int flags = PyCFunction_GET_FLAGS(func);
    assert(PyCFunction_Check(func));
    assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
    assert(nargs >= 0);
    assert(nargs == 0 || args != NULL);
    /* _PyCFunction_FastCallDict() must not be called with an exception set,
       because it may clear it (directly or indirectly) and so the
       caller loses its exception */
    assert(!PyErr_Occurred());
    if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
        return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
    } else {
        return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
    }
}
#endif

/* PyFunctionFastCall */
#if CYTHON_FAST_PYCALL
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
                                               PyObject *globals) {
    PyFrameObject *f;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject **fastlocals;
    Py_ssize_t i;
    PyObject *result;
    assert(globals != NULL);
    /* XXX Perhaps we should create a specialized
       PyFrame_New() that doesn't take locals, but does
       take builtins without sanity checking them.
       */
    assert(tstate != NULL);
    f = PyFrame_New(tstate, co, globals, NULL);
    if (f == NULL) {
        return NULL;
    }
    fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
    for (i = 0; i < na; i++) {
        Py_INCREF(*args);
        fastlocals[i] = *args++;
    }
    result = PyEval_EvalFrameEx(f,0);
    ++tstate->recursion_depth;
    Py_DECREF(f);
    --tstate->recursion_depth;
    return result;
}
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) {
    PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
    PyObject *globals = PyFunction_GET_GLOBALS(func);
    PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
    PyObject *closure;
#if PY_MAJOR_VERSION >= 3
    PyObject *kwdefs;
#endif
    PyObject *kwtuple, **k;
    PyObject **d;
    Py_ssize_t nd;
    Py_ssize_t nk;
    PyObject *result;
    assert(kwargs == NULL || PyDict_Check(kwargs));
    nk = kwargs ? PyDict_Size(kwargs) : 0;
    if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
        return NULL;
    }
    if (
#if PY_MAJOR_VERSION >= 3
            co->co_kwonlyargcount == 0 &&
#endif
            likely(kwargs == NULL || nk == 0) &&
            co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
        if (argdefs == NULL && co->co_argcount == nargs) {
            result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
            goto done;
        }
        else if (nargs == 0 && argdefs != NULL
                 && co->co_argcount == Py_SIZE(argdefs)) {
            /* function called with no arguments, but all parameters have
               a default value: use default values as arguments .*/
            args = &PyTuple_GET_ITEM(argdefs, 0);
            result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
            goto done;
        }
    }
    if (kwargs != NULL) {
        Py_ssize_t pos, i;
        kwtuple = PyTuple_New(2 * nk);
        if (kwtuple == NULL) {
            result = NULL;
            goto done;
        }
        k = &PyTuple_GET_ITEM(kwtuple, 0);
        pos = i = 0;
        while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
            Py_INCREF(k[i]);
            Py_INCREF(k[i+1]);
            i += 2;
        }
        nk = i / 2;
    }
    else {
        kwtuple = NULL;
        k = NULL;
    }
    closure = PyFunction_GET_CLOSURE(func);
#if PY_MAJOR_VERSION >= 3
    kwdefs = PyFunction_GET_KW_DEFAULTS(func);
#endif
    if (argdefs != NULL) {
        d = &PyTuple_GET_ITEM(argdefs, 0);
        nd = Py_SIZE(argdefs);
    }
    else {
        d = NULL;
        nd = 0;
    }
#if PY_MAJOR_VERSION >= 3
    result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
                               args, nargs,
                               k, (int)nk,
                               d, (int)nd, kwdefs, closure);
#else
    result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
                               args, nargs,
                               k, (int)nk,
                               d, (int)nd, closure);
#endif
    Py_XDECREF(kwtuple);
done:
    Py_LeaveRecursiveCall();
    return result;
}
#endif
#endif

/* PyObjectCall */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = func->ob_type->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCall2Args */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
    PyObject *args, *result = NULL;
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyFunction_FastCall(function, args, 2);
    }
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyCFunction_FastCall(function, args, 2);
    }
    #endif
    args = PyTuple_New(2);
    if (unlikely(!args)) goto done;
    Py_INCREF(arg1);
    PyTuple_SET_ITEM(args, 0, arg1);
    Py_INCREF(arg2);
    PyTuple_SET_ITEM(args, 1, arg2);
    Py_INCREF(function);
    result = __Pyx_PyObject_Call(function, args, NULL);
    Py_DECREF(args);
    Py_DECREF(function);
done:
    return result;
}

/* PyObjectCallMethO */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = PyCFunction_GET_FUNCTION(func);
    self = PyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCallOneArg */
#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_New(1);
    if (unlikely(!args)) return NULL;
    Py_INCREF(arg);
    PyTuple_SET_ITEM(args, 0, arg);
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, &arg, 1);
    }
#endif
    if (likely(PyCFunction_Check(func))) {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
#if CYTHON_FAST_PYCCALL
        } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
            return __Pyx_PyCFunction_FastCall(func, &arg, 1);
#endif
        }
    }
    return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_Pack(1, arg);
    if (unlikely(!args)) return NULL;
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
#endif

/* PyErrFetchRestore */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
}
#endif

/* WriteUnraisableException */
static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
                                  int full_traceback, CYTHON_UNUSED int nogil) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_PyThreadState_declare
#ifdef WITH_THREAD
    PyGILState_STATE state;
    if (nogil)
        state = PyGILState_Ensure();
#ifdef _MSC_VER
    else state = (PyGILState_STATE)-1;
#endif
#endif
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    if (full_traceback) {
        Py_XINCREF(old_exc);
        Py_XINCREF(old_val);
        Py_XINCREF(old_tb);
        __Pyx_ErrRestore(old_exc, old_val, old_tb);
        PyErr_PrintEx(1);
    }
    #if PY_MAJOR_VERSION < 3
    ctx = PyString_FromString(name);
    #else
    ctx = PyUnicode_FromString(name);
    #endif
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
#ifdef WITH_THREAD
    if (nogil)
        PyGILState_Release(state);
#endif
}

/* RaiseArgTupleInvalid */
static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *more_or_less;
    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

/* RaiseDoubleKeywords */
static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AsString(kw_name));
        #endif
}

/* ParseKeywords */
static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
            while (*name) {
                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                        && _PyString_Eq(**name, key)) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    if ((**argname == key) || (
                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
                             && _PyString_Eq(**argname, key))) {
                        goto arg_passed_twice;
                    }
                    argname++;
                }
            }
        } else
        #endif
        if (likely(PyUnicode_Check(key))) {
            while (*name) {
                int cmp = (**name == key) ? 0 :
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key);
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

/* PyObjectSetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_setattro))
        return tp->tp_setattro(obj, attr_name, value);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_setattr))
        return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
#endif
    return PyObject_SetAttr(obj, attr_name, value);
}
#endif

/* GetTopmostException */
#if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
{
    _PyErr_StackItem *exc_info = tstate->exc_info;
    while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
           exc_info->previous_item != NULL)
    {
        exc_info = exc_info->previous_item;
    }
    return exc_info;
}
#endif

/* SaveResetException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    *type = exc_info->exc_type;
    *value = exc_info->exc_value;
    *tb = exc_info->exc_traceback;
    #else
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    #endif
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
}
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = type;
    exc_info->exc_value = value;
    exc_info->exc_traceback = tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
#endif

/* PyErrExceptionMatches */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
    PyObject *exc_type = tstate->curexc_type;
    if (exc_type == err) return 1;
    if (unlikely(!exc_type)) return 0;
    if (unlikely(PyTuple_Check(err)))
        return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
    return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
}
#endif

/* GetException */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
#endif
{
    PyObject *local_type, *local_value, *local_tb;
#if CYTHON_FAST_THREAD_STATE
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_FAST_THREAD_STATE
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (local_tb) {
        if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
            goto bad;
    }
    #endif
    Py_XINCREF(local_tb);
    Py_XINCREF(local_type);
    Py_XINCREF(local_value);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_FAST_THREAD_STATE
    #if CYTHON_USE_EXC_INFO_STACK
    {
        _PyErr_StackItem *exc_info = tstate->exc_info;
        tmp_type = exc_info->exc_type;
        tmp_value = exc_info->exc_value;
        tmp_tb = exc_info->exc_traceback;
        exc_info->exc_type = local_type;
        exc_info->exc_value = local_value;
        exc_info->exc_traceback = local_tb;
    }
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
}

/* PyObjectCallNoArg */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, NULL, 0);
    }
#endif
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
#else
    if (likely(PyCFunction_Check(func)))
#endif
    {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
            return __Pyx_PyObject_CallMethO(func, NULL);
        }
    }
    return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
}
#endif

/* KeywordStringCheck */
static int __Pyx_CheckKeywordStrings(
    PyObject *kwdict,
    const char* function_name,
    int kw_allowed)
{
    PyObject* key = 0;
    Py_ssize_t pos = 0;
#if CYTHON_COMPILING_IN_PYPY
    if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
        goto invalid_keyword;
    return 1;
#else
    while (PyDict_Next(kwdict, &pos, &key, 0)) {
        #if PY_MAJOR_VERSION < 3
        if (unlikely(!PyString_Check(key)))
        #endif
            if (unlikely(!PyUnicode_Check(key)))
                goto invalid_keyword_type;
    }
    if ((!kw_allowed) && unlikely(key))
        goto invalid_keyword;
    return 1;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    return 0;
#endif
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
    return 0;
}

/* StringJoin */
#if !CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) {
    return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL);
}
#endif

/* PyIntCompare */
static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) {
    if (op1 == op2) {
        Py_RETURN_TRUE;
    }
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long a = PyInt_AS_LONG(op1);
        if (a == b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        int unequal;
        unsigned long uintval;
        Py_ssize_t size = Py_SIZE(op1);
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        if (intval == 0) {
            if (size == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
        } else if (intval < 0) {
            if (size >= 0)
                Py_RETURN_FALSE;
            intval = -intval;
            size = -size;
        } else {
            if (size <= 0)
                Py_RETURN_FALSE;
        }
        uintval = (unsigned long) intval;
#if PyLong_SHIFT * 4 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 4)) {
            unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 3 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 3)) {
            unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 2 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 2)) {
            unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 1 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 1)) {
            unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
            unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
        if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
        if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    return (
        PyObject_RichCompare(op1, op2, Py_EQ));
}

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a - b);
            if (likely((x^a) >= 0 || (x^~b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
            }
        }
                x = a - b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla - llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("subtract", return NULL)
            result = ((double)a) - (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
}
#endif

/* SliceObject */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
        Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
        int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
#if CYTHON_USE_TYPE_SLOTS
    PyMappingMethods* mp;
#if PY_MAJOR_VERSION < 3
    PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
    if (likely(ms && ms->sq_slice)) {
        if (!has_cstart) {
            if (_py_start && (*_py_start != Py_None)) {
                cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
                if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstart = 0;
        }
        if (!has_cstop) {
            if (_py_stop && (*_py_stop != Py_None)) {
                cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
                if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstop = PY_SSIZE_T_MAX;
        }
        if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
            Py_ssize_t l = ms->sq_length(obj);
            if (likely(l >= 0)) {
                if (cstop < 0) {
                    cstop += l;
                    if (cstop < 0) cstop = 0;
                }
                if (cstart < 0) {
                    cstart += l;
                    if (cstart < 0) cstart = 0;
                }
            } else {
                if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                    goto bad;
                PyErr_Clear();
            }
        }
        return ms->sq_slice(obj, cstart, cstop);
    }
#endif
    mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_subscript))
#endif
    {
        PyObject* result;
        PyObject *py_slice, *py_start, *py_stop;
        if (_py_slice) {
            py_slice = *_py_slice;
        } else {
            PyObject* owned_start = NULL;
            PyObject* owned_stop = NULL;
            if (_py_start) {
                py_start = *_py_start;
            } else {
                if (has_cstart) {
                    owned_start = py_start = PyInt_FromSsize_t(cstart);
                    if (unlikely(!py_start)) goto bad;
                } else
                    py_start = Py_None;
            }
            if (_py_stop) {
                py_stop = *_py_stop;
            } else {
                if (has_cstop) {
                    owned_stop = py_stop = PyInt_FromSsize_t(cstop);
                    if (unlikely(!py_stop)) {
                        Py_XDECREF(owned_start);
                        goto bad;
                    }
                } else
                    py_stop = Py_None;
            }
            py_slice = PySlice_New(py_start, py_stop, Py_None);
            Py_XDECREF(owned_start);
            Py_XDECREF(owned_stop);
            if (unlikely(!py_slice)) goto bad;
        }
#if CYTHON_USE_TYPE_SLOTS
        result = mp->mp_subscript(obj, py_slice);
#else
        result = PyObject_GetItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    PyErr_Format(PyExc_TypeError,
        "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
bad:
    return NULL;
}

/* PyFloatBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_SubtractObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
    const double b = floatval;
    double a, result;
    (void)inplace;
    (void)zerodivision_check;
    if (likely(PyFloat_CheckExact(op1))) {
        a = PyFloat_AS_DOUBLE(op1);
        
    } else
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        a = (double) PyInt_AS_LONG(op1);
        
    } else
    #endif
    if (likely(PyLong_CheckExact(op1))) {
        #if CYTHON_USE_PYLONG_INTERNALS
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        switch (size) {
            case  0: a = 0.0; break;
            case -1: a = -(double) digits[0]; break;
            case  1: a = (double) digits[0]; break;
            case -2:
            case 2:
                if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
                    a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -2)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -3:
            case 3:
                if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
                    a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -3)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -4:
            case 4:
                if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
                    a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -4)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            default:
        #else
        {
        #endif
            a = PyLong_AsDouble(op1);
            if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL;
            
        }
    } else {
        return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
    }
        
        PyFPE_START_PROTECT("subtract", return NULL)
        result = a - b;
        PyFPE_END_PROTECT(result)
        return PyFloat_FromDouble(result);
}
#endif

/* RaiseException */
  #if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    __Pyx_PyThreadState_declare
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    if (PyType_Check(type)) {
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        type = (PyObject*) Py_TYPE(type);
        Py_INCREF(type);
        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: exception class must be a subclass of BaseException");
            goto raise_error;
        }
    }
    __Pyx_PyThreadState_assign
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *instance_class = NULL;
        if (value && PyExceptionInstance_Check(value)) {
            instance_class = (PyObject*) Py_TYPE(value);
            if (instance_class != type) {
                int is_subclass = PyObject_IsSubclass(instance_class, type);
                if (!is_subclass) {
                    instance_class = NULL;
                } else if (unlikely(is_subclass == -1)) {
                    goto bad;
                } else {
                    type = instance_class;
                }
            }
        }
        if (!instance_class) {
            PyObject *args;
            if (!value)
                args = PyTuple_New(0);
            else if (PyTuple_Check(value)) {
                Py_INCREF(value);
                args = value;
            } else
                args = PyTuple_Pack(1, value);
            if (!args)
                goto bad;
            owned_instance = PyObject_Call(type, args, NULL);
            Py_DECREF(args);
            if (!owned_instance)
                goto bad;
            value = owned_instance;
            if (!PyExceptionInstance_Check(value)) {
                PyErr_Format(PyExc_TypeError,
                             "calling %R should have returned an instance of "
                             "BaseException, not %R",
                             type, Py_TYPE(value));
                goto bad;
            }
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
    if (cause) {
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
#if CYTHON_COMPILING_IN_PYPY
        PyObject *tmp_type, *tmp_value, *tmp_tb;
        PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
        Py_INCREF(tb);
        PyErr_Restore(tmp_type, tmp_value, tb);
        Py_XDECREF(tmp_tb);
#else
        PyThreadState *tstate = __Pyx_PyThreadState_Current;
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
#endif
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

/* PyIntFromDouble */
  #if PY_MAJOR_VERSION < 3
static CYTHON_INLINE PyObject* __Pyx_PyInt_FromDouble(double value) {
    if (value >= (double)LONG_MIN && value <= (double)LONG_MAX) {
        return PyInt_FromLong((long)value);
    }
    return PyLong_FromDouble(value);
}
#endif

/* BytesEquals */
  static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        const char *ps1, *ps2;
        Py_ssize_t length = PyBytes_GET_SIZE(s1);
        if (length != PyBytes_GET_SIZE(s2))
            return (equals == Py_NE);
        ps1 = PyBytes_AS_STRING(s1);
        ps2 = PyBytes_AS_STRING(s2);
        if (ps1[0] != ps2[0]) {
            return (equals == Py_NE);
        } else if (length == 1) {
            return (equals == Py_EQ);
        } else {
            int result;
#if CYTHON_USE_UNICODE_INTERNALS
            Py_hash_t hash1, hash2;
            hash1 = ((PyBytesObject*)s1)->ob_shash;
            hash2 = ((PyBytesObject*)s2)->ob_shash;
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                return (equals == Py_NE);
            }
#endif
            result = memcmp(ps1, ps2, (size_t)length);
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
#endif
}

/* UnicodeEquals */
  static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
#if PY_MAJOR_VERSION < 3
    PyObject* owned_ref = NULL;
#endif
    int s1_is_unicode, s2_is_unicode;
    if (s1 == s2) {
        goto return_eq;
    }
    s1_is_unicode = PyUnicode_CheckExact(s1);
    s2_is_unicode = PyUnicode_CheckExact(s2);
#if PY_MAJOR_VERSION < 3
    if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
        owned_ref = PyUnicode_FromObject(s2);
        if (unlikely(!owned_ref))
            return -1;
        s2 = owned_ref;
        s2_is_unicode = 1;
    } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
        owned_ref = PyUnicode_FromObject(s1);
        if (unlikely(!owned_ref))
            return -1;
        s1 = owned_ref;
        s1_is_unicode = 1;
    } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
        return __Pyx_PyBytes_Equals(s1, s2, equals);
    }
#endif
    if (s1_is_unicode & s2_is_unicode) {
        Py_ssize_t length;
        int kind;
        void *data1, *data2;
        if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
            return -1;
        length = __Pyx_PyUnicode_GET_LENGTH(s1);
        if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
            goto return_ne;
        }
#if CYTHON_USE_UNICODE_INTERNALS
        {
            Py_hash_t hash1, hash2;
        #if CYTHON_PEP393_ENABLED
            hash1 = ((PyASCIIObject*)s1)->hash;
            hash2 = ((PyASCIIObject*)s2)->hash;
        #else
            hash1 = ((PyUnicodeObject*)s1)->hash;
            hash2 = ((PyUnicodeObject*)s2)->hash;
        #endif
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                goto return_ne;
            }
        }
#endif
        kind = __Pyx_PyUnicode_KIND(s1);
        if (kind != __Pyx_PyUnicode_KIND(s2)) {
            goto return_ne;
        }
        data1 = __Pyx_PyUnicode_DATA(s1);
        data2 = __Pyx_PyUnicode_DATA(s2);
        if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
            goto return_ne;
        } else if (length == 1) {
            goto return_eq;
        } else {
            int result = memcmp(data1, data2, (size_t)(length * kind));
            #if PY_MAJOR_VERSION < 3
            Py_XDECREF(owned_ref);
            #endif
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & s2_is_unicode) {
        goto return_ne;
    } else if ((s2 == Py_None) & s1_is_unicode) {
        goto return_ne;
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        #if PY_MAJOR_VERSION < 3
        Py_XDECREF(owned_ref);
        #endif
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
return_eq:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_EQ);
return_ne:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_NE);
#endif
}

/* Import */
  static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    #if PY_MAJOR_VERSION < 3
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
    if (!py_import)
        goto bad;
    #endif
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if (strchr(__Pyx_MODULE_NAME, '.')) {
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_MAJOR_VERSION < 3
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
bad:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

/* DictGetItem */
  #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred()) {
            if (unlikely(PyTuple_Check(key))) {
                PyObject* args = PyTuple_Pack(1, key);
                if (likely(args)) {
                    PyErr_SetObject(PyExc_KeyError, args);
                    Py_DECREF(args);
                }
            } else {
                PyErr_SetObject(PyExc_KeyError, key);
            }
        }
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#endif

/* ExtTypeTest */
  static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(__Pyx_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

/* PyObject_GenericGetAttrNoDict */
  #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'%.50s' object has no attribute '%U'",
                 tp->tp_name, attr_name);
#else
                 "'%.50s' object has no attribute '%.400s'",
                 tp->tp_name, PyString_AS_STRING(attr_name));
#endif
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
    PyObject *descr;
    PyTypeObject *tp = Py_TYPE(obj);
    if (unlikely(!PyString_Check(attr_name))) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    assert(!tp->tp_dictoffset);
    descr = _PyType_Lookup(tp, attr_name);
    if (unlikely(!descr)) {
        return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
    }
    Py_INCREF(descr);
    #if PY_MAJOR_VERSION < 3
    if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
    #endif
    {
        descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
        if (unlikely(f)) {
            PyObject *res = f(descr, obj, (PyObject *)tp);
            Py_DECREF(descr);
            return res;
        }
    }
    return descr;
}
#endif

/* PyObject_GenericGetAttr */
  #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
    if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
}
#endif

/* SetVTable */
  static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX >= 0x02070000
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
    if (!ob)
        goto bad;
    if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

/* SetupReduce */
  static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
  int ret;
  PyObject *name_attr;
  name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name);
  if (likely(name_attr)) {
      ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
  } else {
      ret = -1;
  }
  if (unlikely(ret < 0)) {
      PyErr_Clear();
      ret = 0;
  }
  Py_XDECREF(name_attr);
  return ret;
}
static int __Pyx_setup_reduce(PyObject* type_obj) {
    int ret = 0;
    PyObject *object_reduce = NULL;
    PyObject *object_reduce_ex = NULL;
    PyObject *reduce = NULL;
    PyObject *reduce_ex = NULL;
    PyObject *reduce_cython = NULL;
    PyObject *setstate = NULL;
    PyObject *setstate_cython = NULL;
#if CYTHON_USE_PYTYPE_LOOKUP
    if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto GOOD;
#else
    if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto GOOD;
#endif
#if CYTHON_USE_PYTYPE_LOOKUP
    object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
#else
    object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
#endif
    reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto BAD;
    if (reduce_ex == object_reduce_ex) {
#if CYTHON_USE_PYTYPE_LOOKUP
        object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
#else
        object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
#endif
        reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto BAD;
        if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
            reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_cython); if (unlikely(!reduce_cython)) goto BAD;
            ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto BAD;
            ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto BAD;
            setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
            if (!setstate) PyErr_Clear();
            if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
                setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate_cython); if (unlikely(!setstate_cython)) goto BAD;
                ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto BAD;
                ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto BAD;
            }
            PyType_Modified((PyTypeObject*)type_obj);
        }
    }
    goto GOOD;
BAD:
    if (!PyErr_Occurred())
        PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
    ret = -1;
GOOD:
#if !CYTHON_USE_PYTYPE_LOOKUP
    Py_XDECREF(object_reduce);
    Py_XDECREF(object_reduce_ex);
#endif
    Py_XDECREF(reduce);
    Py_XDECREF(reduce_ex);
    Py_XDECREF(reduce_cython);
    Py_XDECREF(setstate);
    Py_XDECREF(setstate_cython);
    return ret;
}

/* TypeImport */
  #ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
    size_t size, enum __Pyx_ImportType_CheckSize check_size)
{
    PyObject *result = 0;
    char warning[200];
    Py_ssize_t basicsize;
#ifdef Py_LIMITED_API
    PyObject *py_basicsize;
#endif
    result = PyObject_GetAttrString(module, class_name);
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s.%.200s is not a type object",
            module_name, class_name);
        goto bad;
    }
#ifndef Py_LIMITED_API
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
#else
    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
    if (!py_basicsize)
        goto bad;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = 0;
    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if ((size_t)basicsize < size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        goto bad;
    }
    if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        goto bad;
    }
    else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(result);
    return NULL;
}
#endif

/* ImportFrom */
  static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Format(PyExc_ImportError,
        #if PY_MAJOR_VERSION < 3
            "cannot import name %.230s", PyString_AS_STRING(name));
        #else
            "cannot import name %S", name);
        #endif
    }
    return value;
}

/* CalculateMetaclass */
  static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
    Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
    for (i=0; i < nbases; i++) {
        PyTypeObject *tmptype;
        PyObject *tmp = PyTuple_GET_ITEM(bases, i);
        tmptype = Py_TYPE(tmp);
#if PY_MAJOR_VERSION < 3
        if (tmptype == &PyClass_Type)
            continue;
#endif
        if (!metaclass) {
            metaclass = tmptype;
            continue;
        }
        if (PyType_IsSubtype(metaclass, tmptype))
            continue;
        if (PyType_IsSubtype(tmptype, metaclass)) {
            metaclass = tmptype;
            continue;
        }
        PyErr_SetString(PyExc_TypeError,
                        "metaclass conflict: "
                        "the metaclass of a derived class "
                        "must be a (non-strict) subclass "
                        "of the metaclasses of all its bases");
        return NULL;
    }
    if (!metaclass) {
#if PY_MAJOR_VERSION < 3
        metaclass = &PyClass_Type;
#else
        metaclass = &PyType_Type;
#endif
    }
    Py_INCREF((PyObject*) metaclass);
    return (PyObject*) metaclass;
}

/* FetchCommonType */
  static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
    PyObject* fake_module;
    PyTypeObject* cached_type = NULL;
    fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
    if (!fake_module) return NULL;
    Py_INCREF(fake_module);
    cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
    if (cached_type) {
        if (!PyType_Check((PyObject*)cached_type)) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s is not a type object",
                type->tp_name);
            goto bad;
        }
        if (cached_type->tp_basicsize != type->tp_basicsize) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s has the wrong size, try recompiling",
                type->tp_name);
            goto bad;
        }
    } else {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
        PyErr_Clear();
        if (PyType_Ready(type) < 0) goto bad;
        if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
            goto bad;
        Py_INCREF(type);
        cached_type = type;
    }
done:
    Py_DECREF(fake_module);
    return cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}

/* CythonFunction */
  #include <structmember.h>
static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
{
    if (unlikely(op->func_doc == NULL)) {
        if (op->func.m_ml->ml_doc) {
#if PY_MAJOR_VERSION >= 3
            op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
#else
            op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
#endif
            if (unlikely(op->func_doc == NULL))
                return NULL;
        } else {
            Py_INCREF(Py_None);
            return Py_None;
        }
    }
    Py_INCREF(op->func_doc);
    return op->func_doc;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp = op->func_doc;
    if (value == NULL) {
        value = Py_None;
    }
    Py_INCREF(value);
    op->func_doc = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    if (unlikely(op->func_name == NULL)) {
#if PY_MAJOR_VERSION >= 3
        op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
#else
        op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
#endif
        if (unlikely(op->func_name == NULL))
            return NULL;
    }
    Py_INCREF(op->func_name);
    return op->func_name;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = op->func_name;
    Py_INCREF(value);
    op->func_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(op->func_qualname);
    return op->func_qualname;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = op->func_qualname;
    Py_INCREF(value);
    op->func_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
{
    PyObject *self;
    self = m->func_closure;
    if (self == NULL)
        self = Py_None;
    Py_INCREF(self);
    return self;
}
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    if (unlikely(op->func_dict == NULL)) {
        op->func_dict = PyDict_New();
        if (unlikely(op->func_dict == NULL))
            return NULL;
    }
    Py_INCREF(op->func_dict);
    return op->func_dict;
}
static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
    if (unlikely(value == NULL)) {
        PyErr_SetString(PyExc_TypeError,
               "function's dictionary may not be deleted");
        return -1;
    }
    if (unlikely(!PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
               "setting function's dictionary to a non-dict");
        return -1;
    }
    tmp = op->func_dict;
    Py_INCREF(value);
    op->func_dict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(op->func_globals);
    return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    PyObject* result = (op->func_code) ? op->func_code : Py_None;
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
    int result = 0;
    PyObject *res = op->defaults_getter((PyObject *) op);
    if (unlikely(!res))
        return -1;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
    Py_INCREF(op->defaults_tuple);
    op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
    Py_INCREF(op->defaults_kwdict);
    #else
    op->defaults_tuple = PySequence_ITEM(res, 0);
    if (unlikely(!op->defaults_tuple)) result = -1;
    else {
        op->defaults_kwdict = PySequence_ITEM(res, 1);
        if (unlikely(!op->defaults_kwdict)) result = -1;
    }
    #endif
    Py_DECREF(res);
    return result;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyTuple_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__defaults__ must be set to a tuple object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_tuple;
    op->defaults_tuple = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->defaults_tuple;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_tuple;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__kwdefaults__ must be set to a dict object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_kwdict;
    op->defaults_kwdict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->defaults_kwdict;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_kwdict;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value || value == Py_None) {
        value = NULL;
    } else if (!PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__annotations__ must be set to a dict object");
        return -1;
    }
    Py_XINCREF(value);
    tmp = op->func_annotations;
    op->func_annotations = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->func_annotations;
    if (unlikely(!result)) {
        result = PyDict_New();
        if (unlikely(!result)) return NULL;
        op->func_annotations = result;
    }
    Py_INCREF(result);
    return result;
}
static PyGetSetDef __pyx_CyFunction_getsets[] = {
    {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
    {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
    {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
    {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
    {0, 0, 0, 0, 0}
};
static PyMemberDef __pyx_CyFunction_members[] = {
    {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
    {0, 0, 0,  0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromString(m->func.m_ml->ml_name);
#else
    return PyString_FromString(m->func.m_ml->ml_name);
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
#if PY_VERSION_HEX < 0x030500A0
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
#else
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
#endif
static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
    if (op == NULL)
        return NULL;
    op->flags = flags;
    __Pyx_CyFunction_weakreflist(op) = NULL;
    op->func.m_ml = ml;
    op->func.m_self = (PyObject *) op;
    Py_XINCREF(closure);
    op->func_closure = closure;
    Py_XINCREF(module);
    op->func.m_module = module;
    op->func_dict = NULL;
    op->func_name = NULL;
    Py_INCREF(qualname);
    op->func_qualname = qualname;
    op->func_doc = NULL;
    op->func_classobj = NULL;
    op->func_globals = globals;
    Py_INCREF(op->func_globals);
    Py_XINCREF(code);
    op->func_code = code;
    op->defaults_pyobjects = 0;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    PyObject_GC_Track(op);
    return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
    Py_CLEAR(m->func_closure);
    Py_CLEAR(m->func.m_module);
    Py_CLEAR(m->func_dict);
    Py_CLEAR(m->func_name);
    Py_CLEAR(m->func_qualname);
    Py_CLEAR(m->func_doc);
    Py_CLEAR(m->func_globals);
    Py_CLEAR(m->func_code);
    Py_CLEAR(m->func_classobj);
    Py_CLEAR(m->defaults_tuple);
    Py_CLEAR(m->defaults_kwdict);
    Py_CLEAR(m->func_annotations);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_XDECREF(pydefaults[i]);
        PyObject_Free(m->defaults);
        m->defaults = NULL;
    }
    return 0;
}
static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    if (__Pyx_CyFunction_weakreflist(m) != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    PyObject_GC_Del(m);
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    __Pyx__CyFunction_dealloc(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
    Py_VISIT(m->func_closure);
    Py_VISIT(m->func.m_module);
    Py_VISIT(m->func_dict);
    Py_VISIT(m->func_name);
    Py_VISIT(m->func_qualname);
    Py_VISIT(m->func_doc);
    Py_VISIT(m->func_globals);
    Py_VISIT(m->func_code);
    Py_VISIT(m->func_classobj);
    Py_VISIT(m->defaults_tuple);
    Py_VISIT(m->defaults_kwdict);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_VISIT(pydefaults[i]);
    }
    return 0;
}
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
{
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
        Py_INCREF(func);
        return func;
    }
    if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
        if (type == NULL)
            type = (PyObject *)(Py_TYPE(obj));
        return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
    }
    if (obj == Py_None)
        obj = NULL;
    return __Pyx_PyMethod_New(func, obj, type);
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromFormat("<cyfunction %U at %p>",
                                op->func_qualname, (void *)op);
#else
    return PyString_FromFormat("<cyfunction %s at %p>",
                               PyString_AsString(op->func_qualname), (void *)op);
#endif
}
static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = f->m_ml->ml_meth;
    Py_ssize_t size;
    switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
    case METH_VARARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0))
            return (*meth)(self, arg);
        break;
    case METH_VARARGS | METH_KEYWORDS:
        return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
    case METH_NOARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
            size = PyTuple_GET_SIZE(arg);
            if (likely(size == 0))
                return (*meth)(self, NULL);
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    case METH_O:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
            size = PyTuple_GET_SIZE(arg);
            if (likely(size == 1)) {
                PyObject *result, *arg0;
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                arg0 = PyTuple_GET_ITEM(arg, 0);
                #else
                arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
                #endif
                result = (*meth)(self, arg0);
                #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
                Py_DECREF(arg0);
                #endif
                return result;
            }
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags in "
                        "__Pyx_CyFunction_Call. METH_OLDARGS is no "
                        "longer supported!");
        return NULL;
    }
    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
                 f->m_ml->ml_name);
    return NULL;
}
static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
}
static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
    PyObject *result;
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
    if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
        Py_ssize_t argc;
        PyObject *new_args;
        PyObject *self;
        argc = PyTuple_GET_SIZE(args);
        new_args = PyTuple_GetSlice(args, 1, argc);
        if (unlikely(!new_args))
            return NULL;
        self = PyTuple_GetItem(args, 0);
        if (unlikely(!self)) {
            Py_DECREF(new_args);
            return NULL;
        }
        result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
        Py_DECREF(new_args);
    } else {
        result = __Pyx_CyFunction_Call(func, args, kw);
    }
    return result;
}
static PyTypeObject __pyx_CyFunctionType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "cython_function_or_method",
    sizeof(__pyx_CyFunctionObject),
    0,
    (destructor) __Pyx_CyFunction_dealloc,
    0,
    0,
    0,
#if PY_MAJOR_VERSION < 3
    0,
#else
    0,
#endif
    (reprfunc) __Pyx_CyFunction_repr,
    0,
    0,
    0,
    0,
    __Pyx_CyFunction_CallAsMethod,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
    0,
    (traverseproc) __Pyx_CyFunction_traverse,
    (inquiry) __Pyx_CyFunction_clear,
    0,
#if PY_VERSION_HEX < 0x030500A0
    offsetof(__pyx_CyFunctionObject, func_weakreflist),
#else
    offsetof(PyCFunctionObject, m_weakreflist),
#endif
    0,
    0,
    __pyx_CyFunction_methods,
    __pyx_CyFunction_members,
    __pyx_CyFunction_getsets,
    0,
    0,
    __Pyx_CyFunction_descr_get,
    0,
    offsetof(__pyx_CyFunctionObject, func_dict),
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if PY_VERSION_HEX >= 0x030400a1
    0,
#endif
};
static int __pyx_CyFunction_init(void) {
    __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
    if (unlikely(__pyx_CyFunctionType == NULL)) {
        return -1;
    }
    return 0;
}
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults = PyObject_Malloc(size);
    if (unlikely(!m->defaults))
        return PyErr_NoMemory();
    memset(m->defaults, 0, size);
    m->defaults_pyobjects = pyobjects;
    return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_tuple = tuple;
    Py_INCREF(tuple);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_kwdict = dict;
    Py_INCREF(dict);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->func_annotations = dict;
    Py_INCREF(dict);
}

/* Py3ClassCreate */
  static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
                                           PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
    PyObject *ns;
    if (metaclass) {
        PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
        if (prep) {
            PyObject *pargs = PyTuple_Pack(2, name, bases);
            if (unlikely(!pargs)) {
                Py_DECREF(prep);
                return NULL;
            }
            ns = PyObject_Call(prep, pargs, mkw);
            Py_DECREF(prep);
            Py_DECREF(pargs);
        } else {
            if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
                return NULL;
            PyErr_Clear();
            ns = PyDict_New();
        }
    } else {
        ns = PyDict_New();
    }
    if (unlikely(!ns))
        return NULL;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
    if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
    return ns;
bad:
    Py_DECREF(ns);
    return NULL;
}
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
                                      PyObject *dict, PyObject *mkw,
                                      int calculate_metaclass, int allow_py2_metaclass) {
    PyObject *result, *margs;
    PyObject *owned_metaclass = NULL;
    if (allow_py2_metaclass) {
        owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
        if (owned_metaclass) {
            metaclass = owned_metaclass;
        } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
            PyErr_Clear();
        } else {
            return NULL;
        }
    }
    if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
        metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
        Py_XDECREF(owned_metaclass);
        if (unlikely(!metaclass))
            return NULL;
        owned_metaclass = metaclass;
    }
    margs = PyTuple_Pack(3, name, bases, dict);
    if (unlikely(!margs)) {
        result = NULL;
    } else {
        result = PyObject_Call(metaclass, margs, mkw);
        Py_DECREF(margs);
    }
    Py_XDECREF(owned_metaclass);
    return result;
}

/* CLineInTraceback */
  #ifndef CYTHON_CLINE_IN_TRACEBACK
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
    PyObject *use_cline;
    PyObject *ptype, *pvalue, *ptraceback;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject **cython_runtime_dict;
#endif
    if (unlikely(!__pyx_cython_runtime)) {
        return c_line;
    }
    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
#if CYTHON_COMPILING_IN_CPYTHON
    cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
    if (likely(cython_runtime_dict)) {
        __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
            use_cline, *cython_runtime_dict,
            __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
    } else
#endif
    {
      PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
      if (use_cline_obj) {
        use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
        Py_DECREF(use_cline_obj);
      } else {
        PyErr_Clear();
        use_cline = NULL;
      }
    }
    if (!use_cline) {
        c_line = 0;
        PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
    }
    else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
        c_line = 0;
    }
    __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
    return c_line;
}
#endif

/* CodeObjectCache */
  static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = start + (end - start) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

/* AddTraceback */
  #include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(filename);
    #else
    py_srcfile = PyUnicode_FromString(filename);
    #endif
    if (!py_srcfile) goto bad;
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_code = __Pyx_PyCode_New(
        0,
        0,
        0,
        0,
        0,
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    Py_DECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    if (c_line) {
        c_line = __Pyx_CLineForTraceback(tstate, c_line);
    }
    py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
    if (!py_code) {
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) goto bad;
        __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
    }
    py_frame = PyFrame_New(
        tstate,            /*PyThreadState *tstate,*/
        py_code,           /*PyCodeObject *code,*/
        __pyx_d,    /*PyObject *globals,*/
        0                  /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

/* CIntFromPyVerify */
  #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
    {\
        func_type value = func_value;\
        if (sizeof(target_type) < sizeof(func_type)) {\
            if (unlikely(value != (func_type) (target_type) value)) {\
                func_type zero = 0;\
                if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
                    return (target_type) -1;\
                if (is_unsigned && unlikely(value < zero))\
                    goto raise_neg_overflow;\
                else\
                    goto raise_overflow;\
            }\
        }\
        return (target_type) value;\
    }

/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_char(char value) {
    const char neg_one = (char) ((char) 0 - (char) 1), const_zero = (char) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(char) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(char) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(char) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(char),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
    const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value) {
    const uint32_t neg_one = (uint32_t) ((uint32_t) 0 - (uint32_t) 1), const_zero = (uint32_t) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(uint32_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(uint32_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(uint32_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(uint32_t) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(uint32_t),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
    const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

/* CIntFromPy */
  static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) {
    const char neg_one = (char) ((char) 0 - (char) 1), const_zero = (char) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(char) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (char) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (char) 0;
                case  1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0])
                case 2:
                    if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) {
                            return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) {
                            return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) {
                            return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (char) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(char) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (char) 0;
                case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(char,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
                            return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
                            return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
                            return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
                            return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
                            return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
                            return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(char) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            char val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (char) -1;
        }
    } else {
        char val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (char) -1;
        val = __Pyx_PyInt_As_char(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to char");
    return (char) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to char");
    return (char) -1;
}

/* CIntFromPy */
  static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
    const size_t neg_one = (size_t) ((size_t) 0 - (size_t) 1), const_zero = (size_t) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(size_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (size_t) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (size_t) 0;
                case  1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0])
                case 2:
                    if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) {
                            return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) {
                            return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 4 * PyLong_SHIFT) {
                            return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (size_t) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(size_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (size_t) 0;
                case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(size_t,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                            return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                            return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
                            return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(size_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            size_t val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (size_t) -1;
        }
    } else {
        size_t val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (size_t) -1;
        val = __Pyx_PyInt_As_size_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to size_t");
    return (size_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to size_t");
    return (size_t) -1;
}

/* CIntFromPy */
  static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
    const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (long) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
                            return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
                            return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
                            return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (long) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            long val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (long) -1;
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyInt_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to long");
    return (long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to long");
    return (long) -1;
}

/* CIntFromPy */
  static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
    const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
                            return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
                            return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
                            return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (int) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int) -1;
        }
    } else {
        int val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyInt_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int");
    return (int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int");
    return (int) -1;
}

/* FastTypeChecks */
  #if CYTHON_COMPILING_IN_CPYTHON
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
    while (a) {
        a = a->tp_base;
        if (a == b)
            return 1;
    }
    return b == &PyBaseObject_Type;
}
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (a == b) return 1;
    mro = a->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(a, b);
}
#if PY_MAJOR_VERSION == 2
static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
    PyObject *exception, *value, *tb;
    int res;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&exception, &value, &tb);
    res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
    if (unlikely(res == -1)) {
        PyErr_WriteUnraisable(err);
        res = 0;
    }
    if (!res) {
        res = PyObject_IsSubclass(err, exc_type2);
        if (unlikely(res == -1)) {
            PyErr_WriteUnraisable(err);
            res = 0;
        }
    }
    __Pyx_ErrRestore(exception, value, tb);
    return res;
}
#else
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
    int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
    if (!res) {
        res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
    }
    return res;
}
#endif
static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    assert(PyExceptionClass_Check(exc_type));
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        PyObject *t = PyTuple_GET_ITEM(tuple, i);
        #if PY_MAJOR_VERSION < 3
        if (likely(exc_type == t)) return 1;
        #endif
        if (likely(PyExceptionClass_Check(t))) {
            if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
        } else {
        }
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
    if (likely(err == exc_type)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        if (likely(PyExceptionClass_Check(exc_type))) {
            return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
        } else if (likely(PyTuple_Check(exc_type))) {
            return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
        } else {
        }
    }
    return PyErr_GivenExceptionMatches(err, exc_type);
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
    assert(PyExceptionClass_Check(exc_type1));
    assert(PyExceptionClass_Check(exc_type2));
    if (likely(err == exc_type1 || err == exc_type2)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
    }
    return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
}
#endif

/* CheckBinaryVersion */
  static int __Pyx_check_binary_version(void) {
    char ctversion[4], rtversion[4];
    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        return PyErr_WarnEx(NULL, message, 1);
    }
    return 0;
}

/* InitStrings */
  static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        if (PyObject_Hash(*t->p) == -1)
            return -1;
        ++t;
    }
    return 0;
}

static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
}
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
#if !CYTHON_PEP393_ENABLED
static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    char* defenc_c;
    PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
    if (!defenc) return NULL;
    defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    {
        char* end = defenc_c + PyBytes_GET_SIZE(defenc);
        char* c;
        for (c = defenc_c; c < end; c++) {
            if ((unsigned char) (*c) >= 128) {
                PyUnicode_AsASCIIString(o);
                return NULL;
            }
        }
    }
#endif
    *length = PyBytes_GET_SIZE(defenc);
    return defenc_c;
}
#else
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    if (likely(PyUnicode_IS_ASCII(o))) {
        *length = PyUnicode_GET_LENGTH(o);
        return PyUnicode_AsUTF8(o);
    } else {
        PyUnicode_AsASCIIString(o);
        return NULL;
    }
#else
    return PyUnicode_AsUTF8AndSize(o, length);
#endif
}
#endif
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
        return __Pyx_PyUnicode_AsStringAndSize(o, length);
    } else
#endif
#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
    if (PyByteArray_Check(o)) {
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
    } else
#endif
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
    int retval;
    if (unlikely(!x)) return -1;
    retval = __Pyx_PyObject_IsTrue(x);
    Py_DECREF(x);
    return retval;
}
static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
#if PY_MAJOR_VERSION >= 3
    if (PyLong_Check(result)) {
        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
                "__int__ returned non-int (type %.200s).  "
                "The ability to return an instance of a strict subclass of int "
                "is deprecated, and may be removed in a future version of Python.",
                Py_TYPE(result)->tp_name)) {
            Py_DECREF(result);
            return NULL;
        }
        return result;
    }
#endif
    PyErr_Format(PyExc_TypeError,
                 "__%.4s__ returned non-%.4s (type %.200s)",
                 type_name, type_name, Py_TYPE(result)->tp_name);
    Py_DECREF(result);
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
#if CYTHON_USE_TYPE_SLOTS
  PyNumberMethods *m;
#endif
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_Check(x) || PyLong_Check(x)))
#else
  if (likely(PyLong_Check(x)))
#endif
    return __Pyx_NewRef(x);
#if CYTHON_USE_TYPE_SLOTS
  m = Py_TYPE(x)->tp_as_number;
  #if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = m->nb_int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = m->nb_long(x);
  }
  #else
  if (likely(m && m->nb_int)) {
    name = "int";
    res = m->nb_int(x);
  }
  #endif
#else
  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
    res = PyNumber_Int(x);
  }
#endif
  if (likely(res)) {
#if PY_MAJOR_VERSION < 3
    if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
#else
    if (unlikely(!PyLong_CheckExact(res))) {
#endif
        return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_CheckExact(b))) {
    if (sizeof(Py_ssize_t) >= sizeof(long))
        return PyInt_AS_LONG(b);
    else
        return PyInt_AsSsize_t(b);
  }
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_USE_PYLONG_INTERNALS
    const digit* digits = ((PyLongObject*)b)->ob_digit;
    const Py_ssize_t size = Py_SIZE(b);
    if (likely(__Pyx_sst_abs(size) <= 1)) {
        ival = likely(size) ? digits[0] : 0;
        if (size == -1) ival = -ival;
        return ival;
    } else {
      switch (size) {
         case 2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
      }
    }
    #endif
    return PyLong_AsSsize_t(b);
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
