Generated by Cython 0.17.2 on Thu Jan 31 16:42:33 2013

Raw output: lib.c

     1: cimport numpy as np

      /* "lib.pyx":1
     * cimport numpy as np             # <<<<<<<<<<<<<<
     * cimport cython
     * import numpy as np
     */
      __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;

     2: cimport cython

     3: import numpy as np

      /* "lib.pyx":3
     * cimport numpy as np
     * cimport cython
     * import numpy as np             # <<<<<<<<<<<<<<
     *
     * from numpy cimport *
     */
      __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     4:

     5: from numpy cimport *

     6:

     7:

     8: cdef extern from "numpy/arrayobject.h":

     9:     cdef enum NPY_TYPES:

     10:         NPY_intp "NPY_INTP"

     11:

     12: from cpython cimport (PyDict_New, PyDict_GetItem, PyDict_SetItem,

     13:                       PyDict_Contains, PyDict_Keys,

     14:                       Py_INCREF, PyTuple_SET_ITEM,

     15:                       PyList_Check, PyFloat_Check,

     16:                       PyString_Check,

     17:                       PyTuple_SetItem,

     18:                       PyTuple_New,

     19:                       PyObject_SetAttrString)

     20:

     21: cimport cpython

     22:

     23: isnan = np.isnan

      /* "lib.pyx":23
     * cimport cpython
     *
     * isnan = np.isnan             # <<<<<<<<<<<<<<
     * cdef double NaN = <double> np.NaN
     * cdef double nan = NaN
     */
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__isnan); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__isnan, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

     24: cdef double NaN = <double> np.NaN

      /* "lib.pyx":24
     *
     * isnan = np.isnan
     * cdef double NaN = <double> np.NaN             # <<<<<<<<<<<<<<
     * cdef double nan = NaN
     * cdef double NAN = nan
     */
      __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__NaN); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_3lib_NaN = ((double)__pyx_t_4);

     25: cdef double nan = NaN

      /* "lib.pyx":25
     * isnan = np.isnan
     * cdef double NaN = <double> np.NaN
     * cdef double nan = NaN             # <<<<<<<<<<<<<<
     * cdef double NAN = nan
     *
     */
      __pyx_v_3lib_nan = __pyx_v_3lib_NaN;

     26: cdef double NAN = nan

      /* "lib.pyx":26
     * cdef double NaN = <double> np.NaN
     * cdef double nan = NaN
     * cdef double NAN = nan             # <<<<<<<<<<<<<<
     *
     * from datetime import datetime as pydatetime
     */
      __pyx_v_3lib_NAN = __pyx_v_3lib_nan;

     27:

     28: from datetime import datetime as pydatetime

      /* "lib.pyx":28
     * cdef double NAN = nan
     *
     * from datetime import datetime as pydatetime             # <<<<<<<<<<<<<<
     *
     * # this is our tseries.pxd
     */
      __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__datetime));
      PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__datetime));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__datetime));
      __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__datetime), ((PyObject *)__pyx_t_2), -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__datetime);
      if (__pyx_t_2 == NULL) {
        if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__datetime);
        if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pydatetime, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

     29:

     30: # this is our tseries.pxd

     31: from datetime cimport *

     32:

     33: from tslib cimport convert_to_tsobject

     34: import tslib

      /* "lib.pyx":34
     *
     * from tslib cimport convert_to_tsobject
     * import tslib             # <<<<<<<<<<<<<<
     * from tslib import NaT, Timestamp
     *
     */
      __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__tslib), 0, -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__tslib, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

     35: from tslib import NaT, Timestamp

      /* "lib.pyx":35
     * from tslib cimport convert_to_tsobject
     * import tslib
     * from tslib import NaT, Timestamp             # <<<<<<<<<<<<<<
     *
     * cdef int64_t NPY_NAT = util.get_nat()
     */
      __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__NaT));
      PyList_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_s__NaT));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__NaT));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__Timestamp));
      PyList_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_s__Timestamp));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Timestamp));
      __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__tslib), ((PyObject *)__pyx_t_3), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__NaT);
      if (__pyx_t_3 == NULL) {
        if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__NaT);
        if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_3);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__NaT, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__Timestamp);
      if (__pyx_t_3 == NULL) {
        if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__Timestamp);
        if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_3);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__Timestamp, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     36:

     37: cdef int64_t NPY_NAT = util.get_nat()

      /* "lib.pyx":37
     * from tslib import NaT, Timestamp
     *
     * cdef int64_t NPY_NAT = util.get_nat()             # <<<<<<<<<<<<<<
     *
     * ctypedef unsigned char UChar
     */
      __pyx_v_3lib_NPY_NAT = get_nat();

     38:

     39: ctypedef unsigned char UChar

     40:

     41: cimport util

     42: from util cimport is_array, _checknull, _checknan

     43:

     44: cdef extern from "headers/stdint.h":

     45:     enum: UINT8_MAX

     46:     enum: INT64_MAX

     47:     enum: INT64_MIN

     48:

     49:

     50: cdef extern from "math.h":

     51:     double sqrt(double x)

     52:     double fabs(double)

     53:

     54: # import datetime C API

     55: PyDateTime_IMPORT

      /* "lib.pyx":55
     *
     * # import datetime C API
     * PyDateTime_IMPORT             # <<<<<<<<<<<<<<
     *
     * # initialize numpy
     */
      PyDateTime_IMPORT;

     56:

     57: # initialize numpy

     58: import_array()

      /* "lib.pyx":58
     *
     * # initialize numpy
     * import_array()             # <<<<<<<<<<<<<<
     * import_ufunc()
     *
     */
      import_array();

     59: import_ufunc()

      /* "lib.pyx":59
     * # initialize numpy
     * import_array()
     * import_ufunc()             # <<<<<<<<<<<<<<
     *
     * cpdef map_indices_list(list index):
     */
      import_ufunc();

     60:

     61: cpdef map_indices_list(list index):

    /* "lib.pyx":61
     * import_ufunc()
     *
     * cpdef map_indices_list(list index):             # <<<<<<<<<<<<<<
     *     '''
     *     Produce a dict mapping the values of the input array to their respective
     */

    static PyObject *__pyx_pw_3lib_1map_indices_list(PyObject *__pyx_self, PyObject *__pyx_v_index); /*proto*/
    static PyObject *__pyx_f_3lib_map_indices_list(PyObject *__pyx_v_index, CYTHON_UNUSED int __pyx_skip_dispatch) {
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_length;
      PyObject *__pyx_v_result = 0;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("map_indices_list", 0);

    /* "lib.pyx":61
     * import_ufunc()
     *
     * cpdef map_indices_list(list index):             # <<<<<<<<<<<<<<
     *     '''
     *     Produce a dict mapping the values of the input array to their respective
     */

    static PyObject *__pyx_pf_3lib_map_indices_list(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_index) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("map_indices_list", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_3lib_map_indices_list(__pyx_v_index, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("lib.map_indices_list", __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_3lib_3ismember(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_3lib_2ismember[] = "\n    Checks whether\n\n    Parameters\n    ----------\n    arr : ndarray\n    values : set\n\n    Returns\n    -------\n    ismember : ndarray (boolean dtype)\n    ";
    static PyMethodDef __pyx_mdef_3lib_3ismember = {__Pyx_NAMESTR("ismember"), (PyCFunction)__pyx_pw_3lib_3ismember, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3lib_2ismember)};
    static PyObject *__pyx_pw_3lib_3ismember(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyArrayObject *__pyx_v_arr = 0;
      PyObject *__pyx_v_values = 0;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("ismember (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__arr,&__pyx_n_s__values,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__arr)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            case  1:
            if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("ismember", 1, 2, 2, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ismember") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        }
        __pyx_v_arr = ((PyArrayObject *)values[0]);
        __pyx_v_values = ((PyObject*)values[1]);
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("ismember", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_L3_error:;
      __Pyx_AddTraceback("lib.ismember", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), (&PySet_Type), 1, "values", 1))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_2ismember(__pyx_self, __pyx_v_arr, __pyx_v_values);
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     62:     '''

     63:     Produce a dict mapping the values of the input array to their respective

     64:     locations.

     65:

     66:     Example:

     67:         array(['hi', 'there']) --> {'hi' : 0 , 'there' : 1}

     68:

     69:     Better to do this with Cython because of the enormous speed boost.

     70:     '''

     71:     cdef Py_ssize_t i, length

     72:     cdef dict result = {}

      /* "lib.pyx":72
     *     '''
     *     cdef Py_ssize_t i, length
     *     cdef dict result = {}             # <<<<<<<<<<<<<<
     *
     *     length = len(index)
     */
      __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __pyx_v_result = __pyx_t_1;
      __pyx_t_1 = 0;

     73:

     74:     length = len(index)

      /* "lib.pyx":74
     *     cdef dict result = {}
     *
     *     length = len(index)             # <<<<<<<<<<<<<<
     *
     *     for i from 0 <= i < length:
     */
      if (unlikely(((PyObject *)__pyx_v_index) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_2 = PyList_GET_SIZE(((PyObject *)__pyx_v_index)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_length = __pyx_t_2;

     75:

     76:     for i from 0 <= i < length:

      /* "lib.pyx":76
     *     length = len(index)
     *
     *     for i from 0 <= i < length:             # <<<<<<<<<<<<<<
     *         result[index[i]] = i
     *
     */
      __pyx_t_2 = __pyx_v_length;
      for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) {

     77:         result[index[i]] = i

        /* "lib.pyx":77
     *
     *     for i from 0 <= i < length:
     *         result[index[i]] = i             # <<<<<<<<<<<<<<
     *
     *     return result
     */
        __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        if (unlikely(((PyObject *)__pyx_v_index) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_index), __pyx_v_i, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_t_3, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }

     78:

     79:     return result

      /* "lib.pyx":79
     *         result[index[i]] = i
     *
     *     return result             # <<<<<<<<<<<<<<
     *
     *
     */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_result));
      __pyx_r = ((PyObject *)__pyx_v_result);
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_AddTraceback("lib.map_indices_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_result);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_1map_indices_list(PyObject *__pyx_self, PyObject *__pyx_v_index); /*proto*/
    static char __pyx_doc_3lib_map_indices_list[] = "\n    Produce a dict mapping the values of the input array to their respective\n    locations.\n\n    Example:\n        array(['hi', 'there']) --> {'hi' : 0 , 'there' : 1}\n\n    Better to do this with Cython because of the enormous speed boost.\n    ";
    static PyObject *__pyx_pw_3lib_1map_indices_list(PyObject *__pyx_self, PyObject *__pyx_v_index) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("map_indices_list (wrapper)", 0);
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), (&PyList_Type), 1, "index", 1))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_map_indices_list(__pyx_self, ((PyObject*)__pyx_v_index));
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     80:

     81:

     82: from libc.stdlib cimport malloc, free

     83:

     84: def ismember(ndarray arr, set values):

    /* "lib.pyx":84
     * from libc.stdlib cimport malloc, free
     *
     * def ismember(ndarray arr, set values):             # <<<<<<<<<<<<<<
     *     '''
     *     Checks whether
     */

    static PyObject *__pyx_pf_3lib_2ismember(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_values) {
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_n;
      PyArrayObject *__pyx_v_result = 0;
      PyObject *__pyx_v_val = 0;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
      __Pyx_Buffer __pyx_pybuffer_result;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("ismember", 0);
      __pyx_pybuffer_result.pybuffer.buf = NULL;
      __pyx_pybuffer_result.refcount = 0;
      __pyx_pybuffernd_result.data = NULL;
      __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;

      /* "lib.pyx":84
     * from libc.stdlib cimport malloc, free
     *
     * def ismember(ndarray arr, set values):             # <<<<<<<<<<<<<<
     *     '''
     *     Checks whether
     */
      __pyx_k_tuple_97 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_97)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_97);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__arr));
      PyTuple_SET_ITEM(__pyx_k_tuple_97, 0, ((PyObject *)__pyx_n_s__arr));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__arr));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
      PyTuple_SET_ITEM(__pyx_k_tuple_97, 1, ((PyObject *)__pyx_n_s__values));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_97, 2, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_97, 3, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
      PyTuple_SET_ITEM(__pyx_k_tuple_97, 4, ((PyObject *)__pyx_n_s__result));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
      PyTuple_SET_ITEM(__pyx_k_tuple_97, 5, ((PyObject *)__pyx_n_s__val));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_97));

      /* "lib.pyx":84
     * from libc.stdlib cimport malloc, free
     *
     * def ismember(ndarray arr, set values):             # <<<<<<<<<<<<<<
     *     '''
     *     Checks whether
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_3ismember, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ismember, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_98 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_97, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__ismember, 84, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_98)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     85:     '''

     86:     Checks whether

     87:

     88:     Parameters

     89:     ----------

     90:     arr : ndarray

     91:     values : set

     92:

     93:     Returns

     94:     -------

     95:     ismember : ndarray (boolean dtype)

     96:     '''

     97:     cdef:

     98:         Py_ssize_t i, n

     99:         ndarray[uint8_t] result

     100:         object val

     101:

     102:     n = len(arr)

      /* "lib.pyx":102
     *         object val
     *
     *     n = len(arr)             # <<<<<<<<<<<<<<
     *     result = np.empty(n, dtype=np.uint8)
     *     for i in range(n):
     */
      __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_arr)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_n = __pyx_t_1;

     103:     result = np.empty(n, dtype=np.uint8)

      /* "lib.pyx":103
     *
     *     n = len(arr)
     *     result = np.empty(n, dtype=np.uint8)             # <<<<<<<<<<<<<<
     *     for i in range(n):
     *         val = util.get_value_at(arr, i)
     */
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__uint8); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
        __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_8 < 0)) {
          PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
          }
        }
        __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_7 = 0;
      __pyx_v_result = ((PyArrayObject *)__pyx_t_6);
      __pyx_t_6 = 0;

     104:     for i in range(n):

      /* "lib.pyx":104
     *     n = len(arr)
     *     result = np.empty(n, dtype=np.uint8)
     *     for i in range(n):             # <<<<<<<<<<<<<<
     *         val = util.get_value_at(arr, i)
     *         if val in values:
     */
      __pyx_t_1 = __pyx_v_n;
      for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_1; __pyx_t_12+=1) {
        __pyx_v_i = __pyx_t_12;

     105:         val = util.get_value_at(arr, i)

        /* "lib.pyx":105
     *     result = np.empty(n, dtype=np.uint8)
     *     for i in range(n):
     *         val = util.get_value_at(arr, i)             # <<<<<<<<<<<<<<
     *         if val in values:
     *             result[i] = 1
     */
        __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_2 = __pyx_f_4util_get_value_at(__pyx_v_arr, __pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_v_val);
        __pyx_v_val = __pyx_t_2;
        __pyx_t_2 = 0;

     106:         if val in values:

        /* "lib.pyx":106
     *     for i in range(n):
     *         val = util.get_value_at(arr, i)
     *         if val in values:             # <<<<<<<<<<<<<<
     *             result[i] = 1
     *         else:
     */
        __pyx_t_13 = (__Pyx_PySequence_Contains(__pyx_v_val, ((PyObject *)__pyx_v_values), Py_EQ)); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        if (__pyx_t_13) {

     107:             result[i] = 1

          /* "lib.pyx":107
     *         val = util.get_value_at(arr, i)
     *         if val in values:
     *             result[i] = 1             # <<<<<<<<<<<<<<
     *         else:
     *             result[i] = 0
     */
          __pyx_t_14 = __pyx_v_i;
          __pyx_t_8 = -1;
          if (__pyx_t_14 < 0) {
            __pyx_t_14 += __pyx_pybuffernd_result.diminfo[0].shape;
            if (unlikely(__pyx_t_14 < 0)) __pyx_t_8 = 0;
          } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_result.diminfo[0].shape)) __pyx_t_8 = 0;
          if (unlikely(__pyx_t_8 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_8);
            {__pyx_filename = __pyx_f[2]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_result.diminfo[0].strides) = 1;
          goto __pyx_L5;
        }
        /*else*/ {

     108:         else:

     109:             result[i] = 0

          /* "lib.pyx":109
     *             result[i] = 1
     *         else:
     *             result[i] = 0             # <<<<<<<<<<<<<<
     *
     *     return result.view(np.bool_)
     */
          __pyx_t_15 = __pyx_v_i;
          __pyx_t_8 = -1;
          if (__pyx_t_15 < 0) {
            __pyx_t_15 += __pyx_pybuffernd_result.diminfo[0].shape;
            if (unlikely(__pyx_t_15 < 0)) __pyx_t_8 = 0;
          } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_result.diminfo[0].shape)) __pyx_t_8 = 0;
          if (unlikely(__pyx_t_8 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_8);
            {__pyx_filename = __pyx_f[2]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_result.diminfo[0].strides) = 0;
        }
        __pyx_L5:;
      }

     110:

     111:     return result.view(np.bool_)

      /* "lib.pyx":111
     *             result[i] = 0
     *
     *     return result.view(np.bool_)             # <<<<<<<<<<<<<<
     *
     * #----------------------------------------------------------------------
     */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__view); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__bool_); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.ismember", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF((PyObject *)__pyx_v_result);
      __Pyx_XDECREF(__pyx_v_val);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     112:

     113: #----------------------------------------------------------------------

     114: # datetime / io related

     115:

     116: cdef int _EPOCH_ORD = 719163

      /* "lib.pyx":116
     * # datetime / io related
     *
     * cdef int _EPOCH_ORD = 719163             # <<<<<<<<<<<<<<
     *
     * from datetime import date as pydate
     */
      __pyx_v_3lib__EPOCH_ORD = 719163;

     117:

     118: from datetime import date as pydate

      /* "lib.pyx":118
     * cdef int _EPOCH_ORD = 719163
     *
     * from datetime import date as pydate             # <<<<<<<<<<<<<<
     *
     * cdef inline int64_t gmtime(object date):
     */
      __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__date));
      PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__date));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__date));
      __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__datetime), ((PyObject *)__pyx_t_2), -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__date);
      if (__pyx_t_2 == NULL) {
        if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__date);
        if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pydate, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

     119:

     120: cdef inline int64_t gmtime(object date):

    /* "lib.pyx":120
     * from datetime import date as pydate
     *
     * cdef inline int64_t gmtime(object date):             # <<<<<<<<<<<<<<
     *     cdef int y, m, d, h, mn, s, days
     *
     */

    static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_3lib_gmtime(PyObject *__pyx_v_date) {
      int __pyx_v_y;
      int __pyx_v_m;
      int __pyx_v_d;
      int __pyx_v_h;
      int __pyx_v_mn;
      int __pyx_v_s;
      int __pyx_v_days;
      __pyx_t_5numpy_int64_t __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("gmtime", 0);

     121:     cdef int y, m, d, h, mn, s, days

     122:

     123:     y = PyDateTime_GET_YEAR(date)

      /* "lib.pyx":123
     *     cdef int y, m, d, h, mn, s, days
     *
     *     y = PyDateTime_GET_YEAR(date)             # <<<<<<<<<<<<<<
     *     m = PyDateTime_GET_MONTH(date)
     *     d = PyDateTime_GET_DAY(date)
     */
      if (!(likely(((__pyx_v_date) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_date, __pyx_ptype_8datetime_date))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = __pyx_v_date;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_y = PyDateTime_GET_YEAR(((PyDateTime_Date *)__pyx_t_1));
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     124:     m = PyDateTime_GET_MONTH(date)

      /* "lib.pyx":124
     *
     *     y = PyDateTime_GET_YEAR(date)
     *     m = PyDateTime_GET_MONTH(date)             # <<<<<<<<<<<<<<
     *     d = PyDateTime_GET_DAY(date)
     *     h = PyDateTime_DATE_GET_HOUR(date)
     */
      if (!(likely(((__pyx_v_date) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_date, __pyx_ptype_8datetime_date))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = __pyx_v_date;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_m = PyDateTime_GET_MONTH(((PyDateTime_Date *)__pyx_t_1));
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     125:     d = PyDateTime_GET_DAY(date)

      /* "lib.pyx":125
     *     y = PyDateTime_GET_YEAR(date)
     *     m = PyDateTime_GET_MONTH(date)
     *     d = PyDateTime_GET_DAY(date)             # <<<<<<<<<<<<<<
     *     h = PyDateTime_DATE_GET_HOUR(date)
     *     mn = PyDateTime_DATE_GET_MINUTE(date)
     */
      if (!(likely(((__pyx_v_date) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_date, __pyx_ptype_8datetime_date))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = __pyx_v_date;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_d = PyDateTime_GET_DAY(((PyDateTime_Date *)__pyx_t_1));
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     126:     h = PyDateTime_DATE_GET_HOUR(date)

      /* "lib.pyx":126
     *     m = PyDateTime_GET_MONTH(date)
     *     d = PyDateTime_GET_DAY(date)
     *     h = PyDateTime_DATE_GET_HOUR(date)             # <<<<<<<<<<<<<<
     *     mn = PyDateTime_DATE_GET_MINUTE(date)
     *     s = PyDateTime_DATE_GET_SECOND(date)
     */
      __pyx_v_h = PyDateTime_DATE_GET_HOUR(__pyx_v_date);

     127:     mn = PyDateTime_DATE_GET_MINUTE(date)

      /* "lib.pyx":127
     *     d = PyDateTime_GET_DAY(date)
     *     h = PyDateTime_DATE_GET_HOUR(date)
     *     mn = PyDateTime_DATE_GET_MINUTE(date)             # <<<<<<<<<<<<<<
     *     s = PyDateTime_DATE_GET_SECOND(date)
     *
     */
      __pyx_v_mn = PyDateTime_DATE_GET_MINUTE(__pyx_v_date);

     128:     s = PyDateTime_DATE_GET_SECOND(date)

      /* "lib.pyx":128
     *     h = PyDateTime_DATE_GET_HOUR(date)
     *     mn = PyDateTime_DATE_GET_MINUTE(date)
     *     s = PyDateTime_DATE_GET_SECOND(date)             # <<<<<<<<<<<<<<
     *
     *     days = pydate(y, m, 1).toordinal() - _EPOCH_ORD + d - 1
     */
      __pyx_v_s = PyDateTime_DATE_GET_SECOND(__pyx_v_date);

     129:

     130:     days = pydate(y, m, 1).toordinal() - _EPOCH_ORD + d - 1

      /* "lib.pyx":130
     *     s = PyDateTime_DATE_GET_SECOND(date)
     *
     *     days = pydate(y, m, 1).toordinal() - _EPOCH_ORD + d - 1             # <<<<<<<<<<<<<<
     *     return ((<int64_t> (((days * 24 + h) * 60 + mn))) * 60 + s) * 1000
     *
     */
      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__pydate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyInt_FromLong(__pyx_v_y); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyInt_FromLong(__pyx_v_m); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_int_1);
      PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      __pyx_t_2 = 0;
      __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__toordinal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyInt_FromLong(__pyx_v_3lib__EPOCH_ORD); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = PyNumber_Subtract(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyInt_FromLong(__pyx_v_d); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyNumber_Subtract(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_days = __pyx_t_5;

     131:     return ((<int64_t> (((days * 24 + h) * 60 + mn))) * 60 + s) * 1000

      /* "lib.pyx":131
     *
     *     days = pydate(y, m, 1).toordinal() - _EPOCH_ORD + d - 1
     *     return ((<int64_t> (((days * 24 + h) * 60 + mn))) * 60 + s) * 1000             # <<<<<<<<<<<<<<
     *
     * cpdef object to_datetime(int64_t timestamp):
     */
      __pyx_r = (((((__pyx_t_5numpy_int64_t)((((__pyx_v_days * 24) + __pyx_v_h) * 60) + __pyx_v_mn)) * 60) + __pyx_v_s) * 1000);
      goto __pyx_L0;

      __pyx_r = 0;
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_WriteUnraisable("lib.gmtime", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     132:

     133: cpdef object to_datetime(int64_t timestamp):

    /* "lib.pyx":133
     *     return ((<int64_t> (((days * 24 + h) * 60 + mn))) * 60 + s) * 1000
     *
     * cpdef object to_datetime(int64_t timestamp):             # <<<<<<<<<<<<<<
     *     return pydatetime.utcfromtimestamp(timestamp / 1000.0)
     *
     */

    static PyObject *__pyx_pw_3lib_5to_datetime(PyObject *__pyx_self, PyObject *__pyx_arg_timestamp); /*proto*/
    static PyObject *__pyx_f_3lib_to_datetime(__pyx_t_5numpy_int64_t __pyx_v_timestamp, CYTHON_UNUSED int __pyx_skip_dispatch) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("to_datetime", 0);

    /* "lib.pyx":133
     *     return ((<int64_t> (((days * 24 + h) * 60 + mn))) * 60 + s) * 1000
     *
     * cpdef object to_datetime(int64_t timestamp):             # <<<<<<<<<<<<<<
     *     return pydatetime.utcfromtimestamp(timestamp / 1000.0)
     *
     */

    static PyObject *__pyx_pf_3lib_4to_datetime(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_5numpy_int64_t __pyx_v_timestamp) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("to_datetime", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_3lib_to_datetime(__pyx_v_timestamp, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("lib.to_datetime", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     134:     return pydatetime.utcfromtimestamp(timestamp / 1000.0)

      /* "lib.pyx":134
     *
     * cpdef object to_datetime(int64_t timestamp):
     *     return pydatetime.utcfromtimestamp(timestamp / 1000.0)             # <<<<<<<<<<<<<<
     *
     * cpdef object to_timestamp(object dt):
     */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__pydatetime); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__utcfromtimestamp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyFloat_FromDouble((__pyx_v_timestamp / 1000.0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_AddTraceback("lib.to_datetime", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_5to_datetime(PyObject *__pyx_self, PyObject *__pyx_arg_timestamp); /*proto*/
    static PyObject *__pyx_pw_3lib_5to_datetime(PyObject *__pyx_self, PyObject *__pyx_arg_timestamp) {
      __pyx_t_5numpy_int64_t __pyx_v_timestamp;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("to_datetime (wrapper)", 0);
      assert(__pyx_arg_timestamp); {
        __pyx_v_timestamp = __Pyx_PyInt_from_py_npy_int64(__pyx_arg_timestamp); if (unlikely((__pyx_v_timestamp == (npy_int64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L3_error:;
      __Pyx_AddTraceback("lib.to_datetime", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_3lib_4to_datetime(__pyx_self, ((__pyx_t_5numpy_int64_t)__pyx_v_timestamp));
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     135:

     136: cpdef object to_timestamp(object dt):

    /* "lib.pyx":136
     *     return pydatetime.utcfromtimestamp(timestamp / 1000.0)
     *
     * cpdef object to_timestamp(object dt):             # <<<<<<<<<<<<<<
     *     return gmtime(dt)
     *
     */

    static PyObject *__pyx_pw_3lib_7to_timestamp(PyObject *__pyx_self, PyObject *__pyx_v_dt); /*proto*/
    static PyObject *__pyx_f_3lib_to_timestamp(PyObject *__pyx_v_dt, CYTHON_UNUSED int __pyx_skip_dispatch) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("to_timestamp", 0);

    /* "lib.pyx":136
     *     return pydatetime.utcfromtimestamp(timestamp / 1000.0)
     *
     * cpdef object to_timestamp(object dt):             # <<<<<<<<<<<<<<
     *     return gmtime(dt)
     *
     */

    static PyObject *__pyx_pf_3lib_6to_timestamp(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_dt) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("to_timestamp", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_3lib_to_timestamp(__pyx_v_dt, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("lib.to_timestamp", __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_3lib_9array_to_timestamp(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_9array_to_timestamp = {__Pyx_NAMESTR("array_to_timestamp"), (PyCFunction)__pyx_pw_3lib_9array_to_timestamp, METH_O, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_9array_to_timestamp(PyObject *__pyx_self, PyObject *__pyx_v_arr) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("array_to_timestamp (wrapper)", 0);
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_8array_to_timestamp(__pyx_self, ((PyArrayObject *)__pyx_v_arr));
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     137:     return gmtime(dt)

      /* "lib.pyx":137
     *
     * cpdef object to_timestamp(object dt):
     *     return gmtime(dt)             # <<<<<<<<<<<<<<
     *
     * def array_to_timestamp(ndarray[object, ndim=1] arr):
     */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_PyInt_to_py_npy_int64(__pyx_f_3lib_gmtime(__pyx_v_dt)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("lib.to_timestamp", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_7to_timestamp(PyObject *__pyx_self, PyObject *__pyx_v_dt); /*proto*/
    static PyObject *__pyx_pw_3lib_7to_timestamp(PyObject *__pyx_self, PyObject *__pyx_v_dt) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("to_timestamp (wrapper)", 0);
      __pyx_r = __pyx_pf_3lib_6to_timestamp(__pyx_self, ((PyObject *)__pyx_v_dt));
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     138:

     139: def array_to_timestamp(ndarray[object, ndim=1] arr):

    /* "lib.pyx":139
     *     return gmtime(dt)
     *
     * def array_to_timestamp(ndarray[object, ndim=1] arr):             # <<<<<<<<<<<<<<
     *     cdef int i, n
     *     cdef ndarray[int64_t, ndim=1] result
     */

    static PyObject *__pyx_pf_3lib_8array_to_timestamp(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr) {
      int __pyx_v_i;
      int __pyx_v_n;
      PyArrayObject *__pyx_v_result = 0;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_arr;
      __Pyx_Buffer __pyx_pybuffer_arr;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
      __Pyx_Buffer __pyx_pybuffer_result;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("array_to_timestamp", 0);
      __pyx_pybuffer_result.pybuffer.buf = NULL;
      __pyx_pybuffer_result.refcount = 0;
      __pyx_pybuffernd_result.data = NULL;
      __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
      __pyx_pybuffer_arr.pybuffer.buf = NULL;
      __pyx_pybuffer_arr.refcount = 0;
      __pyx_pybuffernd_arr.data = NULL;
      __pyx_pybuffernd_arr.rcbuffer = &__pyx_pybuffer_arr;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_arr.rcbuffer->pybuffer, (PyObject*)__pyx_v_arr, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_arr.diminfo[0].strides = __pyx_pybuffernd_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_arr.diminfo[0].shape = __pyx_pybuffernd_arr.rcbuffer->pybuffer.shape[0];

      /* "lib.pyx":139
     *     return gmtime(dt)
     *
     * def array_to_timestamp(ndarray[object, ndim=1] arr):             # <<<<<<<<<<<<<<
     *     cdef int i, n
     *     cdef ndarray[int64_t, ndim=1] result
     */
      __pyx_k_tuple_100 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_100)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_100);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__arr));
      PyTuple_SET_ITEM(__pyx_k_tuple_100, 0, ((PyObject *)__pyx_n_s__arr));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__arr));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_100, 1, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_100, 2, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
      PyTuple_SET_ITEM(__pyx_k_tuple_100, 3, ((PyObject *)__pyx_n_s__result));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_100));

      /* "lib.pyx":139
     *     return gmtime(dt)
     *
     * def array_to_timestamp(ndarray[object, ndim=1] arr):             # <<<<<<<<<<<<<<
     *     cdef int i, n
     *     cdef ndarray[int64_t, ndim=1] result
     */
      __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_3lib_9array_to_timestamp, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__array_to_timestamp, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_k_codeobj_101 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_100, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__array_to_timestamp, 139, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_101)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     140:     cdef int i, n

     141:     cdef ndarray[int64_t, ndim=1] result

     142:

     143:     n = len(arr)

      /* "lib.pyx":143
     *     cdef ndarray[int64_t, ndim=1] result
     *
     *     n = len(arr)             # <<<<<<<<<<<<<<
     *     result = np.empty(n, dtype=np.int64)
     *
     */
      __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_arr)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_n = __pyx_t_1;

     144:     result = np.empty(n, dtype=np.int64)

      /* "lib.pyx":144
     *
     *     n = len(arr)
     *     result = np.empty(n, dtype=np.int64)             # <<<<<<<<<<<<<<
     *
     *     for i from 0 <= i < n:
     */
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyInt_FromLong(__pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
        __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_8 < 0)) {
          PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
          }
        }
        __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_7 = 0;
      __pyx_v_result = ((PyArrayObject *)__pyx_t_6);
      __pyx_t_6 = 0;

     145:

     146:     for i from 0 <= i < n:

      /* "lib.pyx":146
     *     result = np.empty(n, dtype=np.int64)
     *
     *     for i from 0 <= i < n:             # <<<<<<<<<<<<<<
     *         result[i] = gmtime(arr[i])
     *
     */
      __pyx_t_8 = __pyx_v_n;
      for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_8; __pyx_v_i++) {

     147:         result[i] = gmtime(arr[i])

        /* "lib.pyx":147
     *
     *     for i from 0 <= i < n:
     *         result[i] = gmtime(arr[i])             # <<<<<<<<<<<<<<
     *
     *     return result
     */
        __pyx_t_12 = __pyx_v_i;
        __pyx_t_13 = -1;
        if (__pyx_t_12 < 0) {
          __pyx_t_12 += __pyx_pybuffernd_arr.diminfo[0].shape;
          if (unlikely(__pyx_t_12 < 0)) __pyx_t_13 = 0;
        } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_arr.diminfo[0].shape)) __pyx_t_13 = 0;
        if (unlikely(__pyx_t_13 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_13);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_arr.diminfo[0].strides);
        __Pyx_INCREF((PyObject*)__pyx_t_6);
        __pyx_t_13 = __pyx_v_i;
        __pyx_t_14 = -1;
        if (__pyx_t_13 < 0) {
          __pyx_t_13 += __pyx_pybuffernd_result.diminfo[0].shape;
          if (unlikely(__pyx_t_13 < 0)) __pyx_t_14 = 0;
        } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_result.diminfo[0].shape)) __pyx_t_14 = 0;
        if (unlikely(__pyx_t_14 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_14);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_result.diminfo[0].strides) = __pyx_f_3lib_gmtime(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }

     148:

     149:     return result

      /* "lib.pyx":149
     *         result[i] = gmtime(arr[i])
     *
     *     return result             # <<<<<<<<<<<<<<
     *
     * def time64_to_datetime(ndarray[int64_t, ndim=1] arr):
     */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_result));
      __pyx_r = ((PyObject *)__pyx_v_result);
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.array_to_timestamp", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF((PyObject *)__pyx_v_result);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_11time64_to_datetime(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_11time64_to_datetime = {__Pyx_NAMESTR("time64_to_datetime"), (PyCFunction)__pyx_pw_3lib_11time64_to_datetime, METH_O, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_11time64_to_datetime(PyObject *__pyx_self, PyObject *__pyx_v_arr) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("time64_to_datetime (wrapper)", 0);
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_10time64_to_datetime(__pyx_self, ((PyArrayObject *)__pyx_v_arr));
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     150:

     151: def time64_to_datetime(ndarray[int64_t, ndim=1] arr):

    /* "lib.pyx":151
     *     return result
     *
     * def time64_to_datetime(ndarray[int64_t, ndim=1] arr):             # <<<<<<<<<<<<<<
     *     cdef int i, n
     *     cdef ndarray[object, ndim=1] result
     */

    static PyObject *__pyx_pf_3lib_10time64_to_datetime(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr) {
      int __pyx_v_i;
      int __pyx_v_n;
      PyArrayObject *__pyx_v_result = 0;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_arr;
      __Pyx_Buffer __pyx_pybuffer_arr;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
      __Pyx_Buffer __pyx_pybuffer_result;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("time64_to_datetime", 0);
      __pyx_pybuffer_result.pybuffer.buf = NULL;
      __pyx_pybuffer_result.refcount = 0;
      __pyx_pybuffernd_result.data = NULL;
      __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
      __pyx_pybuffer_arr.pybuffer.buf = NULL;
      __pyx_pybuffer_arr.refcount = 0;
      __pyx_pybuffernd_arr.data = NULL;
      __pyx_pybuffernd_arr.rcbuffer = &__pyx_pybuffer_arr;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_arr.rcbuffer->pybuffer, (PyObject*)__pyx_v_arr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_arr.diminfo[0].strides = __pyx_pybuffernd_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_arr.diminfo[0].shape = __pyx_pybuffernd_arr.rcbuffer->pybuffer.shape[0];

      /* "lib.pyx":151
     *     return result
     *
     * def time64_to_datetime(ndarray[int64_t, ndim=1] arr):             # <<<<<<<<<<<<<<
     *     cdef int i, n
     *     cdef ndarray[object, ndim=1] result
     */
      __pyx_k_tuple_102 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_102)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_102);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__arr));
      PyTuple_SET_ITEM(__pyx_k_tuple_102, 0, ((PyObject *)__pyx_n_s__arr));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__arr));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_102, 1, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_102, 2, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
      PyTuple_SET_ITEM(__pyx_k_tuple_102, 3, ((PyObject *)__pyx_n_s__result));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_102));

      /* "lib.pyx":151
     *     return result
     *
     * def time64_to_datetime(ndarray[int64_t, ndim=1] arr):             # <<<<<<<<<<<<<<
     *     cdef int i, n
     *     cdef ndarray[object, ndim=1] result
     */
      __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_3lib_11time64_to_datetime, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__time64_to_datetime, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_k_codeobj_103 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_102, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__time64_to_datetime, 151, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_103)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     152:     cdef int i, n

     153:     cdef ndarray[object, ndim=1] result

     154:

     155:     n = len(arr)

      /* "lib.pyx":155
     *     cdef ndarray[object, ndim=1] result
     *
     *     n = len(arr)             # <<<<<<<<<<<<<<
     *     result = np.empty(n, dtype=object)
     *
     */
      __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_arr)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_n = __pyx_t_1;

     156:     result = np.empty(n, dtype=object)

      /* "lib.pyx":156
     *
     *     n = len(arr)
     *     result = np.empty(n, dtype=object)             # <<<<<<<<<<<<<<
     *
     *     for i from 0 <= i < n:
     */
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyInt_FromLong(__pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
        __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_7 < 0)) {
          PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
          }
        }
        __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_6 = 0;
      __pyx_v_result = ((PyArrayObject *)__pyx_t_5);
      __pyx_t_5 = 0;

     157:

     158:     for i from 0 <= i < n:

      /* "lib.pyx":158
     *     result = np.empty(n, dtype=object)
     *
     *     for i from 0 <= i < n:             # <<<<<<<<<<<<<<
     *         result[i] = to_datetime(arr[i])
     *
     */
      __pyx_t_7 = __pyx_v_n;
      for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) {

     159:         result[i] = to_datetime(arr[i])

        /* "lib.pyx":159
     *
     *     for i from 0 <= i < n:
     *         result[i] = to_datetime(arr[i])             # <<<<<<<<<<<<<<
     *
     *     return result
     */
        __pyx_t_11 = __pyx_v_i;
        __pyx_t_12 = -1;
        if (__pyx_t_11 < 0) {
          __pyx_t_11 += __pyx_pybuffernd_arr.diminfo[0].shape;
          if (unlikely(__pyx_t_11 < 0)) __pyx_t_12 = 0;
        } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_arr.diminfo[0].shape)) __pyx_t_12 = 0;
        if (unlikely(__pyx_t_12 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_12);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_5 = __pyx_f_3lib_to_datetime((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_arr.diminfo[0].strides)), 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_12 = __pyx_v_i;
        __pyx_t_13 = -1;
        if (__pyx_t_12 < 0) {
          __pyx_t_12 += __pyx_pybuffernd_result.diminfo[0].shape;
          if (unlikely(__pyx_t_12 < 0)) __pyx_t_13 = 0;
        } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_result.diminfo[0].shape)) __pyx_t_13 = 0;
        if (unlikely(__pyx_t_13 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_13);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_14 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_result.diminfo[0].strides);
        __Pyx_GOTREF(*__pyx_t_14);
        __Pyx_INCREF(__pyx_t_5); __Pyx_DECREF(*__pyx_t_14);
        *__pyx_t_14 = __pyx_t_5;
        __Pyx_GIVEREF(*__pyx_t_14);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }

     160:

     161:     return result

      /* "lib.pyx":161
     *         result[i] = to_datetime(arr[i])
     *
     *     return result             # <<<<<<<<<<<<<<
     *
     * #----------------------------------------------------------------------
     */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_result));
      __pyx_r = ((PyObject *)__pyx_v_result);
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.time64_to_datetime", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF((PyObject *)__pyx_v_result);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     162:

     163: #----------------------------------------------------------------------

     164: # isnull / notnull related

     165:

     166: cdef double INF = <double> np.inf

      /* "lib.pyx":166
     * # isnull / notnull related
     *
     * cdef double INF = <double> np.inf             # <<<<<<<<<<<<<<
     * cdef double NEGINF = -INF
     *
     */
      __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__inf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_3lib_INF = ((double)__pyx_t_4);

     167: cdef double NEGINF = -INF

      /* "lib.pyx":167
     *
     * cdef double INF = <double> np.inf
     * cdef double NEGINF = -INF             # <<<<<<<<<<<<<<
     *
     *
     */
      __pyx_v_3lib_NEGINF = (-__pyx_v_3lib_INF);

     168:

     169:

     170: cpdef checknull(object val):

    /* "lib.pyx":170
     *
     *
     * cpdef checknull(object val):             # <<<<<<<<<<<<<<
     *     if util.is_float_object(val) or util.is_complex_object(val):
     *         return val != val # and val != INF and val != NEGINF
     */

    static PyObject *__pyx_pw_3lib_13checknull(PyObject *__pyx_self, PyObject *__pyx_v_val); /*proto*/
    static PyObject *__pyx_f_3lib_checknull(PyObject *__pyx_v_val, CYTHON_UNUSED int __pyx_skip_dispatch) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("checknull", 0);

    /* "lib.pyx":170
     *
     *
     * cpdef checknull(object val):             # <<<<<<<<<<<<<<
     *     if util.is_float_object(val) or util.is_complex_object(val):
     *         return val != val # and val != INF and val != NEGINF
     */

    static PyObject *__pyx_pf_3lib_12checknull(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_val) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("checknull", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_3lib_checknull(__pyx_v_val, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("lib.checknull", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     171:     if util.is_float_object(val) or util.is_complex_object(val):

      /* "lib.pyx":171
     *
     * cpdef checknull(object val):
     *     if util.is_float_object(val) or util.is_complex_object(val):             # <<<<<<<<<<<<<<
     *         return val != val # and val != INF and val != NEGINF
     *     elif util.is_datetime64_object(val):
     */
      __pyx_t_1 = is_float_object(__pyx_v_val);
      if (!__pyx_t_1) {
        __pyx_t_2 = is_complex_object(__pyx_v_val);
        __pyx_t_3 = __pyx_t_2;
      } else {
        __pyx_t_3 = __pyx_t_1;
      }
      if (__pyx_t_3) {

     172:         return val != val # and val != INF and val != NEGINF

        /* "lib.pyx":172
     * cpdef checknull(object val):
     *     if util.is_float_object(val) or util.is_complex_object(val):
     *         return val != val # and val != INF and val != NEGINF             # <<<<<<<<<<<<<<
     *     elif util.is_datetime64_object(val):
     *         return get_datetime64_value(val) == NPY_NAT
     */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_4 = PyObject_RichCompare(__pyx_v_val, __pyx_v_val, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_r = __pyx_t_4;
        __pyx_t_4 = 0;
        goto __pyx_L0;
        goto __pyx_L3;
      }

     173:     elif util.is_datetime64_object(val):

      /* "lib.pyx":173
     *     if util.is_float_object(val) or util.is_complex_object(val):
     *         return val != val # and val != INF and val != NEGINF
     *     elif util.is_datetime64_object(val):             # <<<<<<<<<<<<<<
     *         return get_datetime64_value(val) == NPY_NAT
     *     elif val is NaT:
     */
      __pyx_t_1 = is_datetime64_object(__pyx_v_val);
      if (__pyx_t_1) {

     174:         return get_datetime64_value(val) == NPY_NAT

        /* "lib.pyx":174
     *         return val != val # and val != INF and val != NEGINF
     *     elif util.is_datetime64_object(val):
     *         return get_datetime64_value(val) == NPY_NAT             # <<<<<<<<<<<<<<
     *     elif val is NaT:
     *         return True
     */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_4 = __Pyx_PyBool_FromLong((get_datetime64_value(__pyx_v_val) == __pyx_v_3lib_NPY_NAT)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_r = __pyx_t_4;
        __pyx_t_4 = 0;
        goto __pyx_L0;
        goto __pyx_L3;
      }

     175:     elif val is NaT:

      /* "lib.pyx":175
     *     elif util.is_datetime64_object(val):
     *         return get_datetime64_value(val) == NPY_NAT
     *     elif val is NaT:             # <<<<<<<<<<<<<<
     *         return True
     *     elif is_array(val):
     */
      __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__NaT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = (__pyx_v_val == __pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_3) {

     176:         return True

        /* "lib.pyx":176
     *         return get_datetime64_value(val) == NPY_NAT
     *     elif val is NaT:
     *         return True             # <<<<<<<<<<<<<<
     *     elif is_array(val):
     *         return False
     */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_r = __pyx_t_4;
        __pyx_t_4 = 0;
        goto __pyx_L0;
        goto __pyx_L3;
      }

     177:     elif is_array(val):

      /* "lib.pyx":177
     *     elif val is NaT:
     *         return True
     *     elif is_array(val):             # <<<<<<<<<<<<<<
     *         return False
     *     else:
     */
      __pyx_t_4 = __pyx_f_4util_is_array(__pyx_v_val); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_3) {

     178:         return False

        /* "lib.pyx":178
     *         return True
     *     elif is_array(val):
     *         return False             # <<<<<<<<<<<<<<
     *     else:
     *         return util._checknull(val)
     */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_r = __pyx_t_4;
        __pyx_t_4 = 0;
        goto __pyx_L0;
        goto __pyx_L3;
      }
      /*else*/ {

     179:     else:

     180:         return util._checknull(val)

        /* "lib.pyx":180
     *         return False
     *     else:
     *         return util._checknull(val)             # <<<<<<<<<<<<<<
     *
     * cpdef checknull_old(object val):
     */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_f_4util__checknull(__pyx_v_val)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_r = __pyx_t_4;
        __pyx_t_4 = 0;
        goto __pyx_L0;
      }
      __pyx_L3:;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_AddTraceback("lib.checknull", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_13checknull(PyObject *__pyx_self, PyObject *__pyx_v_val); /*proto*/
    static PyObject *__pyx_pw_3lib_13checknull(PyObject *__pyx_self, PyObject *__pyx_v_val) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("checknull (wrapper)", 0);
      __pyx_r = __pyx_pf_3lib_12checknull(__pyx_self, ((PyObject *)__pyx_v_val));
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     181:

     182: cpdef checknull_old(object val):

    /* "lib.pyx":182
     *         return util._checknull(val)
     *
     * cpdef checknull_old(object val):             # <<<<<<<<<<<<<<
     *     if util.is_float_object(val) or util.is_complex_object(val):
     *         return val != val or val == INF or val == NEGINF
     */

    static PyObject *__pyx_pw_3lib_15checknull_old(PyObject *__pyx_self, PyObject *__pyx_v_val); /*proto*/
    static PyObject *__pyx_f_3lib_checknull_old(PyObject *__pyx_v_val, CYTHON_UNUSED int __pyx_skip_dispatch) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("checknull_old", 0);

    /* "lib.pyx":182
     *         return util._checknull(val)
     *
     * cpdef checknull_old(object val):             # <<<<<<<<<<<<<<
     *     if util.is_float_object(val) or util.is_complex_object(val):
     *         return val != val or val == INF or val == NEGINF
     */

    static PyObject *__pyx_pf_3lib_14checknull_old(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_val) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("checknull_old", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_3lib_checknull_old(__pyx_v_val, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("lib.checknull_old", __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_3lib_17isscalar(PyObject *__pyx_self, PyObject *__pyx_v_val); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_17isscalar = {__Pyx_NAMESTR("isscalar"), (PyCFunction)__pyx_pw_3lib_17isscalar, METH_O, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_17isscalar(PyObject *__pyx_self, PyObject *__pyx_v_val) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("isscalar (wrapper)", 0);
      __pyx_r = __pyx_pf_3lib_16isscalar(__pyx_self, ((PyObject *)__pyx_v_val));
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     183:     if util.is_float_object(val) or util.is_complex_object(val):

      /* "lib.pyx":183
     *
     * cpdef checknull_old(object val):
     *     if util.is_float_object(val) or util.is_complex_object(val):             # <<<<<<<<<<<<<<
     *         return val != val or val == INF or val == NEGINF
     *     elif util.is_datetime64_object(val):
     */
      __pyx_t_1 = is_float_object(__pyx_v_val);
      if (!__pyx_t_1) {
        __pyx_t_2 = is_complex_object(__pyx_v_val);
        __pyx_t_3 = __pyx_t_2;
      } else {
        __pyx_t_3 = __pyx_t_1;
      }
      if (__pyx_t_3) {

     184:         return val != val or val == INF or val == NEGINF

        /* "lib.pyx":184
     * cpdef checknull_old(object val):
     *     if util.is_float_object(val) or util.is_complex_object(val):
     *         return val != val or val == INF or val == NEGINF             # <<<<<<<<<<<<<<
     *     elif util.is_datetime64_object(val):
     *         return get_datetime64_value(val) == NPY_NAT
     */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_4 = PyObject_RichCompare(__pyx_v_val, __pyx_v_val, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        if (!__pyx_t_3) {
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_5 = PyFloat_FromDouble(__pyx_v_3lib_INF); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_6 = PyObject_RichCompare(__pyx_v_val, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          if (!__pyx_t_3) {
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __pyx_t_5 = PyFloat_FromDouble(__pyx_v_3lib_NEGINF); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_7 = PyObject_RichCompare(__pyx_v_val, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __pyx_t_5 = __pyx_t_7;
            __pyx_t_7 = 0;
          } else {
            __pyx_t_5 = __pyx_t_6;
            __pyx_t_6 = 0;
          }
          __pyx_t_6 = __pyx_t_5;
          __pyx_t_5 = 0;
        } else {
          __pyx_t_6 = __pyx_t_4;
          __pyx_t_4 = 0;
        }
        __pyx_r = __pyx_t_6;
        __pyx_t_6 = 0;
        goto __pyx_L0;
        goto __pyx_L3;
      }

     185:     elif util.is_datetime64_object(val):

      /* "lib.pyx":185
     *     if util.is_float_object(val) or util.is_complex_object(val):
     *         return val != val or val == INF or val == NEGINF
     *     elif util.is_datetime64_object(val):             # <<<<<<<<<<<<<<
     *         return get_datetime64_value(val) == NPY_NAT
     *     elif val is NaT:
     */
      __pyx_t_1 = is_datetime64_object(__pyx_v_val);
      if (__pyx_t_1) {

     186:         return get_datetime64_value(val) == NPY_NAT

        /* "lib.pyx":186
     *         return val != val or val == INF or val == NEGINF
     *     elif util.is_datetime64_object(val):
     *         return get_datetime64_value(val) == NPY_NAT             # <<<<<<<<<<<<<<
     *     elif val is NaT:
     *         return True
     */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_6 = __Pyx_PyBool_FromLong((get_datetime64_value(__pyx_v_val) == __pyx_v_3lib_NPY_NAT)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_r = __pyx_t_6;
        __pyx_t_6 = 0;
        goto __pyx_L0;
        goto __pyx_L3;
      }

     187:     elif val is NaT:

      /* "lib.pyx":187
     *     elif util.is_datetime64_object(val):
     *         return get_datetime64_value(val) == NPY_NAT
     *     elif val is NaT:             # <<<<<<<<<<<<<<
     *         return True
     *     elif is_array(val):
     */
      __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__NaT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_3 = (__pyx_v_val == __pyx_t_6);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_3) {

     188:         return True

        /* "lib.pyx":188
     *         return get_datetime64_value(val) == NPY_NAT
     *     elif val is NaT:
     *         return True             # <<<<<<<<<<<<<<
     *     elif is_array(val):
     *         return False
     */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_6 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_r = __pyx_t_6;
        __pyx_t_6 = 0;
        goto __pyx_L0;
        goto __pyx_L3;
      }

     189:     elif is_array(val):

      /* "lib.pyx":189
     *     elif val is NaT:
     *         return True
     *     elif is_array(val):             # <<<<<<<<<<<<<<
     *         return False
     *     else:
     */
      __pyx_t_6 = __pyx_f_4util_is_array(__pyx_v_val); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_3) {

     190:         return False

        /* "lib.pyx":190
     *         return True
     *     elif is_array(val):
     *         return False             # <<<<<<<<<<<<<<
     *     else:
     *         return util._checknull(val)
     */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_6 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_r = __pyx_t_6;
        __pyx_t_6 = 0;
        goto __pyx_L0;
        goto __pyx_L3;
      }
      /*else*/ {

     191:     else:

     192:         return util._checknull(val)

        /* "lib.pyx":192
     *         return False
     *     else:
     *         return util._checknull(val)             # <<<<<<<<<<<<<<
     *
     * def isscalar(object val):
     */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_f_4util__checknull(__pyx_v_val)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_r = __pyx_t_6;
        __pyx_t_6 = 0;
        goto __pyx_L0;
      }
      __pyx_L3:;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_AddTraceback("lib.checknull_old", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_15checknull_old(PyObject *__pyx_self, PyObject *__pyx_v_val); /*proto*/
    static PyObject *__pyx_pw_3lib_15checknull_old(PyObject *__pyx_self, PyObject *__pyx_v_val) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("checknull_old (wrapper)", 0);
      __pyx_r = __pyx_pf_3lib_14checknull_old(__pyx_self, ((PyObject *)__pyx_v_val));
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     193:

     194: def isscalar(object val):

    /* "lib.pyx":194
     *         return util._checknull(val)
     *
     * def isscalar(object val):             # <<<<<<<<<<<<<<
     *     return np.isscalar(val) or val is None or PyDateTime_Check(val)
     *
     */

    static PyObject *__pyx_pf_3lib_16isscalar(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_val) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("isscalar", 0);

      /* "lib.pyx":194
     *         return util._checknull(val)
     *
     * def isscalar(object val):             # <<<<<<<<<<<<<<
     *     return np.isscalar(val) or val is None or PyDateTime_Check(val)
     *
     */
      __pyx_k_tuple_104 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_104)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_104);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
      PyTuple_SET_ITEM(__pyx_k_tuple_104, 0, ((PyObject *)__pyx_n_s__val));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_104));

      /* "lib.pyx":194
     *         return util._checknull(val)
     *
     * def isscalar(object val):             # <<<<<<<<<<<<<<
     *     return np.isscalar(val) or val is None or PyDateTime_Check(val)
     *
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_17isscalar, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__isscalar, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_105 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_104, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__isscalar, 194, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_105)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     195:     return np.isscalar(val) or val is None or PyDateTime_Check(val)

      /* "lib.pyx":195
     *
     * def isscalar(object val):
     *     return np.isscalar(val) or val is None or PyDateTime_Check(val)             # <<<<<<<<<<<<<<
     *
     *
     */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__isscalar); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_val);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_val);
      __Pyx_GIVEREF(__pyx_v_val);
      __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (!__pyx_t_4) {
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_4 = (__pyx_v_val == Py_None);
        if (!__pyx_t_4) {
          __pyx_t_5 = PyDateTime_Check(__pyx_v_val);
          __pyx_t_6 = __pyx_t_5;
        } else {
          __pyx_t_6 = __pyx_t_4;
        }
        __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __pyx_t_1;
        __pyx_t_1 = 0;
      } else {
        __pyx_t_2 = __pyx_t_3;
        __pyx_t_3 = 0;
      }
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_AddTraceback("lib.isscalar", __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_3lib_19isnullobj(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_19isnullobj = {__Pyx_NAMESTR("isnullobj"), (PyCFunction)__pyx_pw_3lib_19isnullobj, METH_O, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_19isnullobj(PyObject *__pyx_self, PyObject *__pyx_v_arr) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("isnullobj (wrapper)", 0);
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_18isnullobj(__pyx_self, ((PyArrayObject *)__pyx_v_arr));
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     196:

     197:

     198: @cython.wraparound(False)

     199: @cython.boundscheck(False)

     200: def isnullobj(ndarray[object] arr):

    /* "lib.pyx":200
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def isnullobj(ndarray[object] arr):             # <<<<<<<<<<<<<<
     *     cdef Py_ssize_t i, n
     *     cdef object val
     */

    static PyObject *__pyx_pf_3lib_18isnullobj(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr) {
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_n;
      PyArrayObject *__pyx_v_result = 0;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_arr;
      __Pyx_Buffer __pyx_pybuffer_arr;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
      __Pyx_Buffer __pyx_pybuffer_result;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("isnullobj", 0);
      __pyx_pybuffer_result.pybuffer.buf = NULL;
      __pyx_pybuffer_result.refcount = 0;
      __pyx_pybuffernd_result.data = NULL;
      __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
      __pyx_pybuffer_arr.pybuffer.buf = NULL;
      __pyx_pybuffer_arr.refcount = 0;
      __pyx_pybuffernd_arr.data = NULL;
      __pyx_pybuffernd_arr.rcbuffer = &__pyx_pybuffer_arr;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_arr.rcbuffer->pybuffer, (PyObject*)__pyx_v_arr, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_arr.diminfo[0].strides = __pyx_pybuffernd_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_arr.diminfo[0].shape = __pyx_pybuffernd_arr.rcbuffer->pybuffer.shape[0];

      /* "lib.pyx":200
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def isnullobj(ndarray[object] arr):             # <<<<<<<<<<<<<<
     *     cdef Py_ssize_t i, n
     *     cdef object val
     */
      __pyx_k_tuple_106 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_106)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_106);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__arr));
      PyTuple_SET_ITEM(__pyx_k_tuple_106, 0, ((PyObject *)__pyx_n_s__arr));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__arr));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_106, 1, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_106, 2, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
      PyTuple_SET_ITEM(__pyx_k_tuple_106, 3, ((PyObject *)__pyx_n_s__val));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
      PyTuple_SET_ITEM(__pyx_k_tuple_106, 4, ((PyObject *)__pyx_n_s__result));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_106));

      /* "lib.pyx":200
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def isnullobj(ndarray[object] arr):             # <<<<<<<<<<<<<<
     *     cdef Py_ssize_t i, n
     *     cdef object val
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_19isnullobj, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__isnullobj, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_107 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_106, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__isnullobj, 200, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_107)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     201:     cdef Py_ssize_t i, n

     202:     cdef object val

     203:     cdef ndarray[uint8_t] result

     204:

     205:     n = len(arr)

      /* "lib.pyx":205
     *     cdef ndarray[uint8_t] result
     *
     *     n = len(arr)             # <<<<<<<<<<<<<<
     *     result = np.zeros(n, dtype=np.uint8)
     *     for i from 0 <= i < n:
     */
      __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_arr)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_n = __pyx_t_1;

     206:     result = np.zeros(n, dtype=np.uint8)

      /* "lib.pyx":206
     *
     *     n = len(arr)
     *     result = np.zeros(n, dtype=np.uint8)             # <<<<<<<<<<<<<<
     *     for i from 0 <= i < n:
     *         result[i] = util._checknull(arr[i])
     */
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__uint8); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
        __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_8 < 0)) {
          PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
          }
        }
        __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_7 = 0;
      __pyx_v_result = ((PyArrayObject *)__pyx_t_6);
      __pyx_t_6 = 0;

     207:     for i from 0 <= i < n:

      /* "lib.pyx":207
     *     n = len(arr)
     *     result = np.zeros(n, dtype=np.uint8)
     *     for i from 0 <= i < n:             # <<<<<<<<<<<<<<
     *         result[i] = util._checknull(arr[i])
     *     return result.view(np.bool_)
     */
      __pyx_t_1 = __pyx_v_n;
      for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) {

     208:         result[i] = util._checknull(arr[i])

        /* "lib.pyx":208
     *     result = np.zeros(n, dtype=np.uint8)
     *     for i from 0 <= i < n:
     *         result[i] = util._checknull(arr[i])             # <<<<<<<<<<<<<<
     *     return result.view(np.bool_)
     *
     */
        __pyx_t_12 = __pyx_v_i;
        __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_arr.diminfo[0].strides);
        __Pyx_INCREF((PyObject*)__pyx_t_6);
        __pyx_t_13 = __pyx_v_i;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_result.diminfo[0].strides) = __pyx_f_4util__checknull(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }

     209:     return result.view(np.bool_)

      /* "lib.pyx":209
     *     for i from 0 <= i < n:
     *         result[i] = util._checknull(arr[i])
     *     return result.view(np.bool_)             # <<<<<<<<<<<<<<
     *
     * @cython.wraparound(False)
     */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__view); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__bool_); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.isnullobj", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF((PyObject *)__pyx_v_result);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_21isnullobj_old(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_21isnullobj_old = {__Pyx_NAMESTR("isnullobj_old"), (PyCFunction)__pyx_pw_3lib_21isnullobj_old, METH_O, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_21isnullobj_old(PyObject *__pyx_self, PyObject *__pyx_v_arr) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("isnullobj_old (wrapper)", 0);
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_20isnullobj_old(__pyx_self, ((PyArrayObject *)__pyx_v_arr));
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     210:

     211: @cython.wraparound(False)

     212: @cython.boundscheck(False)

     213: def isnullobj_old(ndarray[object] arr):

    /* "lib.pyx":213
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def isnullobj_old(ndarray[object] arr):             # <<<<<<<<<<<<<<
     *     cdef Py_ssize_t i, n
     *     cdef object val
     */

    static PyObject *__pyx_pf_3lib_20isnullobj_old(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr) {
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_n;
      PyArrayObject *__pyx_v_result = 0;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_arr;
      __Pyx_Buffer __pyx_pybuffer_arr;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
      __Pyx_Buffer __pyx_pybuffer_result;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("isnullobj_old", 0);
      __pyx_pybuffer_result.pybuffer.buf = NULL;
      __pyx_pybuffer_result.refcount = 0;
      __pyx_pybuffernd_result.data = NULL;
      __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
      __pyx_pybuffer_arr.pybuffer.buf = NULL;
      __pyx_pybuffer_arr.refcount = 0;
      __pyx_pybuffernd_arr.data = NULL;
      __pyx_pybuffernd_arr.rcbuffer = &__pyx_pybuffer_arr;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_arr.rcbuffer->pybuffer, (PyObject*)__pyx_v_arr, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_arr.diminfo[0].strides = __pyx_pybuffernd_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_arr.diminfo[0].shape = __pyx_pybuffernd_arr.rcbuffer->pybuffer.shape[0];

      /* "lib.pyx":213
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def isnullobj_old(ndarray[object] arr):             # <<<<<<<<<<<<<<
     *     cdef Py_ssize_t i, n
     *     cdef object val
     */
      __pyx_k_tuple_108 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_108)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_108);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__arr));
      PyTuple_SET_ITEM(__pyx_k_tuple_108, 0, ((PyObject *)__pyx_n_s__arr));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__arr));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_108, 1, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_108, 2, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
      PyTuple_SET_ITEM(__pyx_k_tuple_108, 3, ((PyObject *)__pyx_n_s__val));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
      PyTuple_SET_ITEM(__pyx_k_tuple_108, 4, ((PyObject *)__pyx_n_s__result));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_108));

      /* "lib.pyx":213
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def isnullobj_old(ndarray[object] arr):             # <<<<<<<<<<<<<<
     *     cdef Py_ssize_t i, n
     *     cdef object val
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_21isnullobj_old, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__isnullobj_old, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_109 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_108, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__isnullobj_old, 213, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_109)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     214:     cdef Py_ssize_t i, n

     215:     cdef object val

     216:     cdef ndarray[uint8_t] result

     217:

     218:     n = len(arr)

      /* "lib.pyx":218
     *     cdef ndarray[uint8_t] result
     *
     *     n = len(arr)             # <<<<<<<<<<<<<<
     *     result = np.zeros(n, dtype=np.uint8)
     *     for i from 0 <= i < n:
     */
      __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_arr)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_n = __pyx_t_1;

     219:     result = np.zeros(n, dtype=np.uint8)

      /* "lib.pyx":219
     *
     *     n = len(arr)
     *     result = np.zeros(n, dtype=np.uint8)             # <<<<<<<<<<<<<<
     *     for i from 0 <= i < n:
     *         result[i] = util._checknull_old(arr[i])
     */
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__uint8); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
        __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_8 < 0)) {
          PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
          }
        }
        __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_7 = 0;
      __pyx_v_result = ((PyArrayObject *)__pyx_t_6);
      __pyx_t_6 = 0;

     220:     for i from 0 <= i < n:

      /* "lib.pyx":220
     *     n = len(arr)
     *     result = np.zeros(n, dtype=np.uint8)
     *     for i from 0 <= i < n:             # <<<<<<<<<<<<<<
     *         result[i] = util._checknull_old(arr[i])
     *     return result.view(np.bool_)
     */
      __pyx_t_1 = __pyx_v_n;
      for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) {

     221:         result[i] = util._checknull_old(arr[i])

        /* "lib.pyx":221
     *     result = np.zeros(n, dtype=np.uint8)
     *     for i from 0 <= i < n:
     *         result[i] = util._checknull_old(arr[i])             # <<<<<<<<<<<<<<
     *     return result.view(np.bool_)
     *
     */
        __pyx_t_12 = __pyx_v_i;
        __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_arr.diminfo[0].strides);
        __Pyx_INCREF((PyObject*)__pyx_t_6);
        __pyx_t_13 = __pyx_v_i;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_result.diminfo[0].strides) = __pyx_f_4util__checknull_old(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }

     222:     return result.view(np.bool_)

      /* "lib.pyx":222
     *     for i from 0 <= i < n:
     *         result[i] = util._checknull_old(arr[i])
     *     return result.view(np.bool_)             # <<<<<<<<<<<<<<
     *
     *
     */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__view); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__bool_); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.isnullobj_old", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF((PyObject *)__pyx_v_result);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_23isnullobj2d(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_23isnullobj2d = {__Pyx_NAMESTR("isnullobj2d"), (PyCFunction)__pyx_pw_3lib_23isnullobj2d, METH_O, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_23isnullobj2d(PyObject *__pyx_self, PyObject *__pyx_v_arr) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("isnullobj2d (wrapper)", 0);
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_22isnullobj2d(__pyx_self, ((PyArrayObject *)__pyx_v_arr));
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     223:

     224:

     225: @cython.wraparound(False)

     226: @cython.boundscheck(False)

     227: def isnullobj2d(ndarray[object, ndim=2] arr):

    /* "lib.pyx":227
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def isnullobj2d(ndarray[object, ndim=2] arr):             # <<<<<<<<<<<<<<
     *     cdef Py_ssize_t i, j, n, m
     *     cdef object val
     */

    static PyObject *__pyx_pf_3lib_22isnullobj2d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr) {
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_j;
      Py_ssize_t __pyx_v_n;
      Py_ssize_t __pyx_v_m;
      PyObject *__pyx_v_val = 0;
      PyArrayObject *__pyx_v_result = 0;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_arr;
      __Pyx_Buffer __pyx_pybuffer_arr;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
      __Pyx_Buffer __pyx_pybuffer_result;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("isnullobj2d", 0);
      __pyx_pybuffer_result.pybuffer.buf = NULL;
      __pyx_pybuffer_result.refcount = 0;
      __pyx_pybuffernd_result.data = NULL;
      __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
      __pyx_pybuffer_arr.pybuffer.buf = NULL;
      __pyx_pybuffer_arr.refcount = 0;
      __pyx_pybuffernd_arr.data = NULL;
      __pyx_pybuffernd_arr.rcbuffer = &__pyx_pybuffer_arr;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_arr.rcbuffer->pybuffer, (PyObject*)__pyx_v_arr, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_arr.diminfo[0].strides = __pyx_pybuffernd_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_arr.diminfo[0].shape = __pyx_pybuffernd_arr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_arr.diminfo[1].strides = __pyx_pybuffernd_arr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_arr.diminfo[1].shape = __pyx_pybuffernd_arr.rcbuffer->pybuffer.shape[1];

      /* "lib.pyx":227
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def isnullobj2d(ndarray[object, ndim=2] arr):             # <<<<<<<<<<<<<<
     *     cdef Py_ssize_t i, j, n, m
     *     cdef object val
     */
      __pyx_k_tuple_110 = PyTuple_New(7); if (unlikely(!__pyx_k_tuple_110)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_110);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__arr));
      PyTuple_SET_ITEM(__pyx_k_tuple_110, 0, ((PyObject *)__pyx_n_s__arr));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__arr));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_110, 1, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
      PyTuple_SET_ITEM(__pyx_k_tuple_110, 2, ((PyObject *)__pyx_n_s__j));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_110, 3, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__m));
      PyTuple_SET_ITEM(__pyx_k_tuple_110, 4, ((PyObject *)__pyx_n_s__m));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__m));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
      PyTuple_SET_ITEM(__pyx_k_tuple_110, 5, ((PyObject *)__pyx_n_s__val));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
      PyTuple_SET_ITEM(__pyx_k_tuple_110, 6, ((PyObject *)__pyx_n_s__result));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_110));

      /* "lib.pyx":227
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def isnullobj2d(ndarray[object, ndim=2] arr):             # <<<<<<<<<<<<<<
     *     cdef Py_ssize_t i, j, n, m
     *     cdef object val
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_23isnullobj2d, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__isnullobj2d, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_111 = (PyObject*)__Pyx_PyCode_New(1, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_110, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__isnullobj2d, 227, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_111)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     228:     cdef Py_ssize_t i, j, n, m

     229:     cdef object val

     230:     cdef ndarray[uint8_t, ndim=2] result

     231:

     232:     n, m = (<object> arr).shape

      /* "lib.pyx":232
     *     cdef ndarray[uint8_t, ndim=2] result
     *
     *     n, m = (<object> arr).shape             # <<<<<<<<<<<<<<
     *     result = np.zeros((n, m), dtype=np.uint8)
     *     for i from 0 <= i < n:
     */
      __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
        PyObject* sequence = __pyx_t_1;
        #if CYTHON_COMPILING_IN_CPYTHON
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
        } else {
          __pyx_t_2 = PyList_GET_ITEM(sequence, 0);
          __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
        }
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        #else
        __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else
      {
        Py_ssize_t index = -1;
        __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
        index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_2);
        index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_3);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_5 = NULL;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L4_unpacking_done;
        __pyx_L3_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_5 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L4_unpacking_done:;
      }
      __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_n = __pyx_t_6;
      __pyx_v_m = __pyx_t_7;

     233:     result = np.zeros((n, m), dtype=np.uint8)

      /* "lib.pyx":233
     *
     *     n, m = (<object> arr).shape
     *     result = np.zeros((n, m), dtype=np.uint8)             # <<<<<<<<<<<<<<
     *     for i from 0 <= i < n:
     *         for j from 0 <= j < m:
     */
      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_m); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_1 = 0;
      __pyx_t_2 = 0;
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_4));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
      __pyx_t_4 = 0;
      __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__uint8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = ((PyArrayObject *)__pyx_t_8);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
        __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_10 < 0)) {
          PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
          }
        }
        __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_result.diminfo[1].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_result.diminfo[1].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_9 = 0;
      __pyx_v_result = ((PyArrayObject *)__pyx_t_8);
      __pyx_t_8 = 0;

     234:     for i from 0 <= i < n:

      /* "lib.pyx":234
     *     n, m = (<object> arr).shape
     *     result = np.zeros((n, m), dtype=np.uint8)
     *     for i from 0 <= i < n:             # <<<<<<<<<<<<<<
     *         for j from 0 <= j < m:
     *             val = arr[i, j]
     */
      __pyx_t_7 = __pyx_v_n;
      for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) {

     235:         for j from 0 <= j < m:

        /* "lib.pyx":235
     *     result = np.zeros((n, m), dtype=np.uint8)
     *     for i from 0 <= i < n:
     *         for j from 0 <= j < m:             # <<<<<<<<<<<<<<
     *             val = arr[i, j]
     *             if checknull(val):
     */
        __pyx_t_6 = __pyx_v_m;
        for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_6; __pyx_v_j++) {

     236:             val = arr[i, j]

          /* "lib.pyx":236
     *     for i from 0 <= i < n:
     *         for j from 0 <= j < m:
     *             val = arr[i, j]             # <<<<<<<<<<<<<<
     *             if checknull(val):
     *                 result[i, j] = 1
     */
          __pyx_t_14 = __pyx_v_i;
          __pyx_t_15 = __pyx_v_j;
          __pyx_t_8 = *__Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_arr.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_arr.diminfo[1].strides);
          __Pyx_INCREF((PyObject*)__pyx_t_8);
          __Pyx_XDECREF(__pyx_v_val);
          __pyx_v_val = __pyx_t_8;
          __pyx_t_8 = 0;

     237:             if checknull(val):

          /* "lib.pyx":237
     *         for j from 0 <= j < m:
     *             val = arr[i, j]
     *             if checknull(val):             # <<<<<<<<<<<<<<
     *                 result[i, j] = 1
     *     return result.view(np.bool_)
     */
          __pyx_t_8 = __pyx_f_3lib_checknull(__pyx_v_val, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (__pyx_t_16) {

     238:                 result[i, j] = 1

            /* "lib.pyx":238
     *             val = arr[i, j]
     *             if checknull(val):
     *                 result[i, j] = 1             # <<<<<<<<<<<<<<
     *     return result.view(np.bool_)
     *
     */
            __pyx_t_17 = __pyx_v_i;
            __pyx_t_18 = __pyx_v_j;
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_result.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_result.diminfo[1].strides) = 1;
            goto __pyx_L9;
          }
          __pyx_L9:;
        }
      }

     239:     return result.view(np.bool_)

      /* "lib.pyx":239
     *             if checknull(val):
     *                 result[i, j] = 1
     *     return result.view(np.bool_)             # <<<<<<<<<<<<<<
     *
     * @cython.wraparound(False)
     */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_8 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__view); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__bool_); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_8);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.isnullobj2d", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF(__pyx_v_val);
      __Pyx_XDECREF((PyObject *)__pyx_v_result);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_25isnullobj_old(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_25isnullobj_old = {__Pyx_NAMESTR("isnullobj_old"), (PyCFunction)__pyx_pw_3lib_25isnullobj_old, METH_O, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_25isnullobj_old(PyObject *__pyx_self, PyObject *__pyx_v_arr) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("isnullobj_old (wrapper)", 0);
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_24isnullobj_old(__pyx_self, ((PyArrayObject *)__pyx_v_arr));
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     240:

     241: @cython.wraparound(False)

     242: @cython.boundscheck(False)

     243: def isnullobj_old(ndarray[object] arr):

    /* "lib.pyx":243
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def isnullobj_old(ndarray[object] arr):             # <<<<<<<<<<<<<<
     *     cdef Py_ssize_t i, n
     *     cdef object val
     */

    static PyObject *__pyx_pf_3lib_24isnullobj_old(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr) {
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_n;
      PyArrayObject *__pyx_v_result = 0;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_arr;
      __Pyx_Buffer __pyx_pybuffer_arr;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
      __Pyx_Buffer __pyx_pybuffer_result;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("isnullobj_old", 0);
      __pyx_pybuffer_result.pybuffer.buf = NULL;
      __pyx_pybuffer_result.refcount = 0;
      __pyx_pybuffernd_result.data = NULL;
      __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
      __pyx_pybuffer_arr.pybuffer.buf = NULL;
      __pyx_pybuffer_arr.refcount = 0;
      __pyx_pybuffernd_arr.data = NULL;
      __pyx_pybuffernd_arr.rcbuffer = &__pyx_pybuffer_arr;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_arr.rcbuffer->pybuffer, (PyObject*)__pyx_v_arr, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_arr.diminfo[0].strides = __pyx_pybuffernd_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_arr.diminfo[0].shape = __pyx_pybuffernd_arr.rcbuffer->pybuffer.shape[0];

      /* "lib.pyx":243
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def isnullobj_old(ndarray[object] arr):             # <<<<<<<<<<<<<<
     *     cdef Py_ssize_t i, n
     *     cdef object val
     */
      __pyx_k_tuple_112 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_112)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_112);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__arr));
      PyTuple_SET_ITEM(__pyx_k_tuple_112, 0, ((PyObject *)__pyx_n_s__arr));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__arr));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_112, 1, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_112, 2, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
      PyTuple_SET_ITEM(__pyx_k_tuple_112, 3, ((PyObject *)__pyx_n_s__val));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
      PyTuple_SET_ITEM(__pyx_k_tuple_112, 4, ((PyObject *)__pyx_n_s__result));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_112));

      /* "lib.pyx":243
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def isnullobj_old(ndarray[object] arr):             # <<<<<<<<<<<<<<
     *     cdef Py_ssize_t i, n
     *     cdef object val
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_25isnullobj_old, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__isnullobj_old, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_113 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_112, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__isnullobj_old, 243, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_113)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     244:     cdef Py_ssize_t i, n

     245:     cdef object val

     246:     cdef ndarray[uint8_t] result

     247:

     248:     n = len(arr)

      /* "lib.pyx":248
     *     cdef ndarray[uint8_t] result
     *
     *     n = len(arr)             # <<<<<<<<<<<<<<
     *     result = np.zeros(n, dtype=np.uint8)
     *     for i from 0 <= i < n:
     */
      __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_arr)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_n = __pyx_t_1;

     249:     result = np.zeros(n, dtype=np.uint8)

      /* "lib.pyx":249
     *
     *     n = len(arr)
     *     result = np.zeros(n, dtype=np.uint8)             # <<<<<<<<<<<<<<
     *     for i from 0 <= i < n:
     *         result[i] = util._checknull_old(arr[i])
     */
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__uint8); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
        __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_8 < 0)) {
          PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
          }
        }
        __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_7 = 0;
      __pyx_v_result = ((PyArrayObject *)__pyx_t_6);
      __pyx_t_6 = 0;

     250:     for i from 0 <= i < n:

      /* "lib.pyx":250
     *     n = len(arr)
     *     result = np.zeros(n, dtype=np.uint8)
     *     for i from 0 <= i < n:             # <<<<<<<<<<<<<<
     *         result[i] = util._checknull_old(arr[i])
     *     return result.view(np.bool_)
     */
      __pyx_t_1 = __pyx_v_n;
      for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) {

     251:         result[i] = util._checknull_old(arr[i])

        /* "lib.pyx":251
     *     result = np.zeros(n, dtype=np.uint8)
     *     for i from 0 <= i < n:
     *         result[i] = util._checknull_old(arr[i])             # <<<<<<<<<<<<<<
     *     return result.view(np.bool_)
     *
     */
        __pyx_t_12 = __pyx_v_i;
        __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_arr.diminfo[0].strides);
        __Pyx_INCREF((PyObject*)__pyx_t_6);
        __pyx_t_13 = __pyx_v_i;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_result.diminfo[0].strides) = __pyx_f_4util__checknull_old(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }

     252:     return result.view(np.bool_)

      /* "lib.pyx":252
     *     for i from 0 <= i < n:
     *         result[i] = util._checknull_old(arr[i])
     *     return result.view(np.bool_)             # <<<<<<<<<<<<<<
     *
     *
     */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__view); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__bool_); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.isnullobj_old", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF((PyObject *)__pyx_v_result);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_27isnullobj2d_old(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_27isnullobj2d_old = {__Pyx_NAMESTR("isnullobj2d_old"), (PyCFunction)__pyx_pw_3lib_27isnullobj2d_old, METH_O, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_27isnullobj2d_old(PyObject *__pyx_self, PyObject *__pyx_v_arr) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("isnullobj2d_old (wrapper)", 0);
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_26isnullobj2d_old(__pyx_self, ((PyArrayObject *)__pyx_v_arr));
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     253:

     254:

     255: @cython.wraparound(False)

     256: @cython.boundscheck(False)

     257: def isnullobj2d_old(ndarray[object, ndim=2] arr):

    /* "lib.pyx":257
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def isnullobj2d_old(ndarray[object, ndim=2] arr):             # <<<<<<<<<<<<<<
     *     cdef Py_ssize_t i, j, n, m
     *     cdef object val
     */

    static PyObject *__pyx_pf_3lib_26isnullobj2d_old(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr) {
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_j;
      Py_ssize_t __pyx_v_n;
      Py_ssize_t __pyx_v_m;
      PyObject *__pyx_v_val = 0;
      PyArrayObject *__pyx_v_result = 0;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_arr;
      __Pyx_Buffer __pyx_pybuffer_arr;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
      __Pyx_Buffer __pyx_pybuffer_result;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("isnullobj2d_old", 0);
      __pyx_pybuffer_result.pybuffer.buf = NULL;
      __pyx_pybuffer_result.refcount = 0;
      __pyx_pybuffernd_result.data = NULL;
      __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
      __pyx_pybuffer_arr.pybuffer.buf = NULL;
      __pyx_pybuffer_arr.refcount = 0;
      __pyx_pybuffernd_arr.data = NULL;
      __pyx_pybuffernd_arr.rcbuffer = &__pyx_pybuffer_arr;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_arr.rcbuffer->pybuffer, (PyObject*)__pyx_v_arr, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_arr.diminfo[0].strides = __pyx_pybuffernd_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_arr.diminfo[0].shape = __pyx_pybuffernd_arr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_arr.diminfo[1].strides = __pyx_pybuffernd_arr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_arr.diminfo[1].shape = __pyx_pybuffernd_arr.rcbuffer->pybuffer.shape[1];

      /* "lib.pyx":257
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def isnullobj2d_old(ndarray[object, ndim=2] arr):             # <<<<<<<<<<<<<<
     *     cdef Py_ssize_t i, j, n, m
     *     cdef object val
     */
      __pyx_k_tuple_114 = PyTuple_New(7); if (unlikely(!__pyx_k_tuple_114)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_114);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__arr));
      PyTuple_SET_ITEM(__pyx_k_tuple_114, 0, ((PyObject *)__pyx_n_s__arr));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__arr));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_114, 1, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
      PyTuple_SET_ITEM(__pyx_k_tuple_114, 2, ((PyObject *)__pyx_n_s__j));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_114, 3, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__m));
      PyTuple_SET_ITEM(__pyx_k_tuple_114, 4, ((PyObject *)__pyx_n_s__m));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__m));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
      PyTuple_SET_ITEM(__pyx_k_tuple_114, 5, ((PyObject *)__pyx_n_s__val));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
      PyTuple_SET_ITEM(__pyx_k_tuple_114, 6, ((PyObject *)__pyx_n_s__result));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_114));

      /* "lib.pyx":257
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def isnullobj2d_old(ndarray[object, ndim=2] arr):             # <<<<<<<<<<<<<<
     *     cdef Py_ssize_t i, j, n, m
     *     cdef object val
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_27isnullobj2d_old, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__isnullobj2d_old, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_115 = (PyObject*)__Pyx_PyCode_New(1, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_114, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__isnullobj2d_old, 257, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_115)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     258:     cdef Py_ssize_t i, j, n, m

     259:     cdef object val

     260:     cdef ndarray[uint8_t, ndim=2] result

     261:

     262:     n, m = (<object> arr).shape

      /* "lib.pyx":262
     *     cdef ndarray[uint8_t, ndim=2] result
     *
     *     n, m = (<object> arr).shape             # <<<<<<<<<<<<<<
     *     result = np.zeros((n, m), dtype=np.uint8)
     *     for i from 0 <= i < n:
     */
      __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
        PyObject* sequence = __pyx_t_1;
        #if CYTHON_COMPILING_IN_CPYTHON
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
        } else {
          __pyx_t_2 = PyList_GET_ITEM(sequence, 0);
          __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
        }
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        #else
        __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else
      {
        Py_ssize_t index = -1;
        __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
        index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_2);
        index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_3);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_5 = NULL;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L4_unpacking_done;
        __pyx_L3_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_5 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L4_unpacking_done:;
      }
      __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_n = __pyx_t_6;
      __pyx_v_m = __pyx_t_7;

     263:     result = np.zeros((n, m), dtype=np.uint8)

      /* "lib.pyx":263
     *
     *     n, m = (<object> arr).shape
     *     result = np.zeros((n, m), dtype=np.uint8)             # <<<<<<<<<<<<<<
     *     for i from 0 <= i < n:
     *         for j from 0 <= j < m:
     */
      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_m); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_1 = 0;
      __pyx_t_2 = 0;
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_4));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
      __pyx_t_4 = 0;
      __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__uint8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = ((PyArrayObject *)__pyx_t_8);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
        __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_10 < 0)) {
          PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
          }
        }
        __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_result.diminfo[1].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_result.diminfo[1].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_9 = 0;
      __pyx_v_result = ((PyArrayObject *)__pyx_t_8);
      __pyx_t_8 = 0;

     264:     for i from 0 <= i < n:

      /* "lib.pyx":264
     *     n, m = (<object> arr).shape
     *     result = np.zeros((n, m), dtype=np.uint8)
     *     for i from 0 <= i < n:             # <<<<<<<<<<<<<<
     *         for j from 0 <= j < m:
     *             val = arr[i, j]
     */
      __pyx_t_7 = __pyx_v_n;
      for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) {

     265:         for j from 0 <= j < m:

        /* "lib.pyx":265
     *     result = np.zeros((n, m), dtype=np.uint8)
     *     for i from 0 <= i < n:
     *         for j from 0 <= j < m:             # <<<<<<<<<<<<<<
     *             val = arr[i, j]
     *             if checknull_old(val):
     */
        __pyx_t_6 = __pyx_v_m;
        for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_6; __pyx_v_j++) {

     266:             val = arr[i, j]

          /* "lib.pyx":266
     *     for i from 0 <= i < n:
     *         for j from 0 <= j < m:
     *             val = arr[i, j]             # <<<<<<<<<<<<<<
     *             if checknull_old(val):
     *                 result[i, j] = 1
     */
          __pyx_t_14 = __pyx_v_i;
          __pyx_t_15 = __pyx_v_j;
          __pyx_t_8 = *__Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_arr.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_arr.diminfo[1].strides);
          __Pyx_INCREF((PyObject*)__pyx_t_8);
          __Pyx_XDECREF(__pyx_v_val);
          __pyx_v_val = __pyx_t_8;
          __pyx_t_8 = 0;

     267:             if checknull_old(val):

          /* "lib.pyx":267
     *         for j from 0 <= j < m:
     *             val = arr[i, j]
     *             if checknull_old(val):             # <<<<<<<<<<<<<<
     *                 result[i, j] = 1
     *     return result.view(np.bool_)
     */
          __pyx_t_8 = __pyx_f_3lib_checknull_old(__pyx_v_val, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (__pyx_t_16) {

     268:                 result[i, j] = 1

            /* "lib.pyx":268
     *             val = arr[i, j]
     *             if checknull_old(val):
     *                 result[i, j] = 1             # <<<<<<<<<<<<<<
     *     return result.view(np.bool_)
     *
     */
            __pyx_t_17 = __pyx_v_i;
            __pyx_t_18 = __pyx_v_j;
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_result.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_result.diminfo[1].strides) = 1;
            goto __pyx_L9;
          }
          __pyx_L9:;
        }
      }

     269:     return result.view(np.bool_)

      /* "lib.pyx":269
     *             if checknull_old(val):
     *                 result[i, j] = 1
     *     return result.view(np.bool_)             # <<<<<<<<<<<<<<
     *
     * def list_to_object_array(list obj):
     */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_8 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__view); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__bool_); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_8);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.isnullobj2d_old", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF(__pyx_v_val);
      __Pyx_XDECREF((PyObject *)__pyx_v_result);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_29list_to_object_array(PyObject *__pyx_self, PyObject *__pyx_v_obj); /*proto*/
    static char __pyx_doc_3lib_28list_to_object_array[] = "\n    Convert list to object ndarray. Seriously can't believe I had to write this\n    function\n    ";
    static PyMethodDef __pyx_mdef_3lib_29list_to_object_array = {__Pyx_NAMESTR("list_to_object_array"), (PyCFunction)__pyx_pw_3lib_29list_to_object_array, METH_O, __Pyx_DOCSTR(__pyx_doc_3lib_28list_to_object_array)};
    static PyObject *__pyx_pw_3lib_29list_to_object_array(PyObject *__pyx_self, PyObject *__pyx_v_obj) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("list_to_object_array (wrapper)", 0);
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_obj), (&PyList_Type), 1, "obj", 1))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_28list_to_object_array(__pyx_self, ((PyObject*)__pyx_v_obj));
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     270:

     271: def list_to_object_array(list obj):

    /* "lib.pyx":271
     *     return result.view(np.bool_)
     *
     * def list_to_object_array(list obj):             # <<<<<<<<<<<<<<
     *     '''
     *     Convert list to object ndarray. Seriously can't believe I had to write this
     */

    static PyObject *__pyx_pf_3lib_28list_to_object_array(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj) {
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_n;
      PyArrayObject *__pyx_v_arr = 0;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_arr;
      __Pyx_Buffer __pyx_pybuffer_arr;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("list_to_object_array", 0);
      __pyx_pybuffer_arr.pybuffer.buf = NULL;
      __pyx_pybuffer_arr.refcount = 0;
      __pyx_pybuffernd_arr.data = NULL;
      __pyx_pybuffernd_arr.rcbuffer = &__pyx_pybuffer_arr;

      /* "lib.pyx":271
     *     return result.view(np.bool_)
     *
     * def list_to_object_array(list obj):             # <<<<<<<<<<<<<<
     *     '''
     *     Convert list to object ndarray. Seriously can't believe I had to write this
     */
      __pyx_k_tuple_116 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_116)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_116);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__obj));
      PyTuple_SET_ITEM(__pyx_k_tuple_116, 0, ((PyObject *)__pyx_n_s__obj));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__obj));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_116, 1, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_116, 2, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__arr));
      PyTuple_SET_ITEM(__pyx_k_tuple_116, 3, ((PyObject *)__pyx_n_s__arr));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__arr));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_116));

      /* "lib.pyx":271
     *     return result.view(np.bool_)
     *
     * def list_to_object_array(list obj):             # <<<<<<<<<<<<<<
     *     '''
     *     Convert list to object ndarray. Seriously can't believe I had to write this
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_29list_to_object_array, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s_49, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_117 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_116, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s_49, 271, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_117)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     272:     '''

     273:     Convert list to object ndarray. Seriously can't believe I had to write this

     274:     function

     275:     '''

     276:     cdef:

     277:         Py_ssize_t i, n

     278:         ndarray[object] arr

     279:

     280:     n = len(obj)

      /* "lib.pyx":280
     *         ndarray[object] arr
     *
     *     n = len(obj)             # <<<<<<<<<<<<<<
     *     arr = np.empty(n, dtype=object)
     *
     */
      if (unlikely(((PyObject *)__pyx_v_obj) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_1 = PyList_GET_SIZE(((PyObject *)__pyx_v_obj)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_n = __pyx_t_1;

     281:     arr = np.empty(n, dtype=object)

      /* "lib.pyx":281
     *
     *     n = len(obj)
     *     arr = np.empty(n, dtype=object)             # <<<<<<<<<<<<<<
     *
     *     for i from 0 <= i < n:
     */
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
        __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_arr.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_7 < 0)) {
          PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_arr.rcbuffer->pybuffer, (PyObject*)__pyx_v_arr, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
          }
        }
        __pyx_pybuffernd_arr.diminfo[0].strides = __pyx_pybuffernd_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_arr.diminfo[0].shape = __pyx_pybuffernd_arr.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_6 = 0;
      __pyx_v_arr = ((PyArrayObject *)__pyx_t_5);
      __pyx_t_5 = 0;

     282:

     283:     for i from 0 <= i < n:

      /* "lib.pyx":283
     *     arr = np.empty(n, dtype=object)
     *
     *     for i from 0 <= i < n:             # <<<<<<<<<<<<<<
     *         arr[i] = obj[i]
     *
     */
      __pyx_t_1 = __pyx_v_n;
      for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) {

     284:         arr[i] = obj[i]

        /* "lib.pyx":284
     *
     *     for i from 0 <= i < n:
     *         arr[i] = obj[i]             # <<<<<<<<<<<<<<
     *
     *     return arr
     */
        if (unlikely(((PyObject *)__pyx_v_obj) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_5 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_obj), __pyx_v_i, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_5) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_11 = __pyx_v_i;
        __pyx_t_7 = -1;
        if (__pyx_t_11 < 0) {
          __pyx_t_11 += __pyx_pybuffernd_arr.diminfo[0].shape;
          if (unlikely(__pyx_t_11 < 0)) __pyx_t_7 = 0;
        } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_arr.diminfo[0].shape)) __pyx_t_7 = 0;
        if (unlikely(__pyx_t_7 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_7);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_12 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_arr.diminfo[0].strides);
        __Pyx_GOTREF(*__pyx_t_12);
        __Pyx_INCREF(__pyx_t_5); __Pyx_DECREF(*__pyx_t_12);
        *__pyx_t_12 = __pyx_t_5;
        __Pyx_GIVEREF(*__pyx_t_12);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }

     285:

     286:     return arr

      /* "lib.pyx":286
     *         arr[i] = obj[i]
     *
     *     return arr             # <<<<<<<<<<<<<<
     *
     *
     */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_arr));
      __pyx_r = ((PyObject *)__pyx_v_arr);
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.list_to_object_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF((PyObject *)__pyx_v_arr);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_31fast_unique(PyObject *__pyx_self, PyObject *__pyx_v_values); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_31fast_unique = {__Pyx_NAMESTR("fast_unique"), (PyCFunction)__pyx_pw_3lib_31fast_unique, METH_O, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_31fast_unique(PyObject *__pyx_self, PyObject *__pyx_v_values) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("fast_unique (wrapper)", 0);
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_30fast_unique(__pyx_self, ((PyArrayObject *)__pyx_v_values));
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     287:

     288:

     289: @cython.wraparound(False)

     290: @cython.boundscheck(False)

     291: def fast_unique(ndarray[object] values):

    /* "lib.pyx":291
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def fast_unique(ndarray[object] values):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(values)
     */

    static PyObject *__pyx_pf_3lib_30fast_unique(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values) {
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_n;
      PyObject *__pyx_v_uniques = 0;
      PyObject *__pyx_v_table = 0;
      PyObject *__pyx_v_val = 0;
      PyObject *__pyx_v_stub = 0;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
      __Pyx_Buffer __pyx_pybuffer_values;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("fast_unique", 0);
      __pyx_pybuffer_values.pybuffer.buf = NULL;
      __pyx_pybuffer_values.refcount = 0;
      __pyx_pybuffernd_values.data = NULL;
      __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0];

      /* "lib.pyx":291
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def fast_unique(ndarray[object] values):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(values)
     */
      __pyx_k_tuple_118 = PyTuple_New(7); if (unlikely(!__pyx_k_tuple_118)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_118);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
      PyTuple_SET_ITEM(__pyx_k_tuple_118, 0, ((PyObject *)__pyx_n_s__values));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_118, 1, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_118, 2, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__uniques));
      PyTuple_SET_ITEM(__pyx_k_tuple_118, 3, ((PyObject *)__pyx_n_s__uniques));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__uniques));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__table));
      PyTuple_SET_ITEM(__pyx_k_tuple_118, 4, ((PyObject *)__pyx_n_s__table));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__table));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
      PyTuple_SET_ITEM(__pyx_k_tuple_118, 5, ((PyObject *)__pyx_n_s__val));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__stub));
      PyTuple_SET_ITEM(__pyx_k_tuple_118, 6, ((PyObject *)__pyx_n_s__stub));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stub));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_118));

      /* "lib.pyx":291
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def fast_unique(ndarray[object] values):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(values)
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_31fast_unique, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__fast_unique, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_119 = (PyObject*)__Pyx_PyCode_New(1, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_118, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__fast_unique, 291, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_119)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     292:     cdef:

     293:         Py_ssize_t i, n = len(values)

      /* "lib.pyx":293
     * def fast_unique(ndarray[object] values):
     *     cdef:
     *         Py_ssize_t i, n = len(values)             # <<<<<<<<<<<<<<
     *         list uniques = []
     *         dict table = {}
     */
      __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_n = __pyx_t_1;

     294:         list uniques = []

      /* "lib.pyx":294
     *     cdef:
     *         Py_ssize_t i, n = len(values)
     *         list uniques = []             # <<<<<<<<<<<<<<
     *         dict table = {}
     *         object val, stub = 0
     */
      __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_uniques = __pyx_t_2;
      __pyx_t_2 = 0;

     295:         dict table = {}

      /* "lib.pyx":295
     *         Py_ssize_t i, n = len(values)
     *         list uniques = []
     *         dict table = {}             # <<<<<<<<<<<<<<
     *         object val, stub = 0
     *
     */
      __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __pyx_v_table = __pyx_t_2;
      __pyx_t_2 = 0;

     296:         object val, stub = 0

      /* "lib.pyx":296
     *         list uniques = []
     *         dict table = {}
     *         object val, stub = 0             # <<<<<<<<<<<<<<
     *
     *     for i from 0 <= i < n:
     */
      __Pyx_INCREF(__pyx_int_0);
      __pyx_v_stub = __pyx_int_0;

     297:

     298:     for i from 0 <= i < n:

      /* "lib.pyx":298
     *         object val, stub = 0
     *
     *     for i from 0 <= i < n:             # <<<<<<<<<<<<<<
     *         val = values[i]
     *         if val not in table:
     */
      __pyx_t_1 = __pyx_v_n;
      for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) {

     299:         val = values[i]

        /* "lib.pyx":299
     *
     *     for i from 0 <= i < n:
     *         val = values[i]             # <<<<<<<<<<<<<<
     *         if val not in table:
     *             table[val] = stub
     */
        __pyx_t_3 = __pyx_v_i;
        __pyx_t_2 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_values.diminfo[0].strides);
        __Pyx_INCREF((PyObject*)__pyx_t_2);
        __Pyx_XDECREF(__pyx_v_val);
        __pyx_v_val = __pyx_t_2;
        __pyx_t_2 = 0;

     300:         if val not in table:

        /* "lib.pyx":300
     *     for i from 0 <= i < n:
     *         val = values[i]
     *         if val not in table:             # <<<<<<<<<<<<<<
     *             table[val] = stub
     *             uniques.append(val)
     */
        __pyx_t_4 = (__Pyx_PyDict_Contains(__pyx_v_val, ((PyObject *)__pyx_v_table), Py_NE)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        if (__pyx_t_4) {

     301:             table[val] = stub

          /* "lib.pyx":301
     *         val = values[i]
     *         if val not in table:
     *             table[val] = stub             # <<<<<<<<<<<<<<
     *             uniques.append(val)
     *     try:
     */
          if (PyDict_SetItem(((PyObject *)__pyx_v_table), __pyx_v_val, __pyx_v_stub) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     302:             uniques.append(val)

          /* "lib.pyx":302
     *         if val not in table:
     *             table[val] = stub
     *             uniques.append(val)             # <<<<<<<<<<<<<<
     *     try:
     *         uniques.sort()
     */
          __pyx_t_5 = PyList_Append(__pyx_v_uniques, __pyx_v_val); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          goto __pyx_L5;
        }
        __pyx_L5:;
      }

     303:     try:

      /* "lib.pyx":303
     *             table[val] = stub
     *             uniques.append(val)
     *     try:             # <<<<<<<<<<<<<<
     *         uniques.sort()
     *     except Exception:
     */
      {
        __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:*/ {

     304:         uniques.sort()

          /* "lib.pyx":304
     *             uniques.append(val)
     *     try:
     *         uniques.sort()             # <<<<<<<<<<<<<<
     *     except Exception:
     *         pass
     */
          __pyx_t_5 = PyList_Sort(((PyObject *)__pyx_v_uniques)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        }
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L13_try_end;
        __pyx_L6_error:;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

     305:     except Exception:

        /* "lib.pyx":305
     *     try:
     *         uniques.sort()
     *     except Exception:             # <<<<<<<<<<<<<<
     *         pass
     *
     */
        __pyx_t_9 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
        if (__pyx_t_9) {
          PyErr_Restore(0,0,0);
          goto __pyx_L7_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);
        goto __pyx_L1_error;
        __pyx_L7_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        __pyx_L13_try_end:;
      }

     306:         pass

     307:

     308:     return uniques

      /* "lib.pyx":308
     *         pass
     *
     *     return uniques             # <<<<<<<<<<<<<<
     *
     * @cython.wraparound(False)
     */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_uniques));
      __pyx_r = ((PyObject *)__pyx_v_uniques);
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.fast_unique", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF(__pyx_v_uniques);
      __Pyx_XDECREF(__pyx_v_table);
      __Pyx_XDECREF(__pyx_v_val);
      __Pyx_XDECREF(__pyx_v_stub);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_33fast_unique_multiple(PyObject *__pyx_self, PyObject *__pyx_v_arrays); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_33fast_unique_multiple = {__Pyx_NAMESTR("fast_unique_multiple"), (PyCFunction)__pyx_pw_3lib_33fast_unique_multiple, METH_O, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_33fast_unique_multiple(PyObject *__pyx_self, PyObject *__pyx_v_arrays) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("fast_unique_multiple (wrapper)", 0);
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arrays), (&PyList_Type), 1, "arrays", 1))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_32fast_unique_multiple(__pyx_self, ((PyObject*)__pyx_v_arrays));
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     309:

     310: @cython.wraparound(False)

     311: @cython.boundscheck(False)

     312: def fast_unique_multiple(list arrays):

    /* "lib.pyx":312
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def fast_unique_multiple(list arrays):             # <<<<<<<<<<<<<<
     *     cdef:
     *         ndarray[object] buf
     */

    static PyObject *__pyx_pf_3lib_32fast_unique_multiple(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_arrays) {
      PyArrayObject *__pyx_v_buf = 0;
      Py_ssize_t __pyx_v_k;
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_j;
      Py_ssize_t __pyx_v_n;
      PyObject *__pyx_v_uniques = 0;
      PyObject *__pyx_v_table = 0;
      PyObject *__pyx_v_val = 0;
      PyObject *__pyx_v_stub = 0;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_buf;
      __Pyx_Buffer __pyx_pybuffer_buf;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("fast_unique_multiple", 0);
      __pyx_pybuffer_buf.pybuffer.buf = NULL;
      __pyx_pybuffer_buf.refcount = 0;
      __pyx_pybuffernd_buf.data = NULL;
      __pyx_pybuffernd_buf.rcbuffer = &__pyx_pybuffer_buf;

      /* "lib.pyx":312
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def fast_unique_multiple(list arrays):             # <<<<<<<<<<<<<<
     *     cdef:
     *         ndarray[object] buf
     */
      __pyx_k_tuple_120 = PyTuple_New(10); if (unlikely(!__pyx_k_tuple_120)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_120);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__arrays));
      PyTuple_SET_ITEM(__pyx_k_tuple_120, 0, ((PyObject *)__pyx_n_s__arrays));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__arrays));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__buf));
      PyTuple_SET_ITEM(__pyx_k_tuple_120, 1, ((PyObject *)__pyx_n_s__buf));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__buf));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
      PyTuple_SET_ITEM(__pyx_k_tuple_120, 2, ((PyObject *)__pyx_n_s__k));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_120, 3, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
      PyTuple_SET_ITEM(__pyx_k_tuple_120, 4, ((PyObject *)__pyx_n_s__j));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_120, 5, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__uniques));
      PyTuple_SET_ITEM(__pyx_k_tuple_120, 6, ((PyObject *)__pyx_n_s__uniques));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__uniques));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__table));
      PyTuple_SET_ITEM(__pyx_k_tuple_120, 7, ((PyObject *)__pyx_n_s__table));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__table));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
      PyTuple_SET_ITEM(__pyx_k_tuple_120, 8, ((PyObject *)__pyx_n_s__val));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__stub));
      PyTuple_SET_ITEM(__pyx_k_tuple_120, 9, ((PyObject *)__pyx_n_s__stub));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stub));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_120));

      /* "lib.pyx":312
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def fast_unique_multiple(list arrays):             # <<<<<<<<<<<<<<
     *     cdef:
     *         ndarray[object] buf
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_33fast_unique_multiple, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s_122, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_121 = (PyObject*)__Pyx_PyCode_New(1, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_120, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s_122, 312, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_121)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     313:     cdef:

     314:         ndarray[object] buf

     315:         Py_ssize_t k = len(arrays)

      /* "lib.pyx":315
     *     cdef:
     *         ndarray[object] buf
     *         Py_ssize_t k = len(arrays)             # <<<<<<<<<<<<<<
     *         Py_ssize_t i, j, n
     *         list uniques = []
     */
      if (unlikely(((PyObject *)__pyx_v_arrays) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_1 = PyList_GET_SIZE(((PyObject *)__pyx_v_arrays)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_k = __pyx_t_1;

     316:         Py_ssize_t i, j, n

     317:         list uniques = []

      /* "lib.pyx":317
     *         Py_ssize_t k = len(arrays)
     *         Py_ssize_t i, j, n
     *         list uniques = []             # <<<<<<<<<<<<<<
     *         dict table = {}
     *         object val, stub = 0
     */
      __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_uniques = __pyx_t_2;
      __pyx_t_2 = 0;

     318:         dict table = {}

      /* "lib.pyx":318
     *         Py_ssize_t i, j, n
     *         list uniques = []
     *         dict table = {}             # <<<<<<<<<<<<<<
     *         object val, stub = 0
     *
     */
      __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __pyx_v_table = __pyx_t_2;
      __pyx_t_2 = 0;

     319:         object val, stub = 0

      /* "lib.pyx":319
     *         list uniques = []
     *         dict table = {}
     *         object val, stub = 0             # <<<<<<<<<<<<<<
     *
     *     for i from 0 <= i < k:
     */
      __Pyx_INCREF(__pyx_int_0);
      __pyx_v_stub = __pyx_int_0;

     320:

     321:     for i from 0 <= i < k:

      /* "lib.pyx":321
     *         object val, stub = 0
     *
     *     for i from 0 <= i < k:             # <<<<<<<<<<<<<<
     *         buf = arrays[i]
     *         n = len(buf)
     */
      __pyx_t_1 = __pyx_v_k;
      for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) {

     322:         buf = arrays[i]

        /* "lib.pyx":322
     *
     *     for i from 0 <= i < k:
     *         buf = arrays[i]             # <<<<<<<<<<<<<<
     *         n = len(buf)
     *         for j from 0 <= j < n:
     */
        if (unlikely(((PyObject *)__pyx_v_arrays) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        if (!(likely(((PyList_GET_ITEM(__pyx_v_arrays, __pyx_v_i)) == Py_None) || likely(__Pyx_TypeTest(PyList_GET_ITEM(__pyx_v_arrays, __pyx_v_i), __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_2 = PyList_GET_ITEM(__pyx_v_arrays, __pyx_v_i);
        __Pyx_INCREF(__pyx_t_2);
        {
          __Pyx_BufFmt_StackElem __pyx_stack[1];
          __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer);
          __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_buf.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_2), &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
          if (unlikely(__pyx_t_3 < 0)) {
            PyErr_Fetch(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
            if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_buf.rcbuffer->pybuffer, (PyObject*)__pyx_v_buf, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
              Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_6);
              __Pyx_RaiseBufferFallbackError();
            } else {
              PyErr_Restore(__pyx_t_4, __pyx_t_5, __pyx_t_6);
            }
          }
          __pyx_pybuffernd_buf.diminfo[0].strides = __pyx_pybuffernd_buf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_buf.diminfo[0].shape = __pyx_pybuffernd_buf.rcbuffer->pybuffer.shape[0];
          if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __Pyx_XDECREF(((PyObject *)__pyx_v_buf));
        __pyx_v_buf = ((PyArrayObject *)__pyx_t_2);
        __pyx_t_2 = 0;

     323:         n = len(buf)

        /* "lib.pyx":323
     *     for i from 0 <= i < k:
     *         buf = arrays[i]
     *         n = len(buf)             # <<<<<<<<<<<<<<
     *         for j from 0 <= j < n:
     *             val = buf[j]
     */
        __pyx_t_7 = PyObject_Length(((PyObject *)__pyx_v_buf)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_v_n = __pyx_t_7;

     324:         for j from 0 <= j < n:

        /* "lib.pyx":324
     *         buf = arrays[i]
     *         n = len(buf)
     *         for j from 0 <= j < n:             # <<<<<<<<<<<<<<
     *             val = buf[j]
     *             if val not in table:
     */
        __pyx_t_7 = __pyx_v_n;
        for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_7; __pyx_v_j++) {

     325:             val = buf[j]

          /* "lib.pyx":325
     *         n = len(buf)
     *         for j from 0 <= j < n:
     *             val = buf[j]             # <<<<<<<<<<<<<<
     *             if val not in table:
     *                 table[val] = stub
     */
          __pyx_t_8 = __pyx_v_j;
          __pyx_t_2 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_buf.diminfo[0].strides);
          __Pyx_INCREF((PyObject*)__pyx_t_2);
          __Pyx_XDECREF(__pyx_v_val);
          __pyx_v_val = __pyx_t_2;
          __pyx_t_2 = 0;

     326:             if val not in table:

          /* "lib.pyx":326
     *         for j from 0 <= j < n:
     *             val = buf[j]
     *             if val not in table:             # <<<<<<<<<<<<<<
     *                 table[val] = stub
     *                 uniques.append(val)
     */
          __pyx_t_9 = (__Pyx_PyDict_Contains(__pyx_v_val, ((PyObject *)__pyx_v_table), Py_NE)); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          if (__pyx_t_9) {

     327:                 table[val] = stub

            /* "lib.pyx":327
     *             val = buf[j]
     *             if val not in table:
     *                 table[val] = stub             # <<<<<<<<<<<<<<
     *                 uniques.append(val)
     *     try:
     */
            if (PyDict_SetItem(((PyObject *)__pyx_v_table), __pyx_v_val, __pyx_v_stub) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     328:                 uniques.append(val)

            /* "lib.pyx":328
     *             if val not in table:
     *                 table[val] = stub
     *                 uniques.append(val)             # <<<<<<<<<<<<<<
     *     try:
     *         uniques.sort()
     */
            __pyx_t_10 = PyList_Append(__pyx_v_uniques, __pyx_v_val); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            goto __pyx_L7;
          }
          __pyx_L7:;
        }
      }

     329:     try:

      /* "lib.pyx":329
     *                 table[val] = stub
     *                 uniques.append(val)
     *     try:             # <<<<<<<<<<<<<<
     *         uniques.sort()
     *     except Exception:
     */
      {
        __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_t_4);
        /*try:*/ {

     330:         uniques.sort()

          /* "lib.pyx":330
     *                 uniques.append(val)
     *     try:
     *         uniques.sort()             # <<<<<<<<<<<<<<
     *     except Exception:
     *         pass
     */
          __pyx_t_10 = PyList_Sort(((PyObject *)__pyx_v_uniques)); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        }
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L15_try_end;
        __pyx_L8_error:;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

     331:     except Exception:

        /* "lib.pyx":331
     *     try:
     *         uniques.sort()
     *     except Exception:             # <<<<<<<<<<<<<<
     *         pass
     *
     */
        __pyx_t_3 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
        if (__pyx_t_3) {
          PyErr_Restore(0,0,0);
          goto __pyx_L9_exception_handled;
        }
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_XGIVEREF(__pyx_t_4);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_5, __pyx_t_4);
        goto __pyx_L1_error;
        __pyx_L9_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_XGIVEREF(__pyx_t_4);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_5, __pyx_t_4);
        __pyx_L15_try_end:;
      }

     332:         pass

     333:

     334:     return uniques

      /* "lib.pyx":334
     *         pass
     *
     *     return uniques             # <<<<<<<<<<<<<<
     *
     * @cython.wraparound(False)
     */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_uniques));
      __pyx_r = ((PyObject *)__pyx_v_uniques);
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.fast_unique_multiple", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF((PyObject *)__pyx_v_buf);
      __Pyx_XDECREF(__pyx_v_uniques);
      __Pyx_XDECREF(__pyx_v_table);
      __Pyx_XDECREF(__pyx_v_val);
      __Pyx_XDECREF(__pyx_v_stub);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_35fast_unique_multiple_list(PyObject *__pyx_self, PyObject *__pyx_v_lists); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_35fast_unique_multiple_list = {__Pyx_NAMESTR("fast_unique_multiple_list"), (PyCFunction)__pyx_pw_3lib_35fast_unique_multiple_list, METH_O, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_35fast_unique_multiple_list(PyObject *__pyx_self, PyObject *__pyx_v_lists) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("fast_unique_multiple_list (wrapper)", 0);
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lists), (&PyList_Type), 1, "lists", 1))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_34fast_unique_multiple_list(__pyx_self, ((PyObject*)__pyx_v_lists));
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     335:

     336: @cython.wraparound(False)

     337: @cython.boundscheck(False)

     338: def fast_unique_multiple_list(list lists):

    /* "lib.pyx":338
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def fast_unique_multiple_list(list lists):             # <<<<<<<<<<<<<<
     *     cdef:
     *         list buf
     */

    static PyObject *__pyx_pf_3lib_34fast_unique_multiple_list(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_lists) {
      PyObject *__pyx_v_buf = 0;
      Py_ssize_t __pyx_v_k;
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_j;
      Py_ssize_t __pyx_v_n;
      PyObject *__pyx_v_uniques = 0;
      PyObject *__pyx_v_table = 0;
      PyObject *__pyx_v_val = 0;
      PyObject *__pyx_v_stub = 0;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("fast_unique_multiple_list", 0);

      /* "lib.pyx":338
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def fast_unique_multiple_list(list lists):             # <<<<<<<<<<<<<<
     *     cdef:
     *         list buf
     */
      __pyx_k_tuple_123 = PyTuple_New(10); if (unlikely(!__pyx_k_tuple_123)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_123);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__lists));
      PyTuple_SET_ITEM(__pyx_k_tuple_123, 0, ((PyObject *)__pyx_n_s__lists));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lists));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__buf));
      PyTuple_SET_ITEM(__pyx_k_tuple_123, 1, ((PyObject *)__pyx_n_s__buf));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__buf));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
      PyTuple_SET_ITEM(__pyx_k_tuple_123, 2, ((PyObject *)__pyx_n_s__k));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_123, 3, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
      PyTuple_SET_ITEM(__pyx_k_tuple_123, 4, ((PyObject *)__pyx_n_s__j));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_123, 5, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__uniques));
      PyTuple_SET_ITEM(__pyx_k_tuple_123, 6, ((PyObject *)__pyx_n_s__uniques));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__uniques));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__table));
      PyTuple_SET_ITEM(__pyx_k_tuple_123, 7, ((PyObject *)__pyx_n_s__table));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__table));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
      PyTuple_SET_ITEM(__pyx_k_tuple_123, 8, ((PyObject *)__pyx_n_s__val));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__stub));
      PyTuple_SET_ITEM(__pyx_k_tuple_123, 9, ((PyObject *)__pyx_n_s__stub));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stub));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_123));

      /* "lib.pyx":338
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def fast_unique_multiple_list(list lists):             # <<<<<<<<<<<<<<
     *     cdef:
     *         list buf
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_35fast_unique_multiple_list, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s_125, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_124 = (PyObject*)__Pyx_PyCode_New(1, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_123, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s_125, 338, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_124)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     339:     cdef:

     340:         list buf

     341:         Py_ssize_t k = len(lists)

      /* "lib.pyx":341
     *     cdef:
     *         list buf
     *         Py_ssize_t k = len(lists)             # <<<<<<<<<<<<<<
     *         Py_ssize_t i, j, n
     *         list uniques = []
     */
      if (unlikely(((PyObject *)__pyx_v_lists) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_1 = PyList_GET_SIZE(((PyObject *)__pyx_v_lists)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_k = __pyx_t_1;

     342:         Py_ssize_t i, j, n

     343:         list uniques = []

      /* "lib.pyx":343
     *         Py_ssize_t k = len(lists)
     *         Py_ssize_t i, j, n
     *         list uniques = []             # <<<<<<<<<<<<<<
     *         dict table = {}
     *         object val, stub = 0
     */
      __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_uniques = __pyx_t_2;
      __pyx_t_2 = 0;

     344:         dict table = {}

      /* "lib.pyx":344
     *         Py_ssize_t i, j, n
     *         list uniques = []
     *         dict table = {}             # <<<<<<<<<<<<<<
     *         object val, stub = 0
     *
     */
      __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __pyx_v_table = __pyx_t_2;
      __pyx_t_2 = 0;

     345:         object val, stub = 0

      /* "lib.pyx":345
     *         list uniques = []
     *         dict table = {}
     *         object val, stub = 0             # <<<<<<<<<<<<<<
     *
     *     for i from 0 <= i < k:
     */
      __Pyx_INCREF(__pyx_int_0);
      __pyx_v_stub = __pyx_int_0;

     346:

     347:     for i from 0 <= i < k:

      /* "lib.pyx":347
     *         object val, stub = 0
     *
     *     for i from 0 <= i < k:             # <<<<<<<<<<<<<<
     *         buf = lists[i]
     *         n = len(buf)
     */
      __pyx_t_1 = __pyx_v_k;
      for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) {

     348:         buf = lists[i]

        /* "lib.pyx":348
     *
     *     for i from 0 <= i < k:
     *         buf = lists[i]             # <<<<<<<<<<<<<<
     *         n = len(buf)
     *         for j from 0 <= j < n:
     */
        if (unlikely(((PyObject *)__pyx_v_lists) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        if (!(likely(PyList_CheckExact(PyList_GET_ITEM(__pyx_v_lists, __pyx_v_i)))||((PyList_GET_ITEM(__pyx_v_lists, __pyx_v_i)) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(PyList_GET_ITEM(__pyx_v_lists, __pyx_v_i))->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_2 = PyList_GET_ITEM(__pyx_v_lists, __pyx_v_i);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_XDECREF(((PyObject *)__pyx_v_buf));
        __pyx_v_buf = ((PyObject*)__pyx_t_2);
        __pyx_t_2 = 0;

     349:         n = len(buf)

        /* "lib.pyx":349
     *     for i from 0 <= i < k:
     *         buf = lists[i]
     *         n = len(buf)             # <<<<<<<<<<<<<<
     *         for j from 0 <= j < n:
     *             val = buf[j]
     */
        if (unlikely(((PyObject *)__pyx_v_buf) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_3 = PyList_GET_SIZE(((PyObject *)__pyx_v_buf)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_v_n = __pyx_t_3;

     350:         for j from 0 <= j < n:

        /* "lib.pyx":350
     *         buf = lists[i]
     *         n = len(buf)
     *         for j from 0 <= j < n:             # <<<<<<<<<<<<<<
     *             val = buf[j]
     *             if val not in table:
     */
        __pyx_t_3 = __pyx_v_n;
        for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_3; __pyx_v_j++) {

     351:             val = buf[j]

          /* "lib.pyx":351
     *         n = len(buf)
     *         for j from 0 <= j < n:
     *             val = buf[j]             # <<<<<<<<<<<<<<
     *             if val not in table:
     *                 table[val] = stub
     */
          if (unlikely(((PyObject *)__pyx_v_buf) == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
            {__pyx_filename = __pyx_f[2]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_2 = PyList_GET_ITEM(__pyx_v_buf, __pyx_v_j);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_XDECREF(__pyx_v_val);
          __pyx_v_val = __pyx_t_2;
          __pyx_t_2 = 0;

     352:             if val not in table:

          /* "lib.pyx":352
     *         for j from 0 <= j < n:
     *             val = buf[j]
     *             if val not in table:             # <<<<<<<<<<<<<<
     *                 table[val] = stub
     *                 uniques.append(val)
     */
          __pyx_t_4 = (__Pyx_PyDict_Contains(__pyx_v_val, ((PyObject *)__pyx_v_table), Py_NE)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          if (__pyx_t_4) {

     353:                 table[val] = stub

            /* "lib.pyx":353
     *             val = buf[j]
     *             if val not in table:
     *                 table[val] = stub             # <<<<<<<<<<<<<<
     *                 uniques.append(val)
     *     try:
     */
            if (PyDict_SetItem(((PyObject *)__pyx_v_table), __pyx_v_val, __pyx_v_stub) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     354:                 uniques.append(val)

            /* "lib.pyx":354
     *             if val not in table:
     *                 table[val] = stub
     *                 uniques.append(val)             # <<<<<<<<<<<<<<
     *     try:
     *         uniques.sort()
     */
            __pyx_t_5 = PyList_Append(__pyx_v_uniques, __pyx_v_val); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            goto __pyx_L7;
          }
          __pyx_L7:;
        }
      }

     355:     try:

      /* "lib.pyx":355
     *                 table[val] = stub
     *                 uniques.append(val)
     *     try:             # <<<<<<<<<<<<<<
     *         uniques.sort()
     *     except Exception:
     */
      {
        __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:*/ {

     356:         uniques.sort()

          /* "lib.pyx":356
     *                 uniques.append(val)
     *     try:
     *         uniques.sort()             # <<<<<<<<<<<<<<
     *     except Exception:
     *         pass
     */
          __pyx_t_5 = PyList_Sort(((PyObject *)__pyx_v_uniques)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        }
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L15_try_end;
        __pyx_L8_error:;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

     357:     except Exception:

        /* "lib.pyx":357
     *     try:
     *         uniques.sort()
     *     except Exception:             # <<<<<<<<<<<<<<
     *         pass
     *
     */
        __pyx_t_9 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
        if (__pyx_t_9) {
          PyErr_Restore(0,0,0);
          goto __pyx_L9_exception_handled;
        }
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        goto __pyx_L1_error;
        __pyx_L9_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        __pyx_L15_try_end:;
      }

     358:         pass

     359:

     360:     return uniques

      /* "lib.pyx":360
     *         pass
     *
     *     return uniques             # <<<<<<<<<<<<<<
     *
     * @cython.wraparound(False)
     */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_uniques));
      __pyx_r = ((PyObject *)__pyx_v_uniques);
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("lib.fast_unique_multiple_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_buf);
      __Pyx_XDECREF(__pyx_v_uniques);
      __Pyx_XDECREF(__pyx_v_table);
      __Pyx_XDECREF(__pyx_v_val);
      __Pyx_XDECREF(__pyx_v_stub);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_37fast_unique_multiple_list_gen(PyObject *__pyx_self, PyObject *__pyx_v_gen); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_37fast_unique_multiple_list_gen = {__Pyx_NAMESTR("fast_unique_multiple_list_gen"), (PyCFunction)__pyx_pw_3lib_37fast_unique_multiple_list_gen, METH_O, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_37fast_unique_multiple_list_gen(PyObject *__pyx_self, PyObject *__pyx_v_gen) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("fast_unique_multiple_list_gen (wrapper)", 0);
      __pyx_r = __pyx_pf_3lib_36fast_unique_multiple_list_gen(__pyx_self, ((PyObject *)__pyx_v_gen));
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     361:

     362: @cython.wraparound(False)

     363: @cython.boundscheck(False)

     364: def fast_unique_multiple_list_gen(object gen):

    /* "lib.pyx":364
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def fast_unique_multiple_list_gen(object gen):             # <<<<<<<<<<<<<<
     *     cdef:
     *         list buf
     */

    static PyObject *__pyx_pf_3lib_36fast_unique_multiple_list_gen(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_gen) {
      PyObject *__pyx_v_buf = 0;
      Py_ssize_t __pyx_v_j;
      Py_ssize_t __pyx_v_n;
      PyObject *__pyx_v_uniques = 0;
      PyObject *__pyx_v_table = 0;
      PyObject *__pyx_v_val = 0;
      PyObject *__pyx_v_stub = 0;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("fast_unique_multiple_list_gen", 0);

      /* "lib.pyx":364
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def fast_unique_multiple_list_gen(object gen):             # <<<<<<<<<<<<<<
     *     cdef:
     *         list buf
     */
      __pyx_k_tuple_126 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_126)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_126);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__gen));
      PyTuple_SET_ITEM(__pyx_k_tuple_126, 0, ((PyObject *)__pyx_n_s__gen));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__gen));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__buf));
      PyTuple_SET_ITEM(__pyx_k_tuple_126, 1, ((PyObject *)__pyx_n_s__buf));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__buf));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
      PyTuple_SET_ITEM(__pyx_k_tuple_126, 2, ((PyObject *)__pyx_n_s__j));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_126, 3, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__uniques));
      PyTuple_SET_ITEM(__pyx_k_tuple_126, 4, ((PyObject *)__pyx_n_s__uniques));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__uniques));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__table));
      PyTuple_SET_ITEM(__pyx_k_tuple_126, 5, ((PyObject *)__pyx_n_s__table));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__table));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
      PyTuple_SET_ITEM(__pyx_k_tuple_126, 6, ((PyObject *)__pyx_n_s__val));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__stub));
      PyTuple_SET_ITEM(__pyx_k_tuple_126, 7, ((PyObject *)__pyx_n_s__stub));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stub));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_126));

      /* "lib.pyx":364
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def fast_unique_multiple_list_gen(object gen):             # <<<<<<<<<<<<<<
     *     cdef:
     *         list buf
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_37fast_unique_multiple_list_gen, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s_128, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_127 = (PyObject*)__Pyx_PyCode_New(1, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_126, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s_128, 364, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_127)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     365:     cdef:

     366:         list buf

     367:         Py_ssize_t j, n

     368:         list uniques = []

      /* "lib.pyx":368
     *         list buf
     *         Py_ssize_t j, n
     *         list uniques = []             # <<<<<<<<<<<<<<
     *         dict table = {}
     *         object val, stub = 0
     */
      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_uniques = __pyx_t_1;
      __pyx_t_1 = 0;

     369:         dict table = {}

      /* "lib.pyx":369
     *         Py_ssize_t j, n
     *         list uniques = []
     *         dict table = {}             # <<<<<<<<<<<<<<
     *         object val, stub = 0
     *
     */
      __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __pyx_v_table = __pyx_t_1;
      __pyx_t_1 = 0;

     370:         object val, stub = 0

      /* "lib.pyx":370
     *         list uniques = []
     *         dict table = {}
     *         object val, stub = 0             # <<<<<<<<<<<<<<
     *
     *     for buf in gen:
     */
      __Pyx_INCREF(__pyx_int_0);
      __pyx_v_stub = __pyx_int_0;

     371:

     372:     for buf in gen:

      /* "lib.pyx":372
     *         object val, stub = 0
     *
     *     for buf in gen:             # <<<<<<<<<<<<<<
     *         n = len(buf)
     *         for j from 0 <= j < n:
     */
      if (PyList_CheckExact(__pyx_v_gen) || PyTuple_CheckExact(__pyx_v_gen)) {
        __pyx_t_1 = __pyx_v_gen; __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_gen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
      }
      for (;;) {
        if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
          if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
          if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        } else {
          __pyx_t_4 = __pyx_t_3(__pyx_t_1);
          if (unlikely(!__pyx_t_4)) {
            if (PyErr_Occurred()) {
              if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
              else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_4);
        }
        if (!(likely(PyList_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_XDECREF(((PyObject *)__pyx_v_buf));
        __pyx_v_buf = ((PyObject*)__pyx_t_4);
        __pyx_t_4 = 0;

     373:         n = len(buf)

        /* "lib.pyx":373
     *
     *     for buf in gen:
     *         n = len(buf)             # <<<<<<<<<<<<<<
     *         for j from 0 <= j < n:
     *             val = buf[j]
     */
        if (unlikely(((PyObject *)__pyx_v_buf) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_5 = PyList_GET_SIZE(((PyObject *)__pyx_v_buf)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_v_n = __pyx_t_5;

     374:         for j from 0 <= j < n:

        /* "lib.pyx":374
     *     for buf in gen:
     *         n = len(buf)
     *         for j from 0 <= j < n:             # <<<<<<<<<<<<<<
     *             val = buf[j]
     *             if val not in table:
     */
        __pyx_t_5 = __pyx_v_n;
        for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_5; __pyx_v_j++) {

     375:             val = buf[j]

          /* "lib.pyx":375
     *         n = len(buf)
     *         for j from 0 <= j < n:
     *             val = buf[j]             # <<<<<<<<<<<<<<
     *             if val not in table:
     *                 table[val] = stub
     */
          if (unlikely(((PyObject *)__pyx_v_buf) == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
            {__pyx_filename = __pyx_f[2]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_4 = PyList_GET_ITEM(__pyx_v_buf, __pyx_v_j);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_XDECREF(__pyx_v_val);
          __pyx_v_val = __pyx_t_4;
          __pyx_t_4 = 0;

     376:             if val not in table:

          /* "lib.pyx":376
     *         for j from 0 <= j < n:
     *             val = buf[j]
     *             if val not in table:             # <<<<<<<<<<<<<<
     *                 table[val] = stub
     *                 uniques.append(val)
     */
          __pyx_t_6 = (__Pyx_PyDict_Contains(__pyx_v_val, ((PyObject *)__pyx_v_table), Py_NE)); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          if (__pyx_t_6) {

     377:                 table[val] = stub

            /* "lib.pyx":377
     *             val = buf[j]
     *             if val not in table:
     *                 table[val] = stub             # <<<<<<<<<<<<<<
     *                 uniques.append(val)
     *
     */
            if (PyDict_SetItem(((PyObject *)__pyx_v_table), __pyx_v_val, __pyx_v_stub) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     378:                 uniques.append(val)

            /* "lib.pyx":378
     *             if val not in table:
     *                 table[val] = stub
     *                 uniques.append(val)             # <<<<<<<<<<<<<<
     *
     *     try:
     */
            __pyx_t_7 = PyList_Append(__pyx_v_uniques, __pyx_v_val); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            goto __pyx_L7;
          }
          __pyx_L7:;
        }
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     379:

     380:     try:

      /* "lib.pyx":380
     *                 uniques.append(val)
     *
     *     try:             # <<<<<<<<<<<<<<
     *         uniques.sort()
     *     except Exception:
     */
      {
        __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_10);
        /*try:*/ {

     381:         uniques.sort()

          /* "lib.pyx":381
     *
     *     try:
     *         uniques.sort()             # <<<<<<<<<<<<<<
     *     except Exception:
     *         pass
     */
          __pyx_t_7 = PyList_Sort(((PyObject *)__pyx_v_uniques)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        }
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L15_try_end;
        __pyx_L8_error:;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

     382:     except Exception:

        /* "lib.pyx":382
     *     try:
     *         uniques.sort()
     *     except Exception:             # <<<<<<<<<<<<<<
     *         pass
     *
     */
        __pyx_t_11 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
        if (__pyx_t_11) {
          PyErr_Restore(0,0,0);
          goto __pyx_L9_exception_handled;
        }
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        goto __pyx_L1_error;
        __pyx_L9_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        __pyx_L15_try_end:;
      }

     383:         pass

     384:

     385:     return uniques

      /* "lib.pyx":385
     *         pass
     *
     *     return uniques             # <<<<<<<<<<<<<<
     *
     * @cython.wraparound(False)
     */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_uniques));
      __pyx_r = ((PyObject *)__pyx_v_uniques);
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_AddTraceback("lib.fast_unique_multiple_list_gen", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_buf);
      __Pyx_XDECREF(__pyx_v_uniques);
      __Pyx_XDECREF(__pyx_v_table);
      __Pyx_XDECREF(__pyx_v_val);
      __Pyx_XDECREF(__pyx_v_stub);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_39dicts_to_array(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_39dicts_to_array = {__Pyx_NAMESTR("dicts_to_array"), (PyCFunction)__pyx_pw_3lib_39dicts_to_array, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_39dicts_to_array(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_dicts = 0;
      PyObject *__pyx_v_columns = 0;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("dicts_to_array (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__dicts,&__pyx_n_s__columns,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dicts)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            case  1:
            if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__columns)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("dicts_to_array", 1, 2, 2, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dicts_to_array") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        }
        __pyx_v_dicts = ((PyObject*)values[0]);
        __pyx_v_columns = ((PyObject*)values[1]);
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("dicts_to_array", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_L3_error:;
      __Pyx_AddTraceback("lib.dicts_to_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dicts), (&PyList_Type), 1, "dicts", 1))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_columns), (&PyList_Type), 1, "columns", 1))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_38dicts_to_array(__pyx_self, __pyx_v_dicts, __pyx_v_columns);
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     386:

     387: @cython.wraparound(False)

     388: @cython.boundscheck(False)

     389: def dicts_to_array(list dicts, list columns):

    /* "lib.pyx":389
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def dicts_to_array(list dicts, list columns):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, j, k, n
     */

    static PyObject *__pyx_pf_3lib_38dicts_to_array(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_dicts, PyObject *__pyx_v_columns) {
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_j;
      Py_ssize_t __pyx_v_k;
      Py_ssize_t __pyx_v_n;
      PyArrayObject *__pyx_v_result = 0;
      PyObject *__pyx_v_row = 0;
      PyObject *__pyx_v_col = 0;
      PyObject *__pyx_v_onan = 0;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
      __Pyx_Buffer __pyx_pybuffer_result;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("dicts_to_array", 0);
      __pyx_pybuffer_result.pybuffer.buf = NULL;
      __pyx_pybuffer_result.refcount = 0;
      __pyx_pybuffernd_result.data = NULL;
      __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;

      /* "lib.pyx":389
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def dicts_to_array(list dicts, list columns):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, j, k, n
     */
      __pyx_k_tuple_129 = PyTuple_New(10); if (unlikely(!__pyx_k_tuple_129)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_129);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__dicts));
      PyTuple_SET_ITEM(__pyx_k_tuple_129, 0, ((PyObject *)__pyx_n_s__dicts));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dicts));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__columns));
      PyTuple_SET_ITEM(__pyx_k_tuple_129, 1, ((PyObject *)__pyx_n_s__columns));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__columns));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_129, 2, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
      PyTuple_SET_ITEM(__pyx_k_tuple_129, 3, ((PyObject *)__pyx_n_s__j));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
      PyTuple_SET_ITEM(__pyx_k_tuple_129, 4, ((PyObject *)__pyx_n_s__k));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_129, 5, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
      PyTuple_SET_ITEM(__pyx_k_tuple_129, 6, ((PyObject *)__pyx_n_s__result));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__row));
      PyTuple_SET_ITEM(__pyx_k_tuple_129, 7, ((PyObject *)__pyx_n_s__row));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__row));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__col));
      PyTuple_SET_ITEM(__pyx_k_tuple_129, 8, ((PyObject *)__pyx_n_s__col));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__col));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__onan));
      PyTuple_SET_ITEM(__pyx_k_tuple_129, 9, ((PyObject *)__pyx_n_s__onan));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__onan));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_129));

      /* "lib.pyx":389
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def dicts_to_array(list dicts, list columns):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, j, k, n
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_39dicts_to_array, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__dicts_to_array, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_130 = (PyObject*)__Pyx_PyCode_New(2, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_129, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__dicts_to_array, 389, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_130)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     390:     cdef:

     391:         Py_ssize_t i, j, k, n

     392:         ndarray[object, ndim=2] result

     393:         dict row

     394:         object col, onan = np.nan

      /* "lib.pyx":394
     *         ndarray[object, ndim=2] result
     *         dict row
     *         object col, onan = np.nan             # <<<<<<<<<<<<<<
     *
     *     k = len(columns)
     */
      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__nan); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_onan = __pyx_t_2;
      __pyx_t_2 = 0;

     395:

     396:     k = len(columns)

      /* "lib.pyx":396
     *         object col, onan = np.nan
     *
     *     k = len(columns)             # <<<<<<<<<<<<<<
     *     n = len(dicts)
     *
     */
      if (unlikely(((PyObject *)__pyx_v_columns) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_3 = PyList_GET_SIZE(((PyObject *)__pyx_v_columns)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_k = __pyx_t_3;

     397:     n = len(dicts)

      /* "lib.pyx":397
     *
     *     k = len(columns)
     *     n = len(dicts)             # <<<<<<<<<<<<<<
     *
     *     result = np.empty((n, k), dtype='O')
     */
      if (unlikely(((PyObject *)__pyx_v_dicts) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_3 = PyList_GET_SIZE(((PyObject *)__pyx_v_dicts)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_n = __pyx_t_3;

     398:

     399:     result = np.empty((n, k), dtype='O')

      /* "lib.pyx":399
     *     n = len(dicts)
     *
     *     result = np.empty((n, k), dtype='O')             # <<<<<<<<<<<<<<
     *
     *     for i in range(n):
     */
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_2 = 0;
      __pyx_t_4 = 0;
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
      __pyx_t_5 = 0;
      __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__O)) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_6 = ((PyArrayObject *)__pyx_t_2);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
        __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_7 < 0)) {
          PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
          }
        }
        __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_result.diminfo[1].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_result.diminfo[1].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_6 = 0;
      __pyx_v_result = ((PyArrayObject *)__pyx_t_2);
      __pyx_t_2 = 0;

     400:

     401:     for i in range(n):

      /* "lib.pyx":401
     *     result = np.empty((n, k), dtype='O')
     *
     *     for i in range(n):             # <<<<<<<<<<<<<<
     *         row = dicts[i]
     *         for j in range(k):
     */
      __pyx_t_3 = __pyx_v_n;
      for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_3; __pyx_t_11+=1) {
        __pyx_v_i = __pyx_t_11;

     402:         row = dicts[i]

        /* "lib.pyx":402
     *
     *     for i in range(n):
     *         row = dicts[i]             # <<<<<<<<<<<<<<
     *         for j in range(k):
     *             col = columns[j]
     */
        if (unlikely(((PyObject *)__pyx_v_dicts) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        if (!(likely(PyDict_CheckExact(PyList_GET_ITEM(__pyx_v_dicts, __pyx_v_i)))||((PyList_GET_ITEM(__pyx_v_dicts, __pyx_v_i)) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected dict, got %.200s", Py_TYPE(PyList_GET_ITEM(__pyx_v_dicts, __pyx_v_i))->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_2 = PyList_GET_ITEM(__pyx_v_dicts, __pyx_v_i);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_XDECREF(((PyObject *)__pyx_v_row));
        __pyx_v_row = ((PyObject*)__pyx_t_2);
        __pyx_t_2 = 0;

     403:         for j in range(k):

        /* "lib.pyx":403
     *     for i in range(n):
     *         row = dicts[i]
     *         for j in range(k):             # <<<<<<<<<<<<<<
     *             col = columns[j]
     *             if col in row:
     */
        __pyx_t_12 = __pyx_v_k;
        for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
          __pyx_v_j = __pyx_t_13;

     404:             col = columns[j]

          /* "lib.pyx":404
     *         row = dicts[i]
     *         for j in range(k):
     *             col = columns[j]             # <<<<<<<<<<<<<<
     *             if col in row:
     *                 result[i, j] = row[col]
     */
          if (unlikely(((PyObject *)__pyx_v_columns) == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
            {__pyx_filename = __pyx_f[2]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_2 = PyList_GET_ITEM(__pyx_v_columns, __pyx_v_j);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_XDECREF(__pyx_v_col);
          __pyx_v_col = __pyx_t_2;
          __pyx_t_2 = 0;

     405:             if col in row:

          /* "lib.pyx":405
     *         for j in range(k):
     *             col = columns[j]
     *             if col in row:             # <<<<<<<<<<<<<<
     *                 result[i, j] = row[col]
     *             else:
     */
          if (unlikely(((PyObject *)__pyx_v_row) == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
            {__pyx_filename = __pyx_f[2]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_14 = (__Pyx_PyDict_Contains(__pyx_v_col, ((PyObject *)__pyx_v_row), Py_EQ)); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          if (__pyx_t_14) {

     406:                 result[i, j] = row[col]

            /* "lib.pyx":406
     *             col = columns[j]
     *             if col in row:
     *                 result[i, j] = row[col]             # <<<<<<<<<<<<<<
     *             else:
     *                 result[i, j] = onan
     */
            if (unlikely(((PyObject *)__pyx_v_row) == Py_None)) {
              PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
              {__pyx_filename = __pyx_f[2]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_row), __pyx_v_col); if (!__pyx_t_2) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_2);
            __pyx_t_15 = __pyx_v_i;
            __pyx_t_16 = __pyx_v_j;
            __pyx_t_17 = __Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_result.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_result.diminfo[1].strides);
            __Pyx_GOTREF(*__pyx_t_17);
            __Pyx_INCREF(__pyx_t_2); __Pyx_DECREF(*__pyx_t_17);
            *__pyx_t_17 = __pyx_t_2;
            __Pyx_GIVEREF(*__pyx_t_17);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            goto __pyx_L7;
          }
          /*else*/ {

     407:             else:

     408:                 result[i, j] = onan

            /* "lib.pyx":408
     *                 result[i, j] = row[col]
     *             else:
     *                 result[i, j] = onan             # <<<<<<<<<<<<<<
     *
     *     return result
     */
            __pyx_t_18 = __pyx_v_i;
            __pyx_t_19 = __pyx_v_j;
            __pyx_t_17 = __Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_result.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_result.diminfo[1].strides);
            __Pyx_GOTREF(*__pyx_t_17);
            __Pyx_INCREF(__pyx_v_onan); __Pyx_DECREF(*__pyx_t_17);
            *__pyx_t_17 = __pyx_v_onan;
            __Pyx_GIVEREF(*__pyx_t_17);
          }
          __pyx_L7:;
        }
      }

     409:

     410:     return result

      /* "lib.pyx":410
     *                 result[i, j] = onan
     *
     *     return result             # <<<<<<<<<<<<<<
     *
     *
     */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_result));
      __pyx_r = ((PyObject *)__pyx_v_result);
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.dicts_to_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF((PyObject *)__pyx_v_result);
      __Pyx_XDECREF(__pyx_v_row);
      __Pyx_XDECREF(__pyx_v_col);
      __Pyx_XDECREF(__pyx_v_onan);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_41fast_zip(PyObject *__pyx_self, PyObject *__pyx_v_ndarrays); /*proto*/
    static char __pyx_doc_3lib_40fast_zip[] = "\n    For zipping multiple ndarrays into an ndarray of tuples\n    ";
    static PyMethodDef __pyx_mdef_3lib_41fast_zip = {__Pyx_NAMESTR("fast_zip"), (PyCFunction)__pyx_pw_3lib_41fast_zip, METH_O, __Pyx_DOCSTR(__pyx_doc_3lib_40fast_zip)};
    static PyObject *__pyx_pw_3lib_41fast_zip(PyObject *__pyx_self, PyObject *__pyx_v_ndarrays) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("fast_zip (wrapper)", 0);
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ndarrays), (&PyList_Type), 1, "ndarrays", 1))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_40fast_zip(__pyx_self, ((PyObject*)__pyx_v_ndarrays));
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     411:

     412:

     413: def fast_zip(list ndarrays):

    /* "lib.pyx":413
     *
     *
     * def fast_zip(list ndarrays):             # <<<<<<<<<<<<<<
     *     '''
     *     For zipping multiple ndarrays into an ndarray of tuples
     */

    static PyObject *__pyx_pf_3lib_40fast_zip(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ndarrays) {
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_j;
      Py_ssize_t __pyx_v_k;
      Py_ssize_t __pyx_v_n;
      PyArrayObject *__pyx_v_result = 0;
      PyArrayIterObject *__pyx_v_it = 0;
      PyObject *__pyx_v_val = 0;
      PyObject *__pyx_v_tup = 0;
      PyObject *__pyx_v_arr = NULL;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
      __Pyx_Buffer __pyx_pybuffer_result;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("fast_zip", 0);
      __pyx_pybuffer_result.pybuffer.buf = NULL;
      __pyx_pybuffer_result.refcount = 0;
      __pyx_pybuffernd_result.data = NULL;
      __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;

      /* "lib.pyx":413
     *
     *
     * def fast_zip(list ndarrays):             # <<<<<<<<<<<<<<
     *     '''
     *     For zipping multiple ndarrays into an ndarray of tuples
     */
      __pyx_k_tuple_131 = PyTuple_New(10); if (unlikely(!__pyx_k_tuple_131)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_131);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__ndarrays));
      PyTuple_SET_ITEM(__pyx_k_tuple_131, 0, ((PyObject *)__pyx_n_s__ndarrays));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ndarrays));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_131, 1, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
      PyTuple_SET_ITEM(__pyx_k_tuple_131, 2, ((PyObject *)__pyx_n_s__j));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
      PyTuple_SET_ITEM(__pyx_k_tuple_131, 3, ((PyObject *)__pyx_n_s__k));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_131, 4, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
      PyTuple_SET_ITEM(__pyx_k_tuple_131, 5, ((PyObject *)__pyx_n_s__result));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__it));
      PyTuple_SET_ITEM(__pyx_k_tuple_131, 6, ((PyObject *)__pyx_n_s__it));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__it));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
      PyTuple_SET_ITEM(__pyx_k_tuple_131, 7, ((PyObject *)__pyx_n_s__val));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__tup));
      PyTuple_SET_ITEM(__pyx_k_tuple_131, 8, ((PyObject *)__pyx_n_s__tup));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tup));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__arr));
      PyTuple_SET_ITEM(__pyx_k_tuple_131, 9, ((PyObject *)__pyx_n_s__arr));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__arr));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_131));

      /* "lib.pyx":413
     *
     *
     * def fast_zip(list ndarrays):             # <<<<<<<<<<<<<<
     *     '''
     *     For zipping multiple ndarrays into an ndarray of tuples
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_41fast_zip, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__fast_zip, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_132 = (PyObject*)__Pyx_PyCode_New(1, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_131, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__fast_zip, 413, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_132)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     414:     '''

     415:     For zipping multiple ndarrays into an ndarray of tuples

     416:     '''

     417:     cdef:

     418:         Py_ssize_t i, j, k, n

     419:         ndarray[object] result

     420:         flatiter it

     421:         object val, tup

     422:

     423:     k = len(ndarrays)

      /* "lib.pyx":423
     *         object val, tup
     *
     *     k = len(ndarrays)             # <<<<<<<<<<<<<<
     *     n = len(ndarrays[0])
     *
     */
      if (unlikely(((PyObject *)__pyx_v_ndarrays) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_1 = PyList_GET_SIZE(((PyObject *)__pyx_v_ndarrays)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_k = __pyx_t_1;

     424:     n = len(ndarrays[0])

      /* "lib.pyx":424
     *
     *     k = len(ndarrays)
     *     n = len(ndarrays[0])             # <<<<<<<<<<<<<<
     *
     *     result = np.empty(n, dtype=object)
     */
      if (unlikely(((PyObject *)__pyx_v_ndarrays) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_ndarrays), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_n = __pyx_t_1;

     425:

     426:     result = np.empty(n, dtype=object)

      /* "lib.pyx":426
     *     n = len(ndarrays[0])
     *
     *     result = np.empty(n, dtype=object)             # <<<<<<<<<<<<<<
     *
     *     # initialize tuples on first pass
     */
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
        __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_7 < 0)) {
          PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
          }
        }
        __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_6 = 0;
      __pyx_v_result = ((PyArrayObject *)__pyx_t_5);
      __pyx_t_5 = 0;

     427:

     428:     # initialize tuples on first pass

     429:     arr = ndarrays[0]

      /* "lib.pyx":429
     *
     *     # initialize tuples on first pass
     *     arr = ndarrays[0]             # <<<<<<<<<<<<<<
     *     it = <flatiter> PyArray_IterNew(arr)
     *     for i in range(n):
     */
      if (unlikely(((PyObject *)__pyx_v_ndarrays) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_5 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_ndarrays), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_arr = __pyx_t_5;
      __pyx_t_5 = 0;

     430:     it = <flatiter> PyArray_IterNew(arr)

      /* "lib.pyx":430
     *     # initialize tuples on first pass
     *     arr = ndarrays[0]
     *     it = <flatiter> PyArray_IterNew(arr)             # <<<<<<<<<<<<<<
     *     for i in range(n):
     *         val = PyArray_GETITEM(arr, PyArray_ITER_DATA(it))
     */
      __pyx_t_5 = PyArray_IterNew(__pyx_v_arr); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = __pyx_t_5;
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_it = ((PyArrayIterObject *)__pyx_t_2);
      __pyx_t_2 = 0;

     431:     for i in range(n):

      /* "lib.pyx":431
     *     arr = ndarrays[0]
     *     it = <flatiter> PyArray_IterNew(arr)
     *     for i in range(n):             # <<<<<<<<<<<<<<
     *         val = PyArray_GETITEM(arr, PyArray_ITER_DATA(it))
     *         tup = PyTuple_New(k)
     */
      __pyx_t_1 = __pyx_v_n;
      for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_1; __pyx_t_11+=1) {
        __pyx_v_i = __pyx_t_11;

     432:         val = PyArray_GETITEM(arr, PyArray_ITER_DATA(it))

        /* "lib.pyx":432
     *     it = <flatiter> PyArray_IterNew(arr)
     *     for i in range(n):
     *         val = PyArray_GETITEM(arr, PyArray_ITER_DATA(it))             # <<<<<<<<<<<<<<
     *         tup = PyTuple_New(k)
     *
     */
        if (!(likely(((__pyx_v_arr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_arr, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_2 = __pyx_v_arr;
        __Pyx_INCREF(__pyx_t_2);
        __pyx_t_5 = PyArray_GETITEM(((PyArrayObject *)__pyx_t_2), PyArray_ITER_DATA(__pyx_v_it)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_v_val);
        __pyx_v_val = __pyx_t_5;
        __pyx_t_5 = 0;

     433:         tup = PyTuple_New(k)

        /* "lib.pyx":433
     *     for i in range(n):
     *         val = PyArray_GETITEM(arr, PyArray_ITER_DATA(it))
     *         tup = PyTuple_New(k)             # <<<<<<<<<<<<<<
     *
     *         PyTuple_SET_ITEM(tup, 0, val)
     */
        __pyx_t_5 = ((PyObject *)PyTuple_New(__pyx_v_k)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_XDECREF(__pyx_v_tup);
        __pyx_v_tup = __pyx_t_5;
        __pyx_t_5 = 0;

     434:

     435:         PyTuple_SET_ITEM(tup, 0, val)

        /* "lib.pyx":435
     *         tup = PyTuple_New(k)
     *
     *         PyTuple_SET_ITEM(tup, 0, val)             # <<<<<<<<<<<<<<
     *         Py_INCREF(val)
     *         result[i] = tup
     */
        PyTuple_SET_ITEM(__pyx_v_tup, 0, __pyx_v_val);

     436:         Py_INCREF(val)

        /* "lib.pyx":436
     *
     *         PyTuple_SET_ITEM(tup, 0, val)
     *         Py_INCREF(val)             # <<<<<<<<<<<<<<
     *         result[i] = tup
     *         PyArray_ITER_NEXT(it)
     */
        Py_INCREF(__pyx_v_val);

     437:         result[i] = tup

        /* "lib.pyx":437
     *         PyTuple_SET_ITEM(tup, 0, val)
     *         Py_INCREF(val)
     *         result[i] = tup             # <<<<<<<<<<<<<<
     *         PyArray_ITER_NEXT(it)
     *
     */
        __pyx_t_12 = __pyx_v_i;
        __pyx_t_7 = -1;
        if (__pyx_t_12 < 0) {
          __pyx_t_12 += __pyx_pybuffernd_result.diminfo[0].shape;
          if (unlikely(__pyx_t_12 < 0)) __pyx_t_7 = 0;
        } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_result.diminfo[0].shape)) __pyx_t_7 = 0;
        if (unlikely(__pyx_t_7 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_7);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_13 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_result.diminfo[0].strides);
        __Pyx_GOTREF(*__pyx_t_13);
        __Pyx_INCREF(__pyx_v_tup); __Pyx_DECREF(*__pyx_t_13);
        *__pyx_t_13 = __pyx_v_tup;
        __Pyx_GIVEREF(*__pyx_t_13);

     438:         PyArray_ITER_NEXT(it)

        /* "lib.pyx":438
     *         Py_INCREF(val)
     *         result[i] = tup
     *         PyArray_ITER_NEXT(it)             # <<<<<<<<<<<<<<
     *
     *     for j in range(1, k):
     */
        PyArray_ITER_NEXT(__pyx_v_it);
      }

     439:

     440:     for j in range(1, k):

      /* "lib.pyx":440
     *         PyArray_ITER_NEXT(it)
     *
     *     for j in range(1, k):             # <<<<<<<<<<<<<<
     *         arr = ndarrays[j]
     *         it = <flatiter> PyArray_IterNew(arr)
     */
      __pyx_t_1 = __pyx_v_k;
      for (__pyx_t_11 = 1; __pyx_t_11 < __pyx_t_1; __pyx_t_11+=1) {
        __pyx_v_j = __pyx_t_11;

     441:         arr = ndarrays[j]

        /* "lib.pyx":441
     *
     *     for j in range(1, k):
     *         arr = ndarrays[j]             # <<<<<<<<<<<<<<
     *         it = <flatiter> PyArray_IterNew(arr)
     *         if len(arr) != n:
     */
        if (unlikely(((PyObject *)__pyx_v_ndarrays) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_5 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_ndarrays), __pyx_v_j, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_5) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_v_arr);
        __pyx_v_arr = __pyx_t_5;
        __pyx_t_5 = 0;

     442:         it = <flatiter> PyArray_IterNew(arr)

        /* "lib.pyx":442
     *     for j in range(1, k):
     *         arr = ndarrays[j]
     *         it = <flatiter> PyArray_IterNew(arr)             # <<<<<<<<<<<<<<
     *         if len(arr) != n:
     *             raise ValueError('all arrays must be same length')
     */
        __pyx_t_5 = PyArray_IterNew(__pyx_v_arr); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_2 = __pyx_t_5;
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_v_it));
        __pyx_v_it = ((PyArrayIterObject *)__pyx_t_2);
        __pyx_t_2 = 0;

     443:         if len(arr) != n:

        /* "lib.pyx":443
     *         arr = ndarrays[j]
     *         it = <flatiter> PyArray_IterNew(arr)
     *         if len(arr) != n:             # <<<<<<<<<<<<<<
     *             raise ValueError('all arrays must be same length')
     *
     */
        __pyx_t_14 = PyObject_Length(__pyx_v_arr); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_15 = (__pyx_t_14 != __pyx_v_n);
        if (__pyx_t_15) {

     444:             raise ValueError('all arrays must be same length')

          /* "lib.pyx":444
     *         it = <flatiter> PyArray_IterNew(arr)
     *         if len(arr) != n:
     *             raise ValueError('all arrays must be same length')             # <<<<<<<<<<<<<<
     *
     *         for i in range(n):
     */
          __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_Raise(__pyx_t_2, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          goto __pyx_L7;
        }
        __pyx_L7:;

      /* "lib.pyx":444
     *         it = <flatiter> PyArray_IterNew(arr)
     *         if len(arr) != n:
     *             raise ValueError('all arrays must be same length')             # <<<<<<<<<<<<<<
     *
     *         for i in range(n):
     */
      __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_2);
      __Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
      PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_s_1));
      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));

     445:

     446:         for i in range(n):

        /* "lib.pyx":446
     *             raise ValueError('all arrays must be same length')
     *
     *         for i in range(n):             # <<<<<<<<<<<<<<
     *             val = PyArray_GETITEM(arr, PyArray_ITER_DATA(it))
     *             PyTuple_SET_ITEM(result[i], j, val)
     */
        __pyx_t_14 = __pyx_v_n;
        for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_14; __pyx_t_16+=1) {
          __pyx_v_i = __pyx_t_16;

     447:             val = PyArray_GETITEM(arr, PyArray_ITER_DATA(it))

          /* "lib.pyx":447
     *
     *         for i in range(n):
     *             val = PyArray_GETITEM(arr, PyArray_ITER_DATA(it))             # <<<<<<<<<<<<<<
     *             PyTuple_SET_ITEM(result[i], j, val)
     *             Py_INCREF(val)
     */
          if (!(likely(((__pyx_v_arr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_arr, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __pyx_t_2 = __pyx_v_arr;
          __Pyx_INCREF(__pyx_t_2);
          __pyx_t_5 = PyArray_GETITEM(((PyArrayObject *)__pyx_t_2), PyArray_ITER_DATA(__pyx_v_it)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF(__pyx_v_val);
          __pyx_v_val = __pyx_t_5;
          __pyx_t_5 = 0;

     448:             PyTuple_SET_ITEM(result[i], j, val)

          /* "lib.pyx":448
     *         for i in range(n):
     *             val = PyArray_GETITEM(arr, PyArray_ITER_DATA(it))
     *             PyTuple_SET_ITEM(result[i], j, val)             # <<<<<<<<<<<<<<
     *             Py_INCREF(val)
     *             PyArray_ITER_NEXT(it)
     */
          __pyx_t_17 = __pyx_v_i;
          __pyx_t_7 = -1;
          if (__pyx_t_17 < 0) {
            __pyx_t_17 += __pyx_pybuffernd_result.diminfo[0].shape;
            if (unlikely(__pyx_t_17 < 0)) __pyx_t_7 = 0;
          } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_result.diminfo[0].shape)) __pyx_t_7 = 0;
          if (unlikely(__pyx_t_7 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_7);
            {__pyx_filename = __pyx_f[2]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_5 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_result.diminfo[0].strides);
          __Pyx_INCREF((PyObject*)__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_5, __pyx_v_j, __pyx_v_val);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

     449:             Py_INCREF(val)

          /* "lib.pyx":449
     *             val = PyArray_GETITEM(arr, PyArray_ITER_DATA(it))
     *             PyTuple_SET_ITEM(result[i], j, val)
     *             Py_INCREF(val)             # <<<<<<<<<<<<<<
     *             PyArray_ITER_NEXT(it)
     *
     */
          Py_INCREF(__pyx_v_val);

     450:             PyArray_ITER_NEXT(it)

          /* "lib.pyx":450
     *             PyTuple_SET_ITEM(result[i], j, val)
     *             Py_INCREF(val)
     *             PyArray_ITER_NEXT(it)             # <<<<<<<<<<<<<<
     *
     *     return result
     */
          PyArray_ITER_NEXT(__pyx_v_it);
        }
      }

     451:

     452:     return result

      /* "lib.pyx":452
     *             PyArray_ITER_NEXT(it)
     *
     *     return result             # <<<<<<<<<<<<<<
     *
     * def get_reverse_indexer(ndarray[int64_t] indexer, Py_ssize_t length):
     */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_result));
      __pyx_r = ((PyObject *)__pyx_v_result);
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.fast_zip", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF((PyObject *)__pyx_v_result);
      __Pyx_XDECREF((PyObject *)__pyx_v_it);
      __Pyx_XDECREF(__pyx_v_val);
      __Pyx_XDECREF(__pyx_v_tup);
      __Pyx_XDECREF(__pyx_v_arr);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_43get_reverse_indexer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_43get_reverse_indexer = {__Pyx_NAMESTR("get_reverse_indexer"), (PyCFunction)__pyx_pw_3lib_43get_reverse_indexer, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_43get_reverse_indexer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyArrayObject *__pyx_v_indexer = 0;
      Py_ssize_t __pyx_v_length;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("get_reverse_indexer (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__indexer,&__pyx_n_s__length,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indexer)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            case  1:
            if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__length)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("get_reverse_indexer", 1, 2, 2, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_reverse_indexer") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        }
        __pyx_v_indexer = ((PyArrayObject *)values[0]);
        __pyx_v_length = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_length == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("get_reverse_indexer", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_L3_error:;
      __Pyx_AddTraceback("lib.get_reverse_indexer", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indexer), __pyx_ptype_5numpy_ndarray, 1, "indexer", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_42get_reverse_indexer(__pyx_self, __pyx_v_indexer, __pyx_v_length);
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     453:

     454: def get_reverse_indexer(ndarray[int64_t] indexer, Py_ssize_t length):

    /* "lib.pyx":454
     *     return result
     *
     * def get_reverse_indexer(ndarray[int64_t] indexer, Py_ssize_t length):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(indexer)
     */

    static PyObject *__pyx_pf_3lib_42get_reverse_indexer(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_indexer, Py_ssize_t __pyx_v_length) {
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_n;
      PyArrayObject *__pyx_v_rev_indexer = 0;
      __pyx_t_5numpy_int64_t __pyx_v_idx;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
      __Pyx_Buffer __pyx_pybuffer_indexer;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_rev_indexer;
      __Pyx_Buffer __pyx_pybuffer_rev_indexer;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("get_reverse_indexer", 0);
      __pyx_pybuffer_rev_indexer.pybuffer.buf = NULL;
      __pyx_pybuffer_rev_indexer.refcount = 0;
      __pyx_pybuffernd_rev_indexer.data = NULL;
      __pyx_pybuffernd_rev_indexer.rcbuffer = &__pyx_pybuffer_rev_indexer;
      __pyx_pybuffer_indexer.pybuffer.buf = NULL;
      __pyx_pybuffer_indexer.refcount = 0;
      __pyx_pybuffernd_indexer.data = NULL;
      __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0];

      /* "lib.pyx":454
     *     return result
     *
     * def get_reverse_indexer(ndarray[int64_t] indexer, Py_ssize_t length):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(indexer)
     */
      __pyx_k_tuple_133 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_133)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_133);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer));
      PyTuple_SET_ITEM(__pyx_k_tuple_133, 0, ((PyObject *)__pyx_n_s__indexer));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__length));
      PyTuple_SET_ITEM(__pyx_k_tuple_133, 1, ((PyObject *)__pyx_n_s__length));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__length));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_133, 2, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_133, 3, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__rev_indexer));
      PyTuple_SET_ITEM(__pyx_k_tuple_133, 4, ((PyObject *)__pyx_n_s__rev_indexer));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rev_indexer));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
      PyTuple_SET_ITEM(__pyx_k_tuple_133, 5, ((PyObject *)__pyx_n_s__idx));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_133));

      /* "lib.pyx":454
     *     return result
     *
     * def get_reverse_indexer(ndarray[int64_t] indexer, Py_ssize_t length):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(indexer)
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_43get_reverse_indexer, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__get_reverse_indexer, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_134 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_133, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__get_reverse_indexer, 454, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_134)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     455:     cdef:

     456:         Py_ssize_t i, n = len(indexer)

      /* "lib.pyx":456
     * def get_reverse_indexer(ndarray[int64_t] indexer, Py_ssize_t length):
     *     cdef:
     *         Py_ssize_t i, n = len(indexer)             # <<<<<<<<<<<<<<
     *         ndarray[int64_t] rev_indexer
     *         int64_t idx
     */
      __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_indexer)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_n = __pyx_t_1;

     457:         ndarray[int64_t] rev_indexer

     458:         int64_t idx

     459:

     460:     rev_indexer = np.empty(length, dtype=np.int64)

      /* "lib.pyx":460
     *         int64_t idx
     *
     *     rev_indexer = np.empty(length, dtype=np.int64)             # <<<<<<<<<<<<<<
     *     rev_indexer.fill(-1)
     *     for i in range(n):
     */
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rev_indexer.rcbuffer->pybuffer);
        __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rev_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_8 < 0)) {
          PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rev_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_rev_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
          }
        }
        __pyx_pybuffernd_rev_indexer.diminfo[0].strides = __pyx_pybuffernd_rev_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rev_indexer.diminfo[0].shape = __pyx_pybuffernd_rev_indexer.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_7 = 0;
      __pyx_v_rev_indexer = ((PyArrayObject *)__pyx_t_6);
      __pyx_t_6 = 0;

     461:     rev_indexer.fill(-1)

      /* "lib.pyx":461
     *
     *     rev_indexer = np.empty(length, dtype=np.int64)
     *     rev_indexer.fill(-1)             # <<<<<<<<<<<<<<
     *     for i in range(n):
     *         idx = indexer[i]
     */
      __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_rev_indexer), __pyx_n_s__fill); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "lib.pyx":461
     *
     *     rev_indexer = np.empty(length, dtype=np.int64)
     *     rev_indexer.fill(-1)             # <<<<<<<<<<<<<<
     *     for i in range(n):
     *         idx = indexer[i]
     */
      __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_3);
      __Pyx_INCREF(__pyx_int_neg_1);
      PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, __pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3));

     462:     for i in range(n):

      /* "lib.pyx":462
     *     rev_indexer = np.empty(length, dtype=np.int64)
     *     rev_indexer.fill(-1)
     *     for i in range(n):             # <<<<<<<<<<<<<<
     *         idx = indexer[i]
     *         if idx != -1:
     */
      __pyx_t_1 = __pyx_v_n;
      for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_1; __pyx_t_12+=1) {
        __pyx_v_i = __pyx_t_12;

     463:         idx = indexer[i]

        /* "lib.pyx":463
     *     rev_indexer.fill(-1)
     *     for i in range(n):
     *         idx = indexer[i]             # <<<<<<<<<<<<<<
     *         if idx != -1:
     *             rev_indexer[idx] = i
     */
        __pyx_t_13 = __pyx_v_i;
        __pyx_t_8 = -1;
        if (__pyx_t_13 < 0) {
          __pyx_t_13 += __pyx_pybuffernd_indexer.diminfo[0].shape;
          if (unlikely(__pyx_t_13 < 0)) __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_indexer.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_indexer.diminfo[0].strides));

     464:         if idx != -1:

        /* "lib.pyx":464
     *     for i in range(n):
     *         idx = indexer[i]
     *         if idx != -1:             # <<<<<<<<<<<<<<
     *             rev_indexer[idx] = i
     *
     */
        __pyx_t_14 = (__pyx_v_idx != -1);
        if (__pyx_t_14) {

     465:             rev_indexer[idx] = i

          /* "lib.pyx":465
     *         idx = indexer[i]
     *         if idx != -1:
     *             rev_indexer[idx] = i             # <<<<<<<<<<<<<<
     *
     *     return rev_indexer
     */
          __pyx_t_15 = __pyx_v_idx;
          __pyx_t_8 = -1;
          if (__pyx_t_15 < 0) {
            __pyx_t_15 += __pyx_pybuffernd_rev_indexer.diminfo[0].shape;
            if (unlikely(__pyx_t_15 < 0)) __pyx_t_8 = 0;
          } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_rev_indexer.diminfo[0].shape)) __pyx_t_8 = 0;
          if (unlikely(__pyx_t_8 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_8);
            {__pyx_filename = __pyx_f[2]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rev_indexer.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_rev_indexer.diminfo[0].strides) = __pyx_v_i;
          goto __pyx_L5;
        }
        __pyx_L5:;
      }

     466:

     467:     return rev_indexer

      /* "lib.pyx":467
     *             rev_indexer[idx] = i
     *
     *     return rev_indexer             # <<<<<<<<<<<<<<
     *
     *
     */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_rev_indexer));
      __pyx_r = ((PyObject *)__pyx_v_rev_indexer);
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rev_indexer.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.get_reverse_indexer", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rev_indexer.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF((PyObject *)__pyx_v_rev_indexer);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_45has_infs_f4(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_45has_infs_f4 = {__Pyx_NAMESTR("has_infs_f4"), (PyCFunction)__pyx_pw_3lib_45has_infs_f4, METH_O, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_45has_infs_f4(PyObject *__pyx_self, PyObject *__pyx_v_arr) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("has_infs_f4 (wrapper)", 0);
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_44has_infs_f4(__pyx_self, ((PyArrayObject *)__pyx_v_arr));
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     468:

     469:

     470: def has_infs_f4(ndarray[float32_t] arr):

    /* "lib.pyx":470
     *
     *
     * def has_infs_f4(ndarray[float32_t] arr):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(arr)
     */

    static PyObject *__pyx_pf_3lib_44has_infs_f4(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr) {
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_n;
      __pyx_t_5numpy_float32_t __pyx_v_inf;
      __pyx_t_5numpy_float32_t __pyx_v_neginf;
      __pyx_t_5numpy_float32_t __pyx_v_val;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_arr;
      __Pyx_Buffer __pyx_pybuffer_arr;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("has_infs_f4", 0);
      __pyx_pybuffer_arr.pybuffer.buf = NULL;
      __pyx_pybuffer_arr.refcount = 0;
      __pyx_pybuffernd_arr.data = NULL;
      __pyx_pybuffernd_arr.rcbuffer = &__pyx_pybuffer_arr;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_arr.rcbuffer->pybuffer, (PyObject*)__pyx_v_arr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_arr.diminfo[0].strides = __pyx_pybuffernd_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_arr.diminfo[0].shape = __pyx_pybuffernd_arr.rcbuffer->pybuffer.shape[0];

      /* "lib.pyx":470
     *
     *
     * def has_infs_f4(ndarray[float32_t] arr):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(arr)
     */
      __pyx_k_tuple_135 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_135)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_135);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__arr));
      PyTuple_SET_ITEM(__pyx_k_tuple_135, 0, ((PyObject *)__pyx_n_s__arr));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__arr));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_135, 1, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_135, 2, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__inf));
      PyTuple_SET_ITEM(__pyx_k_tuple_135, 3, ((PyObject *)__pyx_n_s__inf));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__inf));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__neginf));
      PyTuple_SET_ITEM(__pyx_k_tuple_135, 4, ((PyObject *)__pyx_n_s__neginf));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__neginf));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
      PyTuple_SET_ITEM(__pyx_k_tuple_135, 5, ((PyObject *)__pyx_n_s__val));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_135));

      /* "lib.pyx":470
     *
     *
     * def has_infs_f4(ndarray[float32_t] arr):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(arr)
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_45has_infs_f4, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__has_infs_f4, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_136 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_135, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__has_infs_f4, 470, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_136)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     471:     cdef:

     472:         Py_ssize_t i, n = len(arr)

      /* "lib.pyx":472
     * def has_infs_f4(ndarray[float32_t] arr):
     *     cdef:
     *         Py_ssize_t i, n = len(arr)             # <<<<<<<<<<<<<<
     *         float32_t inf, neginf, val
     *
     */
      __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_arr)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_n = __pyx_t_1;

     473:         float32_t inf, neginf, val

     474:

     475:     inf = np.inf

      /* "lib.pyx":475
     *         float32_t inf, neginf, val
     *
     *     inf = np.inf             # <<<<<<<<<<<<<<
     *     neginf = -inf
     *
     */
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__inf); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_4 == (npy_float32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_inf = __pyx_t_4;

     476:     neginf = -inf

      /* "lib.pyx":476
     *
     *     inf = np.inf
     *     neginf = -inf             # <<<<<<<<<<<<<<
     *
     *     for i in range(n):
     */
      __pyx_v_neginf = (-__pyx_v_inf);

     477:

     478:     for i in range(n):

      /* "lib.pyx":478
     *     neginf = -inf
     *
     *     for i in range(n):             # <<<<<<<<<<<<<<
     *         val = arr[i]
     *         if val == inf or val == neginf:
     */
      __pyx_t_1 = __pyx_v_n;
      for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_1; __pyx_t_5+=1) {
        __pyx_v_i = __pyx_t_5;

     479:         val = arr[i]

        /* "lib.pyx":479
     *
     *     for i in range(n):
     *         val = arr[i]             # <<<<<<<<<<<<<<
     *         if val == inf or val == neginf:
     *             return True
     */
        __pyx_t_6 = __pyx_v_i;
        __pyx_t_7 = -1;
        if (__pyx_t_6 < 0) {
          __pyx_t_6 += __pyx_pybuffernd_arr.diminfo[0].shape;
          if (unlikely(__pyx_t_6 < 0)) __pyx_t_7 = 0;
        } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_arr.diminfo[0].shape)) __pyx_t_7 = 0;
        if (unlikely(__pyx_t_7 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_7);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_arr.diminfo[0].strides));

     480:         if val == inf or val == neginf:

        /* "lib.pyx":480
     *     for i in range(n):
     *         val = arr[i]
     *         if val == inf or val == neginf:             # <<<<<<<<<<<<<<
     *             return True
     *     return False
     */
        __pyx_t_8 = (__pyx_v_val == __pyx_v_inf);
        if (!__pyx_t_8) {
          __pyx_t_9 = (__pyx_v_val == __pyx_v_neginf);
          __pyx_t_10 = __pyx_t_9;
        } else {
          __pyx_t_10 = __pyx_t_8;
        }
        if (__pyx_t_10) {

     481:             return True

          /* "lib.pyx":481
     *         val = arr[i]
     *         if val == inf or val == neginf:
     *             return True             # <<<<<<<<<<<<<<
     *     return False
     *
     */
          __Pyx_XDECREF(__pyx_r);
          __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_r = __pyx_t_3;
          __pyx_t_3 = 0;
          goto __pyx_L0;
          goto __pyx_L5;
        }
        __pyx_L5:;
      }

     482:     return False

      /* "lib.pyx":482
     *         if val == inf or val == neginf:
     *             return True
     *     return False             # <<<<<<<<<<<<<<
     *
     * def has_infs_f8(ndarray[float64_t] arr):
     */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.has_infs_f4", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_47has_infs_f8(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_47has_infs_f8 = {__Pyx_NAMESTR("has_infs_f8"), (PyCFunction)__pyx_pw_3lib_47has_infs_f8, METH_O, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_47has_infs_f8(PyObject *__pyx_self, PyObject *__pyx_v_arr) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("has_infs_f8 (wrapper)", 0);
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_46has_infs_f8(__pyx_self, ((PyArrayObject *)__pyx_v_arr));
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     483:

     484: def has_infs_f8(ndarray[float64_t] arr):

    /* "lib.pyx":484
     *     return False
     *
     * def has_infs_f8(ndarray[float64_t] arr):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(arr)
     */

    static PyObject *__pyx_pf_3lib_46has_infs_f8(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr) {
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_n;
      __pyx_t_5numpy_float64_t __pyx_v_inf;
      __pyx_t_5numpy_float64_t __pyx_v_neginf;
      __pyx_t_5numpy_float64_t __pyx_v_val;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_arr;
      __Pyx_Buffer __pyx_pybuffer_arr;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("has_infs_f8", 0);
      __pyx_pybuffer_arr.pybuffer.buf = NULL;
      __pyx_pybuffer_arr.refcount = 0;
      __pyx_pybuffernd_arr.data = NULL;
      __pyx_pybuffernd_arr.rcbuffer = &__pyx_pybuffer_arr;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_arr.rcbuffer->pybuffer, (PyObject*)__pyx_v_arr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_arr.diminfo[0].strides = __pyx_pybuffernd_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_arr.diminfo[0].shape = __pyx_pybuffernd_arr.rcbuffer->pybuffer.shape[0];

      /* "lib.pyx":484
     *     return False
     *
     * def has_infs_f8(ndarray[float64_t] arr):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(arr)
     */
      __pyx_k_tuple_137 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_137)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_137);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__arr));
      PyTuple_SET_ITEM(__pyx_k_tuple_137, 0, ((PyObject *)__pyx_n_s__arr));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__arr));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_137, 1, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_137, 2, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__inf));
      PyTuple_SET_ITEM(__pyx_k_tuple_137, 3, ((PyObject *)__pyx_n_s__inf));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__inf));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__neginf));
      PyTuple_SET_ITEM(__pyx_k_tuple_137, 4, ((PyObject *)__pyx_n_s__neginf));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__neginf));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
      PyTuple_SET_ITEM(__pyx_k_tuple_137, 5, ((PyObject *)__pyx_n_s__val));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_137));

      /* "lib.pyx":484
     *     return False
     *
     * def has_infs_f8(ndarray[float64_t] arr):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(arr)
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_47has_infs_f8, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__has_infs_f8, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_138 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_137, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__has_infs_f8, 484, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_138)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     485:     cdef:

     486:         Py_ssize_t i, n = len(arr)

      /* "lib.pyx":486
     * def has_infs_f8(ndarray[float64_t] arr):
     *     cdef:
     *         Py_ssize_t i, n = len(arr)             # <<<<<<<<<<<<<<
     *         float64_t inf, neginf, val
     *
     */
      __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_arr)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_n = __pyx_t_1;

     487:         float64_t inf, neginf, val

     488:

     489:     inf = np.inf

      /* "lib.pyx":489
     *         float64_t inf, neginf, val
     *
     *     inf = np.inf             # <<<<<<<<<<<<<<
     *     neginf = -inf
     *
     */
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__inf); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_inf = __pyx_t_4;

     490:     neginf = -inf

      /* "lib.pyx":490
     *
     *     inf = np.inf
     *     neginf = -inf             # <<<<<<<<<<<<<<
     *
     *     for i in range(n):
     */
      __pyx_v_neginf = (-__pyx_v_inf);

     491:

     492:     for i in range(n):

      /* "lib.pyx":492
     *     neginf = -inf
     *
     *     for i in range(n):             # <<<<<<<<<<<<<<
     *         val = arr[i]
     *         if val == inf or val == neginf:
     */
      __pyx_t_1 = __pyx_v_n;
      for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_1; __pyx_t_5+=1) {
        __pyx_v_i = __pyx_t_5;

     493:         val = arr[i]

        /* "lib.pyx":493
     *
     *     for i in range(n):
     *         val = arr[i]             # <<<<<<<<<<<<<<
     *         if val == inf or val == neginf:
     *             return True
     */
        __pyx_t_6 = __pyx_v_i;
        __pyx_t_7 = -1;
        if (__pyx_t_6 < 0) {
          __pyx_t_6 += __pyx_pybuffernd_arr.diminfo[0].shape;
          if (unlikely(__pyx_t_6 < 0)) __pyx_t_7 = 0;
        } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_arr.diminfo[0].shape)) __pyx_t_7 = 0;
        if (unlikely(__pyx_t_7 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_7);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_arr.diminfo[0].strides));

     494:         if val == inf or val == neginf:

        /* "lib.pyx":494
     *     for i in range(n):
     *         val = arr[i]
     *         if val == inf or val == neginf:             # <<<<<<<<<<<<<<
     *             return True
     *     return False
     */
        __pyx_t_8 = (__pyx_v_val == __pyx_v_inf);
        if (!__pyx_t_8) {
          __pyx_t_9 = (__pyx_v_val == __pyx_v_neginf);
          __pyx_t_10 = __pyx_t_9;
        } else {
          __pyx_t_10 = __pyx_t_8;
        }
        if (__pyx_t_10) {

     495:             return True

          /* "lib.pyx":495
     *         val = arr[i]
     *         if val == inf or val == neginf:
     *             return True             # <<<<<<<<<<<<<<
     *     return False
     *
     */
          __Pyx_XDECREF(__pyx_r);
          __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_r = __pyx_t_3;
          __pyx_t_3 = 0;
          goto __pyx_L0;
          goto __pyx_L5;
        }
        __pyx_L5:;
      }

     496:     return False

      /* "lib.pyx":496
     *         if val == inf or val == neginf:
     *             return True
     *     return False             # <<<<<<<<<<<<<<
     *
     * def convert_timestamps(ndarray values):
     */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.has_infs_f8", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_49convert_timestamps(PyObject *__pyx_self, PyObject *__pyx_v_values); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_49convert_timestamps = {__Pyx_NAMESTR("convert_timestamps"), (PyCFunction)__pyx_pw_3lib_49convert_timestamps, METH_O, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_49convert_timestamps(PyObject *__pyx_self, PyObject *__pyx_v_values) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("convert_timestamps (wrapper)", 0);
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_48convert_timestamps(__pyx_self, ((PyArrayObject *)__pyx_v_values));
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     497:

     498: def convert_timestamps(ndarray values):

    /* "lib.pyx":498
     *     return False
     *
     * def convert_timestamps(ndarray values):             # <<<<<<<<<<<<<<
     *     cdef:
     *         object val, f, result
     */

    static PyObject *__pyx_pf_3lib_48convert_timestamps(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values) {
      PyObject *__pyx_v_val = 0;
      PyObject *__pyx_v_f = 0;
      PyObject *__pyx_v_cache = 0;
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_n;
      PyArrayObject *__pyx_v_out = 0;
      PyObject *__pyx_v_datetime = NULL;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_out;
      __Pyx_Buffer __pyx_pybuffer_out;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("convert_timestamps", 0);
      __pyx_pybuffer_out.pybuffer.buf = NULL;
      __pyx_pybuffer_out.refcount = 0;
      __pyx_pybuffernd_out.data = NULL;
      __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;

      /* "lib.pyx":498
     *     return False
     *
     * def convert_timestamps(ndarray values):             # <<<<<<<<<<<<<<
     *     cdef:
     *         object val, f, result
     */
      __pyx_k_tuple_139 = PyTuple_New(9); if (unlikely(!__pyx_k_tuple_139)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_139);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
      PyTuple_SET_ITEM(__pyx_k_tuple_139, 0, ((PyObject *)__pyx_n_s__values));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
      PyTuple_SET_ITEM(__pyx_k_tuple_139, 1, ((PyObject *)__pyx_n_s__val));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__f));
      PyTuple_SET_ITEM(__pyx_k_tuple_139, 2, ((PyObject *)__pyx_n_s__f));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__f));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
      PyTuple_SET_ITEM(__pyx_k_tuple_139, 3, ((PyObject *)__pyx_n_s__result));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__cache));
      PyTuple_SET_ITEM(__pyx_k_tuple_139, 4, ((PyObject *)__pyx_n_s__cache));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cache));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_139, 5, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_139, 6, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
      PyTuple_SET_ITEM(__pyx_k_tuple_139, 7, ((PyObject *)__pyx_n_s__out));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__datetime));
      PyTuple_SET_ITEM(__pyx_k_tuple_139, 8, ((PyObject *)__pyx_n_s__datetime));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__datetime));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_139));

      /* "lib.pyx":498
     *     return False
     *
     * def convert_timestamps(ndarray values):             # <<<<<<<<<<<<<<
     *     cdef:
     *         object val, f, result
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_49convert_timestamps, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__convert_timestamps, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_140 = (PyObject*)__Pyx_PyCode_New(1, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_139, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__convert_timestamps, 498, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_140)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     499:     cdef:

     500:         object val, f, result

     501:         dict cache = {}

      /* "lib.pyx":501
     *     cdef:
     *         object val, f, result
     *         dict cache = {}             # <<<<<<<<<<<<<<
     *         Py_ssize_t i, n = len(values)
     *         ndarray[object] out
     */
      __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __pyx_v_cache = __pyx_t_1;
      __pyx_t_1 = 0;

     502:         Py_ssize_t i, n = len(values)

      /* "lib.pyx":502
     *         object val, f, result
     *         dict cache = {}
     *         Py_ssize_t i, n = len(values)             # <<<<<<<<<<<<<<
     *         ndarray[object] out
     *
     */
      __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_n = __pyx_t_2;

     503:         ndarray[object] out

     504:

     505:     # for HDFStore, a bit temporary but...

     506:

     507:     from datetime import datetime

      /* "lib.pyx":507
     *     # for HDFStore, a bit temporary but...
     *
     *     from datetime import datetime             # <<<<<<<<<<<<<<
     *     f = datetime.fromtimestamp
     *
     */
      __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__datetime));
      PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__datetime));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__datetime));
      __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__datetime), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__datetime);
      if (__pyx_t_1 == NULL) {
        if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__datetime);
        if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_datetime = __pyx_t_1;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

     508:     f = datetime.fromtimestamp

      /* "lib.pyx":508
     *
     *     from datetime import datetime
     *     f = datetime.fromtimestamp             # <<<<<<<<<<<<<<
     *
     *     out = np.empty(n, dtype='O')
     */
      __pyx_t_3 = PyObject_GetAttr(__pyx_v_datetime, __pyx_n_s__fromtimestamp); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_v_f = __pyx_t_3;
      __pyx_t_3 = 0;

     509:

     510:     out = np.empty(n, dtype='O')

      /* "lib.pyx":510
     *     f = datetime.fromtimestamp
     *
     *     out = np.empty(n, dtype='O')             # <<<<<<<<<<<<<<
     *
     *     for i in range(n):
     */
      __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__O)) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
        __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_7 < 0)) {
          PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
          }
        }
        __pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_6 = 0;
      __pyx_v_out = ((PyArrayObject *)__pyx_t_5);
      __pyx_t_5 = 0;

     511:

     512:     for i in range(n):

      /* "lib.pyx":512
     *     out = np.empty(n, dtype='O')
     *
     *     for i in range(n):             # <<<<<<<<<<<<<<
     *         val = util.get_value_1d(values, i)
     *         if val in cache:
     */
      __pyx_t_2 = __pyx_v_n;
      for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_2; __pyx_t_11+=1) {
        __pyx_v_i = __pyx_t_11;

     513:         val = util.get_value_1d(values, i)

        /* "lib.pyx":513
     *
     *     for i in range(n):
     *         val = util.get_value_1d(values, i)             # <<<<<<<<<<<<<<
     *         if val in cache:
     *             out[i] = cache[val]
     */
        __pyx_t_5 = get_value_1d(__pyx_v_values, __pyx_v_i); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_XDECREF(__pyx_v_val);
        __pyx_v_val = __pyx_t_5;
        __pyx_t_5 = 0;

     514:         if val in cache:

        /* "lib.pyx":514
     *     for i in range(n):
     *         val = util.get_value_1d(values, i)
     *         if val in cache:             # <<<<<<<<<<<<<<
     *             out[i] = cache[val]
     *         else:
     */
        __pyx_t_12 = (__Pyx_PyDict_Contains(__pyx_v_val, ((PyObject *)__pyx_v_cache), Py_EQ)); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        if (__pyx_t_12) {

     515:             out[i] = cache[val]

          /* "lib.pyx":515
     *         val = util.get_value_1d(values, i)
     *         if val in cache:
     *             out[i] = cache[val]             # <<<<<<<<<<<<<<
     *         else:
     *             cache[val] = out[i] = f(val)
     */
          __pyx_t_5 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_cache), __pyx_v_val); if (!__pyx_t_5) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_13 = __pyx_v_i;
          __pyx_t_7 = -1;
          if (__pyx_t_13 < 0) {
            __pyx_t_13 += __pyx_pybuffernd_out.diminfo[0].shape;
            if (unlikely(__pyx_t_13 < 0)) __pyx_t_7 = 0;
          } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_out.diminfo[0].shape)) __pyx_t_7 = 0;
          if (unlikely(__pyx_t_7 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_7);
            {__pyx_filename = __pyx_f[2]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_14 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_out.diminfo[0].strides);
          __Pyx_GOTREF(*__pyx_t_14);
          __Pyx_INCREF(__pyx_t_5); __Pyx_DECREF(*__pyx_t_14);
          *__pyx_t_14 = __pyx_t_5;
          __Pyx_GIVEREF(*__pyx_t_14);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          goto __pyx_L5;
        }
        /*else*/ {

     516:         else:

     517:             cache[val] = out[i] = f(val)

          /* "lib.pyx":517
     *             out[i] = cache[val]
     *         else:
     *             cache[val] = out[i] = f(val)             # <<<<<<<<<<<<<<
     *
     *     return out
     */
          __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_INCREF(__pyx_v_val);
          PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_val);
          __Pyx_GIVEREF(__pyx_v_val);
          __pyx_t_3 = PyObject_Call(__pyx_v_f, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
          if (PyDict_SetItem(((PyObject *)__pyx_v_cache), __pyx_v_val, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __pyx_t_15 = __pyx_v_i;
          __pyx_t_7 = -1;
          if (__pyx_t_15 < 0) {
            __pyx_t_15 += __pyx_pybuffernd_out.diminfo[0].shape;
            if (unlikely(__pyx_t_15 < 0)) __pyx_t_7 = 0;
          } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_out.diminfo[0].shape)) __pyx_t_7 = 0;
          if (unlikely(__pyx_t_7 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_7);
            {__pyx_filename = __pyx_f[2]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_14 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_out.diminfo[0].strides);
          __Pyx_GOTREF(*__pyx_t_14);
          __Pyx_INCREF(__pyx_t_3); __Pyx_DECREF(*__pyx_t_14);
          *__pyx_t_14 = __pyx_t_3;
          __Pyx_GIVEREF(*__pyx_t_14);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
        __pyx_L5:;
      }

     518:

     519:     return out

      /* "lib.pyx":519
     *             cache[val] = out[i] = f(val)
     *
     *     return out             # <<<<<<<<<<<<<<
     *
     * def maybe_indices_to_slice(ndarray[int64_t] indices):
     */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_out));
      __pyx_r = ((PyObject *)__pyx_v_out);
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.convert_timestamps", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF(__pyx_v_val);
      __Pyx_XDECREF(__pyx_v_f);
      __Pyx_XDECREF(__pyx_v_cache);
      __Pyx_XDECREF((PyObject *)__pyx_v_out);
      __Pyx_XDECREF(__pyx_v_datetime);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_51maybe_indices_to_slice(PyObject *__pyx_self, PyObject *__pyx_v_indices); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_51maybe_indices_to_slice = {__Pyx_NAMESTR("maybe_indices_to_slice"), (PyCFunction)__pyx_pw_3lib_51maybe_indices_to_slice, METH_O, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_51maybe_indices_to_slice(PyObject *__pyx_self, PyObject *__pyx_v_indices) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("maybe_indices_to_slice (wrapper)", 0);
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indices), __pyx_ptype_5numpy_ndarray, 1, "indices", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_50maybe_indices_to_slice(__pyx_self, ((PyArrayObject *)__pyx_v_indices));
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     520:

     521: def maybe_indices_to_slice(ndarray[int64_t] indices):

    /* "lib.pyx":521
     *     return out
     *
     * def maybe_indices_to_slice(ndarray[int64_t] indices):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(indices)
     */

    static PyObject *__pyx_pf_3lib_50maybe_indices_to_slice(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_indices) {
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_n;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_indices;
      __Pyx_Buffer __pyx_pybuffer_indices;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("maybe_indices_to_slice", 0);
      __pyx_pybuffer_indices.pybuffer.buf = NULL;
      __pyx_pybuffer_indices.refcount = 0;
      __pyx_pybuffernd_indices.data = NULL;
      __pyx_pybuffernd_indices.rcbuffer = &__pyx_pybuffer_indices;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indices.rcbuffer->pybuffer, (PyObject*)__pyx_v_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_indices.diminfo[0].strides = __pyx_pybuffernd_indices.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indices.diminfo[0].shape = __pyx_pybuffernd_indices.rcbuffer->pybuffer.shape[0];

      /* "lib.pyx":521
     *     return out
     *
     * def maybe_indices_to_slice(ndarray[int64_t] indices):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(indices)
     */
      __pyx_k_tuple_141 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_141)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_141);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__indices));
      PyTuple_SET_ITEM(__pyx_k_tuple_141, 0, ((PyObject *)__pyx_n_s__indices));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indices));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_141, 1, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_141, 2, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_141));

      /* "lib.pyx":521
     *     return out
     *
     * def maybe_indices_to_slice(ndarray[int64_t] indices):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(indices)
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_51maybe_indices_to_slice, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s_143, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_142 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_141, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s_143, 521, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_142)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     522:     cdef:

     523:         Py_ssize_t i, n = len(indices)

      /* "lib.pyx":523
     * def maybe_indices_to_slice(ndarray[int64_t] indices):
     *     cdef:
     *         Py_ssize_t i, n = len(indices)             # <<<<<<<<<<<<<<
     *
     *     if n == 0:
     */
      __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_indices)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_n = __pyx_t_1;

     524:

     525:     if n == 0:

      /* "lib.pyx":525
     *         Py_ssize_t i, n = len(indices)
     *
     *     if n == 0:             # <<<<<<<<<<<<<<
     *         return indices
     *
     */
      __pyx_t_2 = (__pyx_v_n == 0);
      if (__pyx_t_2) {

     526:         return indices

        /* "lib.pyx":526
     *
     *     if n == 0:
     *         return indices             # <<<<<<<<<<<<<<
     *
     *     for i in range(1, n):
     */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(((PyObject *)__pyx_v_indices));
        __pyx_r = ((PyObject *)__pyx_v_indices);
        goto __pyx_L0;
        goto __pyx_L3;
      }
      __pyx_L3:;

     527:

     528:     for i in range(1, n):

      /* "lib.pyx":528
     *         return indices
     *
     *     for i in range(1, n):             # <<<<<<<<<<<<<<
     *         if indices[i] - indices[i - 1] != 1:
     *             return indices
     */
      __pyx_t_1 = __pyx_v_n;
      for (__pyx_t_3 = 1; __pyx_t_3 < __pyx_t_1; __pyx_t_3+=1) {
        __pyx_v_i = __pyx_t_3;

     529:         if indices[i] - indices[i - 1] != 1:

        /* "lib.pyx":529
     *
     *     for i in range(1, n):
     *         if indices[i] - indices[i - 1] != 1:             # <<<<<<<<<<<<<<
     *             return indices
     *     return slice(indices[0], indices[n - 1] + 1)
     */
        __pyx_t_4 = __pyx_v_i;
        __pyx_t_5 = -1;
        if (__pyx_t_4 < 0) {
          __pyx_t_4 += __pyx_pybuffernd_indices.diminfo[0].shape;
          if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
        } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_indices.diminfo[0].shape)) __pyx_t_5 = 0;
        if (unlikely(__pyx_t_5 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_5);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_6 = (__pyx_v_i - 1);
        __pyx_t_5 = -1;
        if (__pyx_t_6 < 0) {
          __pyx_t_6 += __pyx_pybuffernd_indices.diminfo[0].shape;
          if (unlikely(__pyx_t_6 < 0)) __pyx_t_5 = 0;
        } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_indices.diminfo[0].shape)) __pyx_t_5 = 0;
        if (unlikely(__pyx_t_5 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_5);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_2 = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indices.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_indices.diminfo[0].strides)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indices.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_indices.diminfo[0].strides))) != 1);
        if (__pyx_t_2) {

     530:             return indices

          /* "lib.pyx":530
     *     for i in range(1, n):
     *         if indices[i] - indices[i - 1] != 1:
     *             return indices             # <<<<<<<<<<<<<<
     *     return slice(indices[0], indices[n - 1] + 1)
     *
     */
          __Pyx_XDECREF(__pyx_r);
          __Pyx_INCREF(((PyObject *)__pyx_v_indices));
          __pyx_r = ((PyObject *)__pyx_v_indices);
          goto __pyx_L0;
          goto __pyx_L6;
        }
        __pyx_L6:;
      }

     531:     return slice(indices[0], indices[n - 1] + 1)

      /* "lib.pyx":531
     *         if indices[i] - indices[i - 1] != 1:
     *             return indices
     *     return slice(indices[0], indices[n - 1] + 1)             # <<<<<<<<<<<<<<
     *
     *
     */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_7 = 0;
      __pyx_t_5 = -1;
      if (__pyx_t_7 < 0) {
        __pyx_t_7 += __pyx_pybuffernd_indices.diminfo[0].shape;
        if (unlikely(__pyx_t_7 < 0)) __pyx_t_5 = 0;
      } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_indices.diminfo[0].shape)) __pyx_t_5 = 0;
      if (unlikely(__pyx_t_5 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_5);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_8 = __Pyx_PyInt_to_py_npy_int64((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indices.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_indices.diminfo[0].strides))); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = (__pyx_v_n - 1);
      __pyx_t_5 = -1;
      if (__pyx_t_1 < 0) {
        __pyx_t_1 += __pyx_pybuffernd_indices.diminfo[0].shape;
        if (unlikely(__pyx_t_1 < 0)) __pyx_t_5 = 0;
      } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_indices.diminfo[0].shape)) __pyx_t_5 = 0;
      if (unlikely(__pyx_t_5 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_5);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_9 = __Pyx_PyInt_to_py_npy_int64(((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indices.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_indices.diminfo[0].strides)) + 1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_9);
      __pyx_t_8 = 0;
      __pyx_t_9 = 0;
      __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
      __pyx_r = __pyx_t_9;
      __pyx_t_9 = 0;
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_10);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indices.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.maybe_indices_to_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indices.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_53maybe_booleans_to_slice(PyObject *__pyx_self, PyObject *__pyx_v_mask); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_53maybe_booleans_to_slice = {__Pyx_NAMESTR("maybe_booleans_to_slice"), (PyCFunction)__pyx_pw_3lib_53maybe_booleans_to_slice, METH_O, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_53maybe_booleans_to_slice(PyObject *__pyx_self, PyObject *__pyx_v_mask) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("maybe_booleans_to_slice (wrapper)", 0);
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_52maybe_booleans_to_slice(__pyx_self, ((PyArrayObject *)__pyx_v_mask));
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     532:

     533:

     534: def maybe_booleans_to_slice(ndarray[uint8_t] mask):

    /* "lib.pyx":534
     *
     *
     * def maybe_booleans_to_slice(ndarray[uint8_t] mask):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(mask)
     */

    static PyObject *__pyx_pf_3lib_52maybe_booleans_to_slice(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_mask) {
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_n;
      Py_ssize_t __pyx_v_start;
      Py_ssize_t __pyx_v_end;
      int __pyx_v_started;
      int __pyx_v_finished;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_mask;
      __Pyx_Buffer __pyx_pybuffer_mask;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("maybe_booleans_to_slice", 0);
      __pyx_pybuffer_mask.pybuffer.buf = NULL;
      __pyx_pybuffer_mask.refcount = 0;
      __pyx_pybuffernd_mask.data = NULL;
      __pyx_pybuffernd_mask.rcbuffer = &__pyx_pybuffer_mask;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_mask.diminfo[0].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask.diminfo[0].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[0];

      /* "lib.pyx":534
     *
     *
     * def maybe_booleans_to_slice(ndarray[uint8_t] mask):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(mask)
     */
      __pyx_k_tuple_144 = PyTuple_New(7); if (unlikely(!__pyx_k_tuple_144)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_144);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
      PyTuple_SET_ITEM(__pyx_k_tuple_144, 0, ((PyObject *)__pyx_n_s__mask));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_144, 1, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_144, 2, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__start));
      PyTuple_SET_ITEM(__pyx_k_tuple_144, 3, ((PyObject *)__pyx_n_s__start));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__start));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__end));
      PyTuple_SET_ITEM(__pyx_k_tuple_144, 4, ((PyObject *)__pyx_n_s__end));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__end));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__started));
      PyTuple_SET_ITEM(__pyx_k_tuple_144, 5, ((PyObject *)__pyx_n_s__started));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__started));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__finished));
      PyTuple_SET_ITEM(__pyx_k_tuple_144, 6, ((PyObject *)__pyx_n_s__finished));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__finished));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_144));

      /* "lib.pyx":534
     *
     *
     * def maybe_booleans_to_slice(ndarray[uint8_t] mask):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(mask)
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_53maybe_booleans_to_slice, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s_146, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_145 = (PyObject*)__Pyx_PyCode_New(1, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_144, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s_146, 534, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_145)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     535:     cdef:

     536:         Py_ssize_t i, n = len(mask)

      /* "lib.pyx":536
     * def maybe_booleans_to_slice(ndarray[uint8_t] mask):
     *     cdef:
     *         Py_ssize_t i, n = len(mask)             # <<<<<<<<<<<<<<
     *         Py_ssize_t start, end
     *         bint started = 0, finished = 0
     */
      __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_mask)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_n = __pyx_t_1;

     537:         Py_ssize_t start, end

     538:         bint started = 0, finished = 0

      /* "lib.pyx":538
     *         Py_ssize_t i, n = len(mask)
     *         Py_ssize_t start, end
     *         bint started = 0, finished = 0             # <<<<<<<<<<<<<<
     *
     *     for i in range(n):
     */
      __pyx_v_started = 0;
      __pyx_v_finished = 0;

     539:

     540:     for i in range(n):

      /* "lib.pyx":540
     *         bint started = 0, finished = 0
     *
     *     for i in range(n):             # <<<<<<<<<<<<<<
     *         if mask[i]:
     *             if finished:
     */
      __pyx_t_1 = __pyx_v_n;
      for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
        __pyx_v_i = __pyx_t_2;

     541:         if mask[i]:

        /* "lib.pyx":541
     *
     *     for i in range(n):
     *         if mask[i]:             # <<<<<<<<<<<<<<
     *             if finished:
     *                 return mask.view(np.bool_)
     */
        __pyx_t_3 = __pyx_v_i;
        __pyx_t_4 = -1;
        if (__pyx_t_3 < 0) {
          __pyx_t_3 += __pyx_pybuffernd_mask.diminfo[0].shape;
          if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 0;
        } else if (unlikely(__pyx_t_3 >= __pyx_pybuffernd_mask.diminfo[0].shape)) __pyx_t_4 = 0;
        if (unlikely(__pyx_t_4 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_4);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_5 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_mask.diminfo[0].strides));
        if (__pyx_t_5) {

     542:             if finished:

          /* "lib.pyx":542
     *     for i in range(n):
     *         if mask[i]:
     *             if finished:             # <<<<<<<<<<<<<<
     *                 return mask.view(np.bool_)
     *             if not started:
     */
          if (__pyx_v_finished) {

     543:                 return mask.view(np.bool_)

            /* "lib.pyx":543
     *         if mask[i]:
     *             if finished:
     *                 return mask.view(np.bool_)             # <<<<<<<<<<<<<<
     *             if not started:
     *                 started = 1
     */
            __Pyx_XDECREF(__pyx_r);
            __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_mask), __pyx_n_s__view); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_6);
            __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_7);
            __pyx_t_8 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__bool_); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_7);
            PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8);
            __Pyx_GIVEREF(__pyx_t_8);
            __pyx_t_8 = 0;
            __pyx_t_8 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
            __pyx_r = __pyx_t_8;
            __pyx_t_8 = 0;
            goto __pyx_L0;
            goto __pyx_L6;
          }
          __pyx_L6:;

     544:             if not started:

          /* "lib.pyx":544
     *             if finished:
     *                 return mask.view(np.bool_)
     *             if not started:             # <<<<<<<<<<<<<<
     *                 started = 1
     *                 start = i
     */
          __pyx_t_9 = (!__pyx_v_started);
          if (__pyx_t_9) {

     545:                 started = 1

            /* "lib.pyx":545
     *                 return mask.view(np.bool_)
     *             if not started:
     *                 started = 1             # <<<<<<<<<<<<<<
     *                 start = i
     *         else:
     */
            __pyx_v_started = 1;

     546:                 start = i

            /* "lib.pyx":546
     *             if not started:
     *                 started = 1
     *                 start = i             # <<<<<<<<<<<<<<
     *         else:
     *             if finished:
     */
            __pyx_v_start = __pyx_v_i;
            goto __pyx_L7;
          }
          __pyx_L7:;
          goto __pyx_L5;
        }
        /*else*/ {

     547:         else:

     548:             if finished:

          /* "lib.pyx":548
     *                 start = i
     *         else:
     *             if finished:             # <<<<<<<<<<<<<<
     *                 continue
     *
     */
          if (__pyx_v_finished) {

     549:                 continue

            /* "lib.pyx":549
     *         else:
     *             if finished:
     *                 continue             # <<<<<<<<<<<<<<
     *
     *             if started:
     */
            goto __pyx_L3_continue;
            goto __pyx_L8;
          }
          __pyx_L8:;

     550:

     551:             if started:

          /* "lib.pyx":551
     *                 continue
     *
     *             if started:             # <<<<<<<<<<<<<<
     *                 end = i
     *                 finished = 1
     */
          if (__pyx_v_started) {

     552:                 end = i

            /* "lib.pyx":552
     *
     *             if started:
     *                 end = i             # <<<<<<<<<<<<<<
     *                 finished = 1
     *
     */
            __pyx_v_end = __pyx_v_i;

     553:                 finished = 1

            /* "lib.pyx":553
     *             if started:
     *                 end = i
     *                 finished = 1             # <<<<<<<<<<<<<<
     *
     *     if not started:
     */
            __pyx_v_finished = 1;
            goto __pyx_L9;
          }
          __pyx_L9:;
        }
        __pyx_L5:;
        __pyx_L3_continue:;
      }

     554:

     555:     if not started:

      /* "lib.pyx":555
     *                 finished = 1
     *
     *     if not started:             # <<<<<<<<<<<<<<
     *         return slice(0, 0)
     *     if not finished:
     */
      __pyx_t_9 = (!__pyx_v_started);
      if (__pyx_t_9) {

     556:         return slice(0, 0)

        /* "lib.pyx":556
     *
     *     if not started:
     *         return slice(0, 0)             # <<<<<<<<<<<<<<
     *     if not finished:
     *         return slice(start, None)
     */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_r = __pyx_t_8;
        __pyx_t_8 = 0;
        goto __pyx_L0;
        goto __pyx_L10;
      }
      __pyx_L10:;

      /* "lib.pyx":556
     *
     *     if not started:
     *         return slice(0, 0)             # <<<<<<<<<<<<<<
     *     if not finished:
     *         return slice(start, None)
     */
      __pyx_k_tuple_4 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_4);
      __Pyx_INCREF(__pyx_int_0);
      PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, __pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      __Pyx_INCREF(__pyx_int_0);
      PyTuple_SET_ITEM(__pyx_k_tuple_4, 1, __pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4));

     557:     if not finished:

      /* "lib.pyx":557
     *     if not started:
     *         return slice(0, 0)
     *     if not finished:             # <<<<<<<<<<<<<<
     *         return slice(start, None)
     *     else:
     */
      __pyx_t_9 = (!__pyx_v_finished);
      if (__pyx_t_9) {

     558:         return slice(start, None)

        /* "lib.pyx":558
     *         return slice(0, 0)
     *     if not finished:
     *         return slice(start, None)             # <<<<<<<<<<<<<<
     *     else:
     *         return slice(start, end)
     */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_start); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_8);
        __Pyx_INCREF(Py_None);
        PyTuple_SET_ITEM(__pyx_t_7, 1, Py_None);
        __Pyx_GIVEREF(Py_None);
        __pyx_t_8 = 0;
        __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
        __pyx_r = __pyx_t_8;
        __pyx_t_8 = 0;
        goto __pyx_L0;
        goto __pyx_L11;
      }
      /*else*/ {

     559:     else:

     560:         return slice(start, end)

        /* "lib.pyx":560
     *         return slice(start, None)
     *     else:
     *         return slice(start, end)             # <<<<<<<<<<<<<<
     *
     *
     */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_start); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_end); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_7);
        __pyx_t_8 = 0;
        __pyx_t_7 = 0;
        __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
        __pyx_r = __pyx_t_7;
        __pyx_t_7 = 0;
        goto __pyx_L0;
      }
      __pyx_L11:;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_8);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.maybe_booleans_to_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_55scalar_compare(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_55scalar_compare = {__Pyx_NAMESTR("scalar_compare"), (PyCFunction)__pyx_pw_3lib_55scalar_compare, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_55scalar_compare(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyArrayObject *__pyx_v_values = 0;
      PyObject *__pyx_v_val = 0;
      PyObject *__pyx_v_op = 0;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("scalar_compare (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__val,&__pyx_n_s__op,0};
        PyObject* values[3] = {0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            case  1:
            if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__val)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("scalar_compare", 1, 3, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
            case  2:
            if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__op)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("scalar_compare", 1, 3, 3, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scalar_compare") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
          values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        }
        __pyx_v_values = ((PyArrayObject *)values[0]);
        __pyx_v_val = values[1];
        __pyx_v_op = values[2];
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("scalar_compare", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_L3_error:;
      __Pyx_AddTraceback("lib.scalar_compare", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_54scalar_compare(__pyx_self, __pyx_v_values, __pyx_v_val, __pyx_v_op);
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     561:

     562:

     563: @cython.wraparound(False)

     564: @cython.boundscheck(False)

     565: def scalar_compare(ndarray[object] values, object val, object op):

    /* "lib.pyx":565
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def scalar_compare(ndarray[object] values, object val, object op):             # <<<<<<<<<<<<<<
     *     import operator
     *     cdef:
     */

    static PyObject *__pyx_pf_3lib_54scalar_compare(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyObject *__pyx_v_val, PyObject *__pyx_v_op) {
      PyObject *__pyx_v_operator = NULL;
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_n;
      PyArrayObject *__pyx_v_result = 0;
      int __pyx_v_flag;
      PyObject *__pyx_v_x = 0;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
      __Pyx_Buffer __pyx_pybuffer_result;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
      __Pyx_Buffer __pyx_pybuffer_values;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("scalar_compare", 0);
      __pyx_pybuffer_result.pybuffer.buf = NULL;
      __pyx_pybuffer_result.refcount = 0;
      __pyx_pybuffernd_result.data = NULL;
      __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
      __pyx_pybuffer_values.pybuffer.buf = NULL;
      __pyx_pybuffer_values.refcount = 0;
      __pyx_pybuffernd_values.data = NULL;
      __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0];

      /* "lib.pyx":565
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def scalar_compare(ndarray[object] values, object val, object op):             # <<<<<<<<<<<<<<
     *     import operator
     *     cdef:
     */
      __pyx_k_tuple_147 = PyTuple_New(9); if (unlikely(!__pyx_k_tuple_147)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_147);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
      PyTuple_SET_ITEM(__pyx_k_tuple_147, 0, ((PyObject *)__pyx_n_s__values));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
      PyTuple_SET_ITEM(__pyx_k_tuple_147, 1, ((PyObject *)__pyx_n_s__val));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__op));
      PyTuple_SET_ITEM(__pyx_k_tuple_147, 2, ((PyObject *)__pyx_n_s__op));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__op));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__operator));
      PyTuple_SET_ITEM(__pyx_k_tuple_147, 3, ((PyObject *)__pyx_n_s__operator));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__operator));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_147, 4, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_147, 5, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
      PyTuple_SET_ITEM(__pyx_k_tuple_147, 6, ((PyObject *)__pyx_n_s__result));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__flag));
      PyTuple_SET_ITEM(__pyx_k_tuple_147, 7, ((PyObject *)__pyx_n_s__flag));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__flag));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__x));
      PyTuple_SET_ITEM(__pyx_k_tuple_147, 8, ((PyObject *)__pyx_n_s__x));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_147));

      /* "lib.pyx":565
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def scalar_compare(ndarray[object] values, object val, object op):             # <<<<<<<<<<<<<<
     *     import operator
     *     cdef:
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_55scalar_compare, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__scalar_compare, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_148 = (PyObject*)__Pyx_PyCode_New(3, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_147, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__scalar_compare, 565, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_148)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     566:     import operator

      /* "lib.pyx":566
     * @cython.boundscheck(False)
     * def scalar_compare(ndarray[object] values, object val, object op):
     *     import operator             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(values)
     */
      __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__operator), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_operator = __pyx_t_1;
      __pyx_t_1 = 0;

     567:     cdef:

     568:         Py_ssize_t i, n = len(values)

      /* "lib.pyx":568
     *     import operator
     *     cdef:
     *         Py_ssize_t i, n = len(values)             # <<<<<<<<<<<<<<
     *         ndarray[uint8_t, cast=True] result
     *         int flag
     */
      __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_n = __pyx_t_2;

     569:         ndarray[uint8_t, cast=True] result

     570:         int flag

     571:         object x

     572:

     573:     if op is operator.lt:

      /* "lib.pyx":573
     *         object x
     *
     *     if op is operator.lt:             # <<<<<<<<<<<<<<
     *         flag = cpython.Py_LT
     *     elif op is operator.le:
     */
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_operator, __pyx_n_s__lt); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = (__pyx_v_op == __pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_3) {

     574:         flag = cpython.Py_LT

        /* "lib.pyx":574
     *
     *     if op is operator.lt:
     *         flag = cpython.Py_LT             # <<<<<<<<<<<<<<
     *     elif op is operator.le:
     *         flag = cpython.Py_LE
     */
        __pyx_v_flag = Py_LT;
        goto __pyx_L3;
      }

     575:     elif op is operator.le:

      /* "lib.pyx":575
     *     if op is operator.lt:
     *         flag = cpython.Py_LT
     *     elif op is operator.le:             # <<<<<<<<<<<<<<
     *         flag = cpython.Py_LE
     *     elif op is operator.gt:
     */
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_operator, __pyx_n_s__le); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = (__pyx_v_op == __pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_3) {

     576:         flag = cpython.Py_LE

        /* "lib.pyx":576
     *         flag = cpython.Py_LT
     *     elif op is operator.le:
     *         flag = cpython.Py_LE             # <<<<<<<<<<<<<<
     *     elif op is operator.gt:
     *         flag = cpython.Py_GT
     */
        __pyx_v_flag = Py_LE;
        goto __pyx_L3;
      }

     577:     elif op is operator.gt:

      /* "lib.pyx":577
     *     elif op is operator.le:
     *         flag = cpython.Py_LE
     *     elif op is operator.gt:             # <<<<<<<<<<<<<<
     *         flag = cpython.Py_GT
     *     elif op is operator.ge:
     */
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_operator, __pyx_n_s__gt); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = (__pyx_v_op == __pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_3) {

     578:         flag = cpython.Py_GT

        /* "lib.pyx":578
     *         flag = cpython.Py_LE
     *     elif op is operator.gt:
     *         flag = cpython.Py_GT             # <<<<<<<<<<<<<<
     *     elif op is operator.ge:
     *         flag = cpython.Py_GE
     */
        __pyx_v_flag = Py_GT;
        goto __pyx_L3;
      }

     579:     elif op is operator.ge:

      /* "lib.pyx":579
     *     elif op is operator.gt:
     *         flag = cpython.Py_GT
     *     elif op is operator.ge:             # <<<<<<<<<<<<<<
     *         flag = cpython.Py_GE
     *     elif op is operator.eq:
     */
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_operator, __pyx_n_s__ge); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = (__pyx_v_op == __pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_3) {

     580:         flag = cpython.Py_GE

        /* "lib.pyx":580
     *         flag = cpython.Py_GT
     *     elif op is operator.ge:
     *         flag = cpython.Py_GE             # <<<<<<<<<<<<<<
     *     elif op is operator.eq:
     *         flag = cpython.Py_EQ
     */
        __pyx_v_flag = Py_GE;
        goto __pyx_L3;
      }

     581:     elif op is operator.eq:

      /* "lib.pyx":581
     *     elif op is operator.ge:
     *         flag = cpython.Py_GE
     *     elif op is operator.eq:             # <<<<<<<<<<<<<<
     *         flag = cpython.Py_EQ
     *     elif op is operator.ne:
     */
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_operator, __pyx_n_s__eq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = (__pyx_v_op == __pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_3) {

     582:         flag = cpython.Py_EQ

        /* "lib.pyx":582
     *         flag = cpython.Py_GE
     *     elif op is operator.eq:
     *         flag = cpython.Py_EQ             # <<<<<<<<<<<<<<
     *     elif op is operator.ne:
     *         flag = cpython.Py_NE
     */
        __pyx_v_flag = Py_EQ;
        goto __pyx_L3;
      }

     583:     elif op is operator.ne:

      /* "lib.pyx":583
     *     elif op is operator.eq:
     *         flag = cpython.Py_EQ
     *     elif op is operator.ne:             # <<<<<<<<<<<<<<
     *         flag = cpython.Py_NE
     *     else:
     */
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_operator, __pyx_n_s__ne); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = (__pyx_v_op == __pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_3) {

     584:         flag = cpython.Py_NE

        /* "lib.pyx":584
     *         flag = cpython.Py_EQ
     *     elif op is operator.ne:
     *         flag = cpython.Py_NE             # <<<<<<<<<<<<<<
     *     else:
     *         raise ValueError('Unrecognized operator')
     */
        __pyx_v_flag = Py_NE;
        goto __pyx_L3;
      }
      /*else*/ {

     585:     else:

     586:         raise ValueError('Unrecognized operator')

        /* "lib.pyx":586
     *         flag = cpython.Py_NE
     *     else:
     *         raise ValueError('Unrecognized operator')             # <<<<<<<<<<<<<<
     *
     *     result = np.empty(n, dtype=bool).view(np.uint8)
     */
        __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_Raise(__pyx_t_1, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L3:;

      /* "lib.pyx":586
     *         flag = cpython.Py_NE
     *     else:
     *         raise ValueError('Unrecognized operator')             # <<<<<<<<<<<<<<
     *
     *     result = np.empty(n, dtype=bool).view(np.uint8)
     */
      __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_6);
      __Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
      PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_s_5));
      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6));

     587:

     588:     result = np.empty(n, dtype=bool).view(np.uint8)

      /* "lib.pyx":588
     *         raise ValueError('Unrecognized operator')
     *
     *     result = np.empty(n, dtype=bool).view(np.uint8)             # <<<<<<<<<<<<<<
     *
     *     if flag == cpython.Py_NE:
     */
      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject*)&PyBool_Type)) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__view); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__uint8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_7 = ((PyArrayObject *)__pyx_t_5);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
        __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 1, __pyx_stack);
        if (unlikely(__pyx_t_8 < 0)) {
          PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 1, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
          }
        }
        __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_7 = 0;
      __pyx_v_result = ((PyArrayObject *)__pyx_t_5);
      __pyx_t_5 = 0;

     589:

     590:     if flag == cpython.Py_NE:

      /* "lib.pyx":590
     *     result = np.empty(n, dtype=bool).view(np.uint8)
     *
     *     if flag == cpython.Py_NE:             # <<<<<<<<<<<<<<
     *         for i in range(n):
     *             x = values[i]
     */
      __pyx_t_3 = (__pyx_v_flag == Py_NE);
      if (__pyx_t_3) {

     591:         for i in range(n):

        /* "lib.pyx":591
     *
     *     if flag == cpython.Py_NE:
     *         for i in range(n):             # <<<<<<<<<<<<<<
     *             x = values[i]
     *             if _checknull(x):
     */
        __pyx_t_2 = __pyx_v_n;
        for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_2; __pyx_t_12+=1) {
          __pyx_v_i = __pyx_t_12;

     592:             x = values[i]

          /* "lib.pyx":592
     *     if flag == cpython.Py_NE:
     *         for i in range(n):
     *             x = values[i]             # <<<<<<<<<<<<<<
     *             if _checknull(x):
     *                 result[i] = True
     */
          __pyx_t_13 = __pyx_v_i;
          __pyx_t_5 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_values.diminfo[0].strides);
          __Pyx_INCREF((PyObject*)__pyx_t_5);
          __Pyx_XDECREF(__pyx_v_x);
          __pyx_v_x = __pyx_t_5;
          __pyx_t_5 = 0;

     593:             if _checknull(x):

          /* "lib.pyx":593
     *         for i in range(n):
     *             x = values[i]
     *             if _checknull(x):             # <<<<<<<<<<<<<<
     *                 result[i] = True
     *             else:
     */
          __pyx_t_3 = __pyx_f_4util__checknull(__pyx_v_x);
          if (__pyx_t_3) {

     594:                 result[i] = True

            /* "lib.pyx":594
     *             x = values[i]
     *             if _checknull(x):
     *                 result[i] = True             # <<<<<<<<<<<<<<
     *             else:
     *                 result[i] = cpython.PyObject_RichCompareBool(x, val, flag)
     */
            __pyx_t_14 = __pyx_v_i;
            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_result.diminfo[0].strides) = 1;
            goto __pyx_L7;
          }
          /*else*/ {

     595:             else:

     596:                 result[i] = cpython.PyObject_RichCompareBool(x, val, flag)

            /* "lib.pyx":596
     *                 result[i] = True
     *             else:
     *                 result[i] = cpython.PyObject_RichCompareBool(x, val, flag)             # <<<<<<<<<<<<<<
     *     else:
     *         for i in range(n):
     */
            __pyx_t_3 = PyObject_RichCompareBool(__pyx_v_x, __pyx_v_val, __pyx_v_flag); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __pyx_t_15 = __pyx_v_i;
            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_result.diminfo[0].strides) = __pyx_t_3;
          }
          __pyx_L7:;
        }
        goto __pyx_L4;
      }
      /*else*/ {

     597:     else:

     598:         for i in range(n):

        /* "lib.pyx":598
     *                 result[i] = cpython.PyObject_RichCompareBool(x, val, flag)
     *     else:
     *         for i in range(n):             # <<<<<<<<<<<<<<
     *             x = values[i]
     *             if _checknull(x):
     */
        __pyx_t_2 = __pyx_v_n;
        for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_2; __pyx_t_12+=1) {
          __pyx_v_i = __pyx_t_12;

     599:             x = values[i]

          /* "lib.pyx":599
     *     else:
     *         for i in range(n):
     *             x = values[i]             # <<<<<<<<<<<<<<
     *             if _checknull(x):
     *                 result[i] = False
     */
          __pyx_t_16 = __pyx_v_i;
          __pyx_t_5 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_values.diminfo[0].strides);
          __Pyx_INCREF((PyObject*)__pyx_t_5);
          __Pyx_XDECREF(__pyx_v_x);
          __pyx_v_x = __pyx_t_5;
          __pyx_t_5 = 0;

     600:             if _checknull(x):

          /* "lib.pyx":600
     *         for i in range(n):
     *             x = values[i]
     *             if _checknull(x):             # <<<<<<<<<<<<<<
     *                 result[i] = False
     *             else:
     */
          __pyx_t_3 = __pyx_f_4util__checknull(__pyx_v_x);
          if (__pyx_t_3) {

     601:                 result[i] = False

            /* "lib.pyx":601
     *             x = values[i]
     *             if _checknull(x):
     *                 result[i] = False             # <<<<<<<<<<<<<<
     *             else:
     *                 result[i] = cpython.PyObject_RichCompareBool(x, val, flag)
     */
            __pyx_t_17 = __pyx_v_i;
            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_result.diminfo[0].strides) = 0;
            goto __pyx_L10;
          }
          /*else*/ {

     602:             else:

     603:                 result[i] = cpython.PyObject_RichCompareBool(x, val, flag)

            /* "lib.pyx":603
     *                 result[i] = False
     *             else:
     *                 result[i] = cpython.PyObject_RichCompareBool(x, val, flag)             # <<<<<<<<<<<<<<
     *
     *     return result.view(bool)
     */
            __pyx_t_3 = PyObject_RichCompareBool(__pyx_v_x, __pyx_v_val, __pyx_v_flag); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __pyx_t_18 = __pyx_v_i;
            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_result.diminfo[0].strides) = __pyx_t_3;
          }
          __pyx_L10:;
        }
      }
      __pyx_L4:;

     604:

     605:     return result.view(bool)

      /* "lib.pyx":605
     *                 result[i] = cpython.PyObject_RichCompareBool(x, val, flag)
     *
     *     return result.view(bool)             # <<<<<<<<<<<<<<
     *
     * @cython.wraparound(False)
     */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__view); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(((PyObject*)&PyBool_Type));
      PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject*)&PyBool_Type));
      __Pyx_GIVEREF(((PyObject*)&PyBool_Type));
      __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.scalar_compare", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF(__pyx_v_operator);
      __Pyx_XDECREF((PyObject *)__pyx_v_result);
      __Pyx_XDECREF(__pyx_v_x);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_57vec_compare(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_57vec_compare = {__Pyx_NAMESTR("vec_compare"), (PyCFunction)__pyx_pw_3lib_57vec_compare, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_57vec_compare(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyArrayObject *__pyx_v_left = 0;
      PyArrayObject *__pyx_v_right = 0;
      PyObject *__pyx_v_op = 0;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("vec_compare (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__left,&__pyx_n_s__right,&__pyx_n_s__op,0};
        PyObject* values[3] = {0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            case  1:
            if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("vec_compare", 1, 3, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
            case  2:
            if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__op)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("vec_compare", 1, 3, 3, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vec_compare") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
          values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        }
        __pyx_v_left = ((PyArrayObject *)values[0]);
        __pyx_v_right = ((PyArrayObject *)values[1]);
        __pyx_v_op = values[2];
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("vec_compare", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_L3_error:;
      __Pyx_AddTraceback("lib.vec_compare", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left), __pyx_ptype_5numpy_ndarray, 1, "left", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right), __pyx_ptype_5numpy_ndarray, 1, "right", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_56vec_compare(__pyx_self, __pyx_v_left, __pyx_v_right, __pyx_v_op);
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     606:

     607: @cython.wraparound(False)

     608: @cython.boundscheck(False)

     609: def vec_compare(ndarray[object] left, ndarray[object] right, object op):

    /* "lib.pyx":609
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def vec_compare(ndarray[object] left, ndarray[object] right, object op):             # <<<<<<<<<<<<<<
     *     import operator
     *     cdef:
     */

    static PyObject *__pyx_pf_3lib_56vec_compare(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right, PyObject *__pyx_v_op) {
      PyObject *__pyx_v_operator = NULL;
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_n;
      PyArrayObject *__pyx_v_result = 0;
      int __pyx_v_flag;
      PyObject *__pyx_v_x = NULL;
      PyObject *__pyx_v_y = NULL;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_left;
      __Pyx_Buffer __pyx_pybuffer_left;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
      __Pyx_Buffer __pyx_pybuffer_result;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_right;
      __Pyx_Buffer __pyx_pybuffer_right;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("vec_compare", 0);
      __pyx_pybuffer_result.pybuffer.buf = NULL;
      __pyx_pybuffer_result.refcount = 0;
      __pyx_pybuffernd_result.data = NULL;
      __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
      __pyx_pybuffer_left.pybuffer.buf = NULL;
      __pyx_pybuffer_left.refcount = 0;
      __pyx_pybuffernd_left.data = NULL;
      __pyx_pybuffernd_left.rcbuffer = &__pyx_pybuffer_left;
      __pyx_pybuffer_right.pybuffer.buf = NULL;
      __pyx_pybuffer_right.refcount = 0;
      __pyx_pybuffernd_right.data = NULL;
      __pyx_pybuffernd_right.rcbuffer = &__pyx_pybuffer_right;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left.rcbuffer->pybuffer, (PyObject*)__pyx_v_left, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_left.diminfo[0].strides = __pyx_pybuffernd_left.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left.diminfo[0].shape = __pyx_pybuffernd_left.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right.rcbuffer->pybuffer, (PyObject*)__pyx_v_right, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_right.diminfo[0].strides = __pyx_pybuffernd_right.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right.diminfo[0].shape = __pyx_pybuffernd_right.rcbuffer->pybuffer.shape[0];

      /* "lib.pyx":609
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def vec_compare(ndarray[object] left, ndarray[object] right, object op):             # <<<<<<<<<<<<<<
     *     import operator
     *     cdef:
     */
      __pyx_k_tuple_149 = PyTuple_New(10); if (unlikely(!__pyx_k_tuple_149)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_149);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__left));
      PyTuple_SET_ITEM(__pyx_k_tuple_149, 0, ((PyObject *)__pyx_n_s__left));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__right));
      PyTuple_SET_ITEM(__pyx_k_tuple_149, 1, ((PyObject *)__pyx_n_s__right));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__op));
      PyTuple_SET_ITEM(__pyx_k_tuple_149, 2, ((PyObject *)__pyx_n_s__op));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__op));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__operator));
      PyTuple_SET_ITEM(__pyx_k_tuple_149, 3, ((PyObject *)__pyx_n_s__operator));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__operator));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_149, 4, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_149, 5, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
      PyTuple_SET_ITEM(__pyx_k_tuple_149, 6, ((PyObject *)__pyx_n_s__result));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__flag));
      PyTuple_SET_ITEM(__pyx_k_tuple_149, 7, ((PyObject *)__pyx_n_s__flag));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__flag));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__x));
      PyTuple_SET_ITEM(__pyx_k_tuple_149, 8, ((PyObject *)__pyx_n_s__x));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__y));
      PyTuple_SET_ITEM(__pyx_k_tuple_149, 9, ((PyObject *)__pyx_n_s__y));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_149));

      /* "lib.pyx":609
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def vec_compare(ndarray[object] left, ndarray[object] right, object op):             # <<<<<<<<<<<<<<
     *     import operator
     *     cdef:
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_57vec_compare, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__vec_compare, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_150 = (PyObject*)__Pyx_PyCode_New(3, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_149, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__vec_compare, 609, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_150)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     610:     import operator

      /* "lib.pyx":610
     * @cython.boundscheck(False)
     * def vec_compare(ndarray[object] left, ndarray[object] right, object op):
     *     import operator             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(left)
     */
      __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__operator), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_operator = __pyx_t_1;
      __pyx_t_1 = 0;

     611:     cdef:

     612:         Py_ssize_t i, n = len(left)

      /* "lib.pyx":612
     *     import operator
     *     cdef:
     *         Py_ssize_t i, n = len(left)             # <<<<<<<<<<<<<<
     *         ndarray[uint8_t, cast=True] result
     *         int flag
     */
      __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_left)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_n = __pyx_t_2;

     613:         ndarray[uint8_t, cast=True] result

     614:         int flag

     615:

     616:     if n != len(right):

      /* "lib.pyx":616
     *         int flag
     *
     *     if n != len(right):             # <<<<<<<<<<<<<<
     *         raise ValueError('Arrays were different lengths: %d vs %d'
     *                          % (n, len(right)))
     */
      __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_right)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_3 = (__pyx_v_n != __pyx_t_2);
      if (__pyx_t_3) {

     617:         raise ValueError('Arrays were different lengths: %d vs %d'

     618:                          % (n, len(right)))

        /* "lib.pyx":618
     *     if n != len(right):
     *         raise ValueError('Arrays were different lengths: %d vs %d'
     *                          % (n, len(right)))             # <<<<<<<<<<<<<<
     *
     *     if op is operator.lt:
     */
        __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_right)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_4);
        __pyx_t_1 = 0;
        __pyx_t_4 = 0;
        __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_7), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_4));
        __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
        __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
        __pyx_t_4 = 0;
        __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
        __Pyx_Raise(__pyx_t_4, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L3;
      }
      __pyx_L3:;

     619:

     620:     if op is operator.lt:

      /* "lib.pyx":620
     *                          % (n, len(right)))
     *
     *     if op is operator.lt:             # <<<<<<<<<<<<<<
     *         flag = cpython.Py_LT
     *     elif op is operator.le:
     */
      __pyx_t_4 = PyObject_GetAttr(__pyx_v_operator, __pyx_n_s__lt); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = (__pyx_v_op == __pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_3) {

     621:         flag = cpython.Py_LT

        /* "lib.pyx":621
     *
     *     if op is operator.lt:
     *         flag = cpython.Py_LT             # <<<<<<<<<<<<<<
     *     elif op is operator.le:
     *         flag = cpython.Py_LE
     */
        __pyx_v_flag = Py_LT;
        goto __pyx_L4;
      }

     622:     elif op is operator.le:

      /* "lib.pyx":622
     *     if op is operator.lt:
     *         flag = cpython.Py_LT
     *     elif op is operator.le:             # <<<<<<<<<<<<<<
     *         flag = cpython.Py_LE
     *     elif op is operator.gt:
     */
      __pyx_t_4 = PyObject_GetAttr(__pyx_v_operator, __pyx_n_s__le); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = (__pyx_v_op == __pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_3) {

     623:         flag = cpython.Py_LE

        /* "lib.pyx":623
     *         flag = cpython.Py_LT
     *     elif op is operator.le:
     *         flag = cpython.Py_LE             # <<<<<<<<<<<<<<
     *     elif op is operator.gt:
     *         flag = cpython.Py_GT
     */
        __pyx_v_flag = Py_LE;
        goto __pyx_L4;
      }

     624:     elif op is operator.gt:

      /* "lib.pyx":624
     *     elif op is operator.le:
     *         flag = cpython.Py_LE
     *     elif op is operator.gt:             # <<<<<<<<<<<<<<
     *         flag = cpython.Py_GT
     *     elif op is operator.ge:
     */
      __pyx_t_4 = PyObject_GetAttr(__pyx_v_operator, __pyx_n_s__gt); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = (__pyx_v_op == __pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_3) {

     625:         flag = cpython.Py_GT

        /* "lib.pyx":625
     *         flag = cpython.Py_LE
     *     elif op is operator.gt:
     *         flag = cpython.Py_GT             # <<<<<<<<<<<<<<
     *     elif op is operator.ge:
     *         flag = cpython.Py_GE
     */
        __pyx_v_flag = Py_GT;
        goto __pyx_L4;
      }

     626:     elif op is operator.ge:

      /* "lib.pyx":626
     *     elif op is operator.gt:
     *         flag = cpython.Py_GT
     *     elif op is operator.ge:             # <<<<<<<<<<<<<<
     *         flag = cpython.Py_GE
     *     elif op is operator.eq:
     */
      __pyx_t_4 = PyObject_GetAttr(__pyx_v_operator, __pyx_n_s__ge); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = (__pyx_v_op == __pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_3) {

     627:         flag = cpython.Py_GE

        /* "lib.pyx":627
     *         flag = cpython.Py_GT
     *     elif op is operator.ge:
     *         flag = cpython.Py_GE             # <<<<<<<<<<<<<<
     *     elif op is operator.eq:
     *         flag = cpython.Py_EQ
     */
        __pyx_v_flag = Py_GE;
        goto __pyx_L4;
      }

     628:     elif op is operator.eq:

      /* "lib.pyx":628
     *     elif op is operator.ge:
     *         flag = cpython.Py_GE
     *     elif op is operator.eq:             # <<<<<<<<<<<<<<
     *         flag = cpython.Py_EQ
     *     elif op is operator.ne:
     */
      __pyx_t_4 = PyObject_GetAttr(__pyx_v_operator, __pyx_n_s__eq); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = (__pyx_v_op == __pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_3) {

     629:         flag = cpython.Py_EQ

        /* "lib.pyx":629
     *         flag = cpython.Py_GE
     *     elif op is operator.eq:
     *         flag = cpython.Py_EQ             # <<<<<<<<<<<<<<
     *     elif op is operator.ne:
     *         flag = cpython.Py_NE
     */
        __pyx_v_flag = Py_EQ;
        goto __pyx_L4;
      }

     630:     elif op is operator.ne:

      /* "lib.pyx":630
     *     elif op is operator.eq:
     *         flag = cpython.Py_EQ
     *     elif op is operator.ne:             # <<<<<<<<<<<<<<
     *         flag = cpython.Py_NE
     *     else:
     */
      __pyx_t_4 = PyObject_GetAttr(__pyx_v_operator, __pyx_n_s__ne); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = (__pyx_v_op == __pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_3) {

     631:         flag = cpython.Py_NE

        /* "lib.pyx":631
     *         flag = cpython.Py_EQ
     *     elif op is operator.ne:
     *         flag = cpython.Py_NE             # <<<<<<<<<<<<<<
     *     else:
     *         raise ValueError('Unrecognized operator')
     */
        __pyx_v_flag = Py_NE;
        goto __pyx_L4;
      }
      /*else*/ {

     632:     else:

     633:         raise ValueError('Unrecognized operator')

        /* "lib.pyx":633
     *         flag = cpython.Py_NE
     *     else:
     *         raise ValueError('Unrecognized operator')             # <<<<<<<<<<<<<<
     *
     *     result = np.empty(n, dtype=bool).view(np.uint8)
     */
        __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_Raise(__pyx_t_4, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L4:;

      /* "lib.pyx":633
     *         flag = cpython.Py_NE
     *     else:
     *         raise ValueError('Unrecognized operator')             # <<<<<<<<<<<<<<
     *
     *     result = np.empty(n, dtype=bool).view(np.uint8)
     */
      __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_8);
      __Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
      PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_kp_s_5));
      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8));

     634:

     635:     result = np.empty(n, dtype=bool).view(np.uint8)

      /* "lib.pyx":635
     *         raise ValueError('Unrecognized operator')
     *
     *     result = np.empty(n, dtype=bool).view(np.uint8)             # <<<<<<<<<<<<<<
     *
     *     if flag == cpython.Py_NE:
     */
      __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), ((PyObject*)&PyBool_Type)) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__view); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__uint8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_7 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
        __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 1, __pyx_stack);
        if (unlikely(__pyx_t_8 < 0)) {
          PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 1, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
          }
        }
        __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_7 = 0;
      __pyx_v_result = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

     636:

     637:     if flag == cpython.Py_NE:

      /* "lib.pyx":637
     *     result = np.empty(n, dtype=bool).view(np.uint8)
     *
     *     if flag == cpython.Py_NE:             # <<<<<<<<<<<<<<
     *         for i in range(n):
     *             x = left[i]
     */
      __pyx_t_3 = (__pyx_v_flag == Py_NE);
      if (__pyx_t_3) {

     638:         for i in range(n):

        /* "lib.pyx":638
     *
     *     if flag == cpython.Py_NE:
     *         for i in range(n):             # <<<<<<<<<<<<<<
     *             x = left[i]
     *             y = right[i]
     */
        __pyx_t_2 = __pyx_v_n;
        for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_2; __pyx_t_12+=1) {
          __pyx_v_i = __pyx_t_12;

     639:             x = left[i]

          /* "lib.pyx":639
     *     if flag == cpython.Py_NE:
     *         for i in range(n):
     *             x = left[i]             # <<<<<<<<<<<<<<
     *             y = right[i]
     *
     */
          __pyx_t_13 = __pyx_v_i;
          __pyx_t_1 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_left.diminfo[0].strides);
          __Pyx_INCREF((PyObject*)__pyx_t_1);
          __Pyx_XDECREF(__pyx_v_x);
          __pyx_v_x = __pyx_t_1;
          __pyx_t_1 = 0;

     640:             y = right[i]

          /* "lib.pyx":640
     *         for i in range(n):
     *             x = left[i]
     *             y = right[i]             # <<<<<<<<<<<<<<
     *
     *             if _checknull(x) or _checknull(y):
     */
          __pyx_t_14 = __pyx_v_i;
          __pyx_t_1 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_right.diminfo[0].strides);
          __Pyx_INCREF((PyObject*)__pyx_t_1);
          __Pyx_XDECREF(__pyx_v_y);
          __pyx_v_y = __pyx_t_1;
          __pyx_t_1 = 0;

     641:

     642:             if _checknull(x) or _checknull(y):

          /* "lib.pyx":642
     *             y = right[i]
     *
     *             if _checknull(x) or _checknull(y):             # <<<<<<<<<<<<<<
     *                 result[i] = True
     *             else:
     */
          __pyx_t_3 = __pyx_f_4util__checknull(__pyx_v_x);
          if (!__pyx_t_3) {
            __pyx_t_15 = __pyx_f_4util__checknull(__pyx_v_y);
            __pyx_t_16 = __pyx_t_15;
          } else {
            __pyx_t_16 = __pyx_t_3;
          }
          if (__pyx_t_16) {

     643:                 result[i] = True

            /* "lib.pyx":643
     *
     *             if _checknull(x) or _checknull(y):
     *                 result[i] = True             # <<<<<<<<<<<<<<
     *             else:
     *                 result[i] = cpython.PyObject_RichCompareBool(x, y, flag)
     */
            __pyx_t_17 = __pyx_v_i;
            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_result.diminfo[0].strides) = 1;
            goto __pyx_L8;
          }
          /*else*/ {

     644:             else:

     645:                 result[i] = cpython.PyObject_RichCompareBool(x, y, flag)

            /* "lib.pyx":645
     *                 result[i] = True
     *             else:
     *                 result[i] = cpython.PyObject_RichCompareBool(x, y, flag)             # <<<<<<<<<<<<<<
     *     else:
     *         for i in range(n):
     */
            __pyx_t_16 = PyObject_RichCompareBool(__pyx_v_x, __pyx_v_y, __pyx_v_flag); if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __pyx_t_18 = __pyx_v_i;
            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_result.diminfo[0].strides) = __pyx_t_16;
          }
          __pyx_L8:;
        }
        goto __pyx_L5;
      }
      /*else*/ {

     646:     else:

     647:         for i in range(n):

        /* "lib.pyx":647
     *                 result[i] = cpython.PyObject_RichCompareBool(x, y, flag)
     *     else:
     *         for i in range(n):             # <<<<<<<<<<<<<<
     *             x = left[i]
     *             y = right[i]
     */
        __pyx_t_2 = __pyx_v_n;
        for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_2; __pyx_t_12+=1) {
          __pyx_v_i = __pyx_t_12;

     648:             x = left[i]

          /* "lib.pyx":648
     *     else:
     *         for i in range(n):
     *             x = left[i]             # <<<<<<<<<<<<<<
     *             y = right[i]
     *
     */
          __pyx_t_19 = __pyx_v_i;
          __pyx_t_1 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_left.diminfo[0].strides);
          __Pyx_INCREF((PyObject*)__pyx_t_1);
          __Pyx_XDECREF(__pyx_v_x);
          __pyx_v_x = __pyx_t_1;
          __pyx_t_1 = 0;

     649:             y = right[i]

          /* "lib.pyx":649
     *         for i in range(n):
     *             x = left[i]
     *             y = right[i]             # <<<<<<<<<<<<<<
     *
     *             if _checknull(x) or _checknull(y):
     */
          __pyx_t_20 = __pyx_v_i;
          __pyx_t_1 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_right.diminfo[0].strides);
          __Pyx_INCREF((PyObject*)__pyx_t_1);
          __Pyx_XDECREF(__pyx_v_y);
          __pyx_v_y = __pyx_t_1;
          __pyx_t_1 = 0;

     650:

     651:             if _checknull(x) or _checknull(y):

          /* "lib.pyx":651
     *             y = right[i]
     *
     *             if _checknull(x) or _checknull(y):             # <<<<<<<<<<<<<<
     *                 result[i] = False
     *             else:
     */
          __pyx_t_16 = __pyx_f_4util__checknull(__pyx_v_x);
          if (!__pyx_t_16) {
            __pyx_t_3 = __pyx_f_4util__checknull(__pyx_v_y);
            __pyx_t_15 = __pyx_t_3;
          } else {
            __pyx_t_15 = __pyx_t_16;
          }
          if (__pyx_t_15) {

     652:                 result[i] = False

            /* "lib.pyx":652
     *
     *             if _checknull(x) or _checknull(y):
     *                 result[i] = False             # <<<<<<<<<<<<<<
     *             else:
     *                 result[i] = cpython.PyObject_RichCompareBool(x, y, flag)
     */
            __pyx_t_21 = __pyx_v_i;
            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_result.diminfo[0].strides) = 0;
            goto __pyx_L11;
          }
          /*else*/ {

     653:             else:

     654:                 result[i] = cpython.PyObject_RichCompareBool(x, y, flag)

            /* "lib.pyx":654
     *                 result[i] = False
     *             else:
     *                 result[i] = cpython.PyObject_RichCompareBool(x, y, flag)             # <<<<<<<<<<<<<<
     *
     *     return result.view(bool)
     */
            __pyx_t_15 = PyObject_RichCompareBool(__pyx_v_x, __pyx_v_y, __pyx_v_flag); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __pyx_t_22 = __pyx_v_i;
            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_result.diminfo[0].strides) = __pyx_t_15;
          }
          __pyx_L11:;
        }
      }
      __pyx_L5:;

     655:

     656:     return result.view(bool)

      /* "lib.pyx":656
     *                 result[i] = cpython.PyObject_RichCompareBool(x, y, flag)
     *
     *     return result.view(bool)             # <<<<<<<<<<<<<<
     *
     *
     */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__view); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(((PyObject*)&PyBool_Type));
      PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject*)&PyBool_Type));
      __Pyx_GIVEREF(((PyObject*)&PyBool_Type));
      __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.vec_compare", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF(__pyx_v_operator);
      __Pyx_XDECREF((PyObject *)__pyx_v_result);
      __Pyx_XDECREF(__pyx_v_x);
      __Pyx_XDECREF(__pyx_v_y);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_59scalar_binop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_59scalar_binop = {__Pyx_NAMESTR("scalar_binop"), (PyCFunction)__pyx_pw_3lib_59scalar_binop, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_59scalar_binop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyArrayObject *__pyx_v_values = 0;
      PyObject *__pyx_v_val = 0;
      PyObject *__pyx_v_op = 0;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("scalar_binop (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__val,&__pyx_n_s__op,0};
        PyObject* values[3] = {0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            case  1:
            if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__val)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("scalar_binop", 1, 3, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
            case  2:
            if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__op)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("scalar_binop", 1, 3, 3, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scalar_binop") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
          values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        }
        __pyx_v_values = ((PyArrayObject *)values[0]);
        __pyx_v_val = values[1];
        __pyx_v_op = values[2];
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("scalar_binop", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_L3_error:;
      __Pyx_AddTraceback("lib.scalar_binop", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_58scalar_binop(__pyx_self, __pyx_v_values, __pyx_v_val, __pyx_v_op);
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     657:

     658:

     659: @cython.wraparound(False)

     660: @cython.boundscheck(False)

     661: def scalar_binop(ndarray[object] values, object val, object op):

    /* "lib.pyx":661
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def scalar_binop(ndarray[object] values, object val, object op):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(values)
     */

    static PyObject *__pyx_pf_3lib_58scalar_binop(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyObject *__pyx_v_val, PyObject *__pyx_v_op) {
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_n;
      PyArrayObject *__pyx_v_result = 0;
      PyObject *__pyx_v_x = 0;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
      __Pyx_Buffer __pyx_pybuffer_result;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
      __Pyx_Buffer __pyx_pybuffer_values;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("scalar_binop", 0);
      __pyx_pybuffer_result.pybuffer.buf = NULL;
      __pyx_pybuffer_result.refcount = 0;
      __pyx_pybuffernd_result.data = NULL;
      __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
      __pyx_pybuffer_values.pybuffer.buf = NULL;
      __pyx_pybuffer_values.refcount = 0;
      __pyx_pybuffernd_values.data = NULL;
      __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0];

      /* "lib.pyx":661
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def scalar_binop(ndarray[object] values, object val, object op):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(values)
     */
      __pyx_k_tuple_151 = PyTuple_New(7); if (unlikely(!__pyx_k_tuple_151)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_151);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
      PyTuple_SET_ITEM(__pyx_k_tuple_151, 0, ((PyObject *)__pyx_n_s__values));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
      PyTuple_SET_ITEM(__pyx_k_tuple_151, 1, ((PyObject *)__pyx_n_s__val));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__op));
      PyTuple_SET_ITEM(__pyx_k_tuple_151, 2, ((PyObject *)__pyx_n_s__op));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__op));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_151, 3, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_151, 4, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
      PyTuple_SET_ITEM(__pyx_k_tuple_151, 5, ((PyObject *)__pyx_n_s__result));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__x));
      PyTuple_SET_ITEM(__pyx_k_tuple_151, 6, ((PyObject *)__pyx_n_s__x));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_151));

      /* "lib.pyx":661
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def scalar_binop(ndarray[object] values, object val, object op):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(values)
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_59scalar_binop, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__scalar_binop, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_152 = (PyObject*)__Pyx_PyCode_New(3, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_151, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__scalar_binop, 661, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_152)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     662:     cdef:

     663:         Py_ssize_t i, n = len(values)

      /* "lib.pyx":663
     * def scalar_binop(ndarray[object] values, object val, object op):
     *     cdef:
     *         Py_ssize_t i, n = len(values)             # <<<<<<<<<<<<<<
     *         ndarray[object] result
     *         object x
     */
      __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_n = __pyx_t_1;

     664:         ndarray[object] result

     665:         object x

     666:

     667:     result = np.empty(n, dtype=object)

      /* "lib.pyx":667
     *         object x
     *
     *     result = np.empty(n, dtype=object)             # <<<<<<<<<<<<<<
     *
     *     for i in range(n):
     */
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
        __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_7 < 0)) {
          PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
          }
        }
        __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_6 = 0;
      __pyx_v_result = ((PyArrayObject *)__pyx_t_5);
      __pyx_t_5 = 0;

     668:

     669:     for i in range(n):

      /* "lib.pyx":669
     *     result = np.empty(n, dtype=object)
     *
     *     for i in range(n):             # <<<<<<<<<<<<<<
     *         x = values[i]
     *         if util._checknull(x):
     */
      __pyx_t_1 = __pyx_v_n;
      for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_1; __pyx_t_11+=1) {
        __pyx_v_i = __pyx_t_11;

     670:         x = values[i]

        /* "lib.pyx":670
     *
     *     for i in range(n):
     *         x = values[i]             # <<<<<<<<<<<<<<
     *         if util._checknull(x):
     *             result[i] = x
     */
        __pyx_t_12 = __pyx_v_i;
        __pyx_t_5 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_values.diminfo[0].strides);
        __Pyx_INCREF((PyObject*)__pyx_t_5);
        __Pyx_XDECREF(__pyx_v_x);
        __pyx_v_x = __pyx_t_5;
        __pyx_t_5 = 0;

     671:         if util._checknull(x):

        /* "lib.pyx":671
     *     for i in range(n):
     *         x = values[i]
     *         if util._checknull(x):             # <<<<<<<<<<<<<<
     *             result[i] = x
     *         else:
     */
        __pyx_t_13 = __pyx_f_4util__checknull(__pyx_v_x);
        if (__pyx_t_13) {

     672:             result[i] = x

          /* "lib.pyx":672
     *         x = values[i]
     *         if util._checknull(x):
     *             result[i] = x             # <<<<<<<<<<<<<<
     *         else:
     *             result[i] = op(x, val)
     */
          __pyx_t_14 = __pyx_v_i;
          __pyx_t_15 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_result.diminfo[0].strides);
          __Pyx_GOTREF(*__pyx_t_15);
          __Pyx_INCREF(__pyx_v_x); __Pyx_DECREF(*__pyx_t_15);
          *__pyx_t_15 = __pyx_v_x;
          __Pyx_GIVEREF(*__pyx_t_15);
          goto __pyx_L5;
        }
        /*else*/ {

     673:         else:

     674:             result[i] = op(x, val)

          /* "lib.pyx":674
     *             result[i] = x
     *         else:
     *             result[i] = op(x, val)             # <<<<<<<<<<<<<<
     *
     *     return maybe_convert_bool(result)
     */
          __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_INCREF(__pyx_v_x);
          PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_x);
          __Pyx_GIVEREF(__pyx_v_x);
          __Pyx_INCREF(__pyx_v_val);
          PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_val);
          __Pyx_GIVEREF(__pyx_v_val);
          __pyx_t_2 = PyObject_Call(__pyx_v_op, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
          __pyx_t_16 = __pyx_v_i;
          __pyx_t_15 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_result.diminfo[0].strides);
          __Pyx_GOTREF(*__pyx_t_15);
          __Pyx_INCREF(__pyx_t_2); __Pyx_DECREF(*__pyx_t_15);
          *__pyx_t_15 = __pyx_t_2;
          __Pyx_GIVEREF(*__pyx_t_15);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }
        __pyx_L5:;
      }

     675:

     676:     return maybe_convert_bool(result)

      /* "lib.pyx":676
     *             result[i] = op(x, val)
     *
     *     return maybe_convert_bool(result)             # <<<<<<<<<<<<<<
     *
     * @cython.wraparound(False)
     */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__maybe_convert_bool); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(((PyObject *)__pyx_v_result));
      PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_result));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_result));
      __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.scalar_binop", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF((PyObject *)__pyx_v_result);
      __Pyx_XDECREF(__pyx_v_x);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_61vec_binop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_61vec_binop = {__Pyx_NAMESTR("vec_binop"), (PyCFunction)__pyx_pw_3lib_61vec_binop, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_61vec_binop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyArrayObject *__pyx_v_left = 0;
      PyArrayObject *__pyx_v_right = 0;
      PyObject *__pyx_v_op = 0;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("vec_binop (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__left,&__pyx_n_s__right,&__pyx_n_s__op,0};
        PyObject* values[3] = {0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            case  1:
            if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("vec_binop", 1, 3, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
            case  2:
            if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__op)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("vec_binop", 1, 3, 3, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vec_binop") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
          values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        }
        __pyx_v_left = ((PyArrayObject *)values[0]);
        __pyx_v_right = ((PyArrayObject *)values[1]);
        __pyx_v_op = values[2];
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("vec_binop", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_L3_error:;
      __Pyx_AddTraceback("lib.vec_binop", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left), __pyx_ptype_5numpy_ndarray, 1, "left", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right), __pyx_ptype_5numpy_ndarray, 1, "right", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_60vec_binop(__pyx_self, __pyx_v_left, __pyx_v_right, __pyx_v_op);
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     677:

     678: @cython.wraparound(False)

     679: @cython.boundscheck(False)

     680: def vec_binop(ndarray[object] left, ndarray[object] right, object op):

    /* "lib.pyx":680
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def vec_binop(ndarray[object] left, ndarray[object] right, object op):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(left)
     */

    static PyObject *__pyx_pf_3lib_60vec_binop(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right, PyObject *__pyx_v_op) {
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_n;
      PyArrayObject *__pyx_v_result = 0;
      PyObject *__pyx_v_x = NULL;
      PyObject *__pyx_v_y = NULL;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_left;
      __Pyx_Buffer __pyx_pybuffer_left;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
      __Pyx_Buffer __pyx_pybuffer_result;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_right;
      __Pyx_Buffer __pyx_pybuffer_right;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("vec_binop", 0);
      __pyx_pybuffer_result.pybuffer.buf = NULL;
      __pyx_pybuffer_result.refcount = 0;
      __pyx_pybuffernd_result.data = NULL;
      __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
      __pyx_pybuffer_left.pybuffer.buf = NULL;
      __pyx_pybuffer_left.refcount = 0;
      __pyx_pybuffernd_left.data = NULL;
      __pyx_pybuffernd_left.rcbuffer = &__pyx_pybuffer_left;
      __pyx_pybuffer_right.pybuffer.buf = NULL;
      __pyx_pybuffer_right.refcount = 0;
      __pyx_pybuffernd_right.data = NULL;
      __pyx_pybuffernd_right.rcbuffer = &__pyx_pybuffer_right;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left.rcbuffer->pybuffer, (PyObject*)__pyx_v_left, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_left.diminfo[0].strides = __pyx_pybuffernd_left.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left.diminfo[0].shape = __pyx_pybuffernd_left.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right.rcbuffer->pybuffer, (PyObject*)__pyx_v_right, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_right.diminfo[0].strides = __pyx_pybuffernd_right.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right.diminfo[0].shape = __pyx_pybuffernd_right.rcbuffer->pybuffer.shape[0];

      /* "lib.pyx":680
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def vec_binop(ndarray[object] left, ndarray[object] right, object op):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(left)
     */
      __pyx_k_tuple_153 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_153)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_153);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__left));
      PyTuple_SET_ITEM(__pyx_k_tuple_153, 0, ((PyObject *)__pyx_n_s__left));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__right));
      PyTuple_SET_ITEM(__pyx_k_tuple_153, 1, ((PyObject *)__pyx_n_s__right));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__op));
      PyTuple_SET_ITEM(__pyx_k_tuple_153, 2, ((PyObject *)__pyx_n_s__op));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__op));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_153, 3, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_153, 4, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
      PyTuple_SET_ITEM(__pyx_k_tuple_153, 5, ((PyObject *)__pyx_n_s__result));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__x));
      PyTuple_SET_ITEM(__pyx_k_tuple_153, 6, ((PyObject *)__pyx_n_s__x));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__y));
      PyTuple_SET_ITEM(__pyx_k_tuple_153, 7, ((PyObject *)__pyx_n_s__y));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_153));

      /* "lib.pyx":680
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def vec_binop(ndarray[object] left, ndarray[object] right, object op):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(left)
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_61vec_binop, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__vec_binop, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_154 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_153, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__vec_binop, 680, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_154)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     681:     cdef:

     682:         Py_ssize_t i, n = len(left)

      /* "lib.pyx":682
     * def vec_binop(ndarray[object] left, ndarray[object] right, object op):
     *     cdef:
     *         Py_ssize_t i, n = len(left)             # <<<<<<<<<<<<<<
     *         ndarray[object] result
     *
     */
      __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_left)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_n = __pyx_t_1;

     683:         ndarray[object] result

     684:

     685:     if n != len(right):

      /* "lib.pyx":685
     *         ndarray[object] result
     *
     *     if n != len(right):             # <<<<<<<<<<<<<<
     *         raise ValueError('Arrays were different lengths: %d vs %d'
     *                          % (n, len(right)))
     */
      __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_right)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_2 = (__pyx_v_n != __pyx_t_1);
      if (__pyx_t_2) {

     686:         raise ValueError('Arrays were different lengths: %d vs %d'

     687:                          % (n, len(right)))

        /* "lib.pyx":687
     *     if n != len(right):
     *         raise ValueError('Arrays were different lengths: %d vs %d'
     *                          % (n, len(right)))             # <<<<<<<<<<<<<<
     *
     *     result = np.empty(n, dtype=object)
     */
        __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_right)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_4);
        __pyx_t_3 = 0;
        __pyx_t_4 = 0;
        __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_7), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_4));
        __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
        __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
        __pyx_t_4 = 0;
        __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
        __Pyx_Raise(__pyx_t_4, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L3;
      }
      __pyx_L3:;

     688:

     689:     result = np.empty(n, dtype=object)

      /* "lib.pyx":689
     *                          % (n, len(right)))
     *
     *     result = np.empty(n, dtype=object)             # <<<<<<<<<<<<<<
     *
     *     for i in range(n):
     */
      __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
        __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_8 < 0)) {
          PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
          }
        }
        __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_7 = 0;
      __pyx_v_result = ((PyArrayObject *)__pyx_t_6);
      __pyx_t_6 = 0;

     690:

     691:     for i in range(n):

      /* "lib.pyx":691
     *     result = np.empty(n, dtype=object)
     *
     *     for i in range(n):             # <<<<<<<<<<<<<<
     *         x = left[i]
     *         y = right[i]
     */
      __pyx_t_1 = __pyx_v_n;
      for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_1; __pyx_t_12+=1) {
        __pyx_v_i = __pyx_t_12;

     692:         x = left[i]

        /* "lib.pyx":692
     *
     *     for i in range(n):
     *         x = left[i]             # <<<<<<<<<<<<<<
     *         y = right[i]
     *         try:
     */
        __pyx_t_13 = __pyx_v_i;
        __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_left.diminfo[0].strides);
        __Pyx_INCREF((PyObject*)__pyx_t_6);
        __Pyx_XDECREF(__pyx_v_x);
        __pyx_v_x = __pyx_t_6;
        __pyx_t_6 = 0;

     693:         y = right[i]

        /* "lib.pyx":693
     *     for i in range(n):
     *         x = left[i]
     *         y = right[i]             # <<<<<<<<<<<<<<
     *         try:
     *             result[i] = op(x, y)
     */
        __pyx_t_14 = __pyx_v_i;
        __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_right.diminfo[0].strides);
        __Pyx_INCREF((PyObject*)__pyx_t_6);
        __Pyx_XDECREF(__pyx_v_y);
        __pyx_v_y = __pyx_t_6;
        __pyx_t_6 = 0;

     694:         try:

        /* "lib.pyx":694
     *         x = left[i]
     *         y = right[i]
     *         try:             # <<<<<<<<<<<<<<
     *             result[i] = op(x, y)
     *         except TypeError:
     */
        {
          __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
          __Pyx_XGOTREF(__pyx_t_11);
          __Pyx_XGOTREF(__pyx_t_10);
          __Pyx_XGOTREF(__pyx_t_9);
          /*try:*/ {

     695:             result[i] = op(x, y)

            /* "lib.pyx":695
     *         y = right[i]
     *         try:
     *             result[i] = op(x, y)             # <<<<<<<<<<<<<<
     *         except TypeError:
     *             if util._checknull(x):
     */
            __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_INCREF(__pyx_v_x);
            PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_x);
            __Pyx_GIVEREF(__pyx_v_x);
            __Pyx_INCREF(__pyx_v_y);
            PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_y);
            __Pyx_GIVEREF(__pyx_v_y);
            __pyx_t_4 = PyObject_Call(__pyx_v_op, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
            __pyx_t_15 = __pyx_v_i;
            __pyx_t_16 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_result.diminfo[0].strides);
            __Pyx_GOTREF(*__pyx_t_16);
            __Pyx_INCREF(__pyx_t_4); __Pyx_DECREF(*__pyx_t_16);
            *__pyx_t_16 = __pyx_t_4;
            __Pyx_GIVEREF(*__pyx_t_16);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          }
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          goto __pyx_L13_try_end;
          __pyx_L6_error:;
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

     696:         except TypeError:

          /* "lib.pyx":696
     *         try:
     *             result[i] = op(x, y)
     *         except TypeError:             # <<<<<<<<<<<<<<
     *             if util._checknull(x):
     *                 result[i] = x
     */
          __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_TypeError);
          if (__pyx_t_8) {
            __Pyx_AddTraceback("lib.vec_binop", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_GOTREF(__pyx_t_3);

     697:             if util._checknull(x):

            /* "lib.pyx":697
     *             result[i] = op(x, y)
     *         except TypeError:
     *             if util._checknull(x):             # <<<<<<<<<<<<<<
     *                 result[i] = x
     *             elif util._checknull(y):
     */
            __pyx_t_2 = __pyx_f_4util__checknull(__pyx_v_x);
            if (__pyx_t_2) {

     698:                 result[i] = x

              /* "lib.pyx":698
     *         except TypeError:
     *             if util._checknull(x):
     *                 result[i] = x             # <<<<<<<<<<<<<<
     *             elif util._checknull(y):
     *                 result[i] = y
     */
              __pyx_t_17 = __pyx_v_i;
              __pyx_t_16 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_result.diminfo[0].strides);
              __Pyx_GOTREF(*__pyx_t_16);
              __Pyx_INCREF(__pyx_v_x); __Pyx_DECREF(*__pyx_t_16);
              *__pyx_t_16 = __pyx_v_x;
              __Pyx_GIVEREF(*__pyx_t_16);
              goto __pyx_L16;
            }

     699:             elif util._checknull(y):

            /* "lib.pyx":699
     *             if util._checknull(x):
     *                 result[i] = x
     *             elif util._checknull(y):             # <<<<<<<<<<<<<<
     *                 result[i] = y
     *             else:
     */
            __pyx_t_2 = __pyx_f_4util__checknull(__pyx_v_y);
            if (__pyx_t_2) {

     700:                 result[i] = y

              /* "lib.pyx":700
     *                 result[i] = x
     *             elif util._checknull(y):
     *                 result[i] = y             # <<<<<<<<<<<<<<
     *             else:
     *                 raise
     */
              __pyx_t_18 = __pyx_v_i;
              __pyx_t_16 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_result.diminfo[0].strides);
              __Pyx_GOTREF(*__pyx_t_16);
              __Pyx_INCREF(__pyx_v_y); __Pyx_DECREF(*__pyx_t_16);
              *__pyx_t_16 = __pyx_v_y;
              __Pyx_GIVEREF(*__pyx_t_16);
              goto __pyx_L16;
            }
            /*else*/ {

     701:             else:

     702:                 raise

              /* "lib.pyx":702
     *                 result[i] = y
     *             else:
     *                 raise             # <<<<<<<<<<<<<<
     *
     *     return maybe_convert_bool(result)
     */
              __Pyx_GIVEREF(__pyx_t_4);
              __Pyx_GIVEREF(__pyx_t_6);
              __Pyx_GIVEREF(__pyx_t_3);
              __Pyx_ErrRestore(__pyx_t_4, __pyx_t_6, __pyx_t_3);
              __pyx_t_4 = 0; __pyx_t_6 = 0; __pyx_t_3 = 0;
              {__pyx_filename = __pyx_f[2]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
            }
            __pyx_L16:;
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            goto __pyx_L7_exception_handled;
          }
          __pyx_L8_except_error:;
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_XGIVEREF(__pyx_t_10);
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
          goto __pyx_L1_error;
          __pyx_L7_exception_handled:;
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_XGIVEREF(__pyx_t_10);
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
          __pyx_L13_try_end:;
        }
      }

     703:

     704:     return maybe_convert_bool(result)

      /* "lib.pyx":704
     *                 raise
     *
     *     return maybe_convert_bool(result)             # <<<<<<<<<<<<<<
     *
     *
     */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__maybe_convert_bool); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(((PyObject *)__pyx_v_result));
      PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_result));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_result));
      __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.vec_binop", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF((PyObject *)__pyx_v_result);
      __Pyx_XDECREF(__pyx_v_x);
      __Pyx_XDECREF(__pyx_v_y);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_63astype_intsafe(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_63astype_intsafe = {__Pyx_NAMESTR("astype_intsafe"), (PyCFunction)__pyx_pw_3lib_63astype_intsafe, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_63astype_intsafe(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyArrayObject *__pyx_v_arr = 0;
      PyObject *__pyx_v_new_dtype = 0;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("astype_intsafe (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__arr,&__pyx_n_s__new_dtype,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__arr)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            case  1:
            if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__new_dtype)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("astype_intsafe", 1, 2, 2, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "astype_intsafe") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        }
        __pyx_v_arr = ((PyArrayObject *)values[0]);
        __pyx_v_new_dtype = values[1];
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("astype_intsafe", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_L3_error:;
      __Pyx_AddTraceback("lib.astype_intsafe", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_62astype_intsafe(__pyx_self, __pyx_v_arr, __pyx_v_new_dtype);
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     705:

     706:

     707: def astype_intsafe(ndarray[object] arr, new_dtype):

    /* "lib.pyx":707
     *
     *
     * def astype_intsafe(ndarray[object] arr, new_dtype):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(arr)
     */

    static PyObject *__pyx_pf_3lib_62astype_intsafe(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_new_dtype) {
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_n;
      PyArrayObject *__pyx_v_result = 0;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_arr;
      __Pyx_Buffer __pyx_pybuffer_arr;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("astype_intsafe", 0);
      __pyx_pybuffer_arr.pybuffer.buf = NULL;
      __pyx_pybuffer_arr.refcount = 0;
      __pyx_pybuffernd_arr.data = NULL;
      __pyx_pybuffernd_arr.rcbuffer = &__pyx_pybuffer_arr;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_arr.rcbuffer->pybuffer, (PyObject*)__pyx_v_arr, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_arr.diminfo[0].strides = __pyx_pybuffernd_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_arr.diminfo[0].shape = __pyx_pybuffernd_arr.rcbuffer->pybuffer.shape[0];

      /* "lib.pyx":707
     *
     *
     * def astype_intsafe(ndarray[object] arr, new_dtype):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(arr)
     */
      __pyx_k_tuple_155 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_155)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_155);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__arr));
      PyTuple_SET_ITEM(__pyx_k_tuple_155, 0, ((PyObject *)__pyx_n_s__arr));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__arr));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__new_dtype));
      PyTuple_SET_ITEM(__pyx_k_tuple_155, 1, ((PyObject *)__pyx_n_s__new_dtype));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__new_dtype));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_155, 2, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_155, 3, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
      PyTuple_SET_ITEM(__pyx_k_tuple_155, 4, ((PyObject *)__pyx_n_s__result));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_155));

      /* "lib.pyx":707
     *
     *
     * def astype_intsafe(ndarray[object] arr, new_dtype):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(arr)
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_63astype_intsafe, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__astype_intsafe, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_156 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_155, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__astype_intsafe, 707, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_156)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     708:     cdef:

     709:         Py_ssize_t i, n = len(arr)

      /* "lib.pyx":709
     * def astype_intsafe(ndarray[object] arr, new_dtype):
     *     cdef:
     *         Py_ssize_t i, n = len(arr)             # <<<<<<<<<<<<<<
     *         ndarray result
     *
     */
      __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_arr)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_n = __pyx_t_1;

     710:         ndarray result

     711:

     712:     result = np.empty(n, dtype=new_dtype)

      /* "lib.pyx":712
     *         ndarray result
     *
     *     result = np.empty(n, dtype=new_dtype)             # <<<<<<<<<<<<<<
     *     for i in range(n):
     *         util.set_value_at(result, i, arr[i])
     */
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_v_new_dtype) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_result = ((PyArrayObject *)__pyx_t_5);
      __pyx_t_5 = 0;

     713:     for i in range(n):

      /* "lib.pyx":713
     *
     *     result = np.empty(n, dtype=new_dtype)
     *     for i in range(n):             # <<<<<<<<<<<<<<
     *         util.set_value_at(result, i, arr[i])
     *
     */
      __pyx_t_1 = __pyx_v_n;
      for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_1; __pyx_t_6+=1) {
        __pyx_v_i = __pyx_t_6;

     714:         util.set_value_at(result, i, arr[i])

        /* "lib.pyx":714
     *     result = np.empty(n, dtype=new_dtype)
     *     for i in range(n):
     *         util.set_value_at(result, i, arr[i])             # <<<<<<<<<<<<<<
     *
     *     return result
     */
        __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_7 = __pyx_v_i;
        __pyx_t_8 = -1;
        if (__pyx_t_7 < 0) {
          __pyx_t_7 += __pyx_pybuffernd_arr.diminfo[0].shape;
          if (unlikely(__pyx_t_7 < 0)) __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_arr.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_2 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_arr.diminfo[0].strides);
        __Pyx_INCREF((PyObject*)__pyx_t_2);
        __pyx_t_4 = __pyx_f_4util_set_value_at(__pyx_v_result, __pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }

     715:

     716:     return result

      /* "lib.pyx":716
     *         util.set_value_at(result, i, arr[i])
     *
     *     return result             # <<<<<<<<<<<<<<
     *
     * def clean_index_list(list obj):
     */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_result));
      __pyx_r = ((PyObject *)__pyx_v_result);
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.astype_intsafe", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF((PyObject *)__pyx_v_result);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_65clean_index_list(PyObject *__pyx_self, PyObject *__pyx_v_obj); /*proto*/
    static char __pyx_doc_3lib_64clean_index_list[] = "\n    Utility used in pandas.core.index._ensure_index\n    ";
    static PyMethodDef __pyx_mdef_3lib_65clean_index_list = {__Pyx_NAMESTR("clean_index_list"), (PyCFunction)__pyx_pw_3lib_65clean_index_list, METH_O, __Pyx_DOCSTR(__pyx_doc_3lib_64clean_index_list)};
    static PyObject *__pyx_pw_3lib_65clean_index_list(PyObject *__pyx_self, PyObject *__pyx_v_obj) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("clean_index_list (wrapper)", 0);
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_obj), (&PyList_Type), 1, "obj", 1))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_64clean_index_list(__pyx_self, ((PyObject*)__pyx_v_obj));
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     717:

     718: def clean_index_list(list obj):

    /* "lib.pyx":718
     *     return result
     *
     * def clean_index_list(list obj):             # <<<<<<<<<<<<<<
     *     '''
     *     Utility used in pandas.core.index._ensure_index
     */

    static PyObject *__pyx_pf_3lib_64clean_index_list(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj) {
      PyArrayObject *__pyx_v_converted = 0;
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_n;
      PyObject *__pyx_v_v = 0;
      int __pyx_v_all_arrays;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_converted;
      __Pyx_Buffer __pyx_pybuffer_converted;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("clean_index_list", 0);
      __pyx_pybuffer_converted.pybuffer.buf = NULL;
      __pyx_pybuffer_converted.refcount = 0;
      __pyx_pybuffernd_converted.data = NULL;
      __pyx_pybuffernd_converted.rcbuffer = &__pyx_pybuffer_converted;

      /* "lib.pyx":718
     *     return result
     *
     * def clean_index_list(list obj):             # <<<<<<<<<<<<<<
     *     '''
     *     Utility used in pandas.core.index._ensure_index
     */
      __pyx_k_tuple_157 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_157)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_157);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__obj));
      PyTuple_SET_ITEM(__pyx_k_tuple_157, 0, ((PyObject *)__pyx_n_s__obj));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__obj));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__converted));
      PyTuple_SET_ITEM(__pyx_k_tuple_157, 1, ((PyObject *)__pyx_n_s__converted));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__converted));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_157, 2, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_157, 3, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__v));
      PyTuple_SET_ITEM(__pyx_k_tuple_157, 4, ((PyObject *)__pyx_n_s__v));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__all_arrays));
      PyTuple_SET_ITEM(__pyx_k_tuple_157, 5, ((PyObject *)__pyx_n_s__all_arrays));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__all_arrays));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_157));

      /* "lib.pyx":718
     *     return result
     *
     * def clean_index_list(list obj):             # <<<<<<<<<<<<<<
     *     '''
     *     Utility used in pandas.core.index._ensure_index
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_65clean_index_list, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__clean_index_list, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_158 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_157, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__clean_index_list, 718, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_158)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     719:     '''

     720:     Utility used in pandas.core.index._ensure_index

     721:     '''

     722:     cdef:

     723:         ndarray[object] converted

     724:         Py_ssize_t i, n = len(obj)

      /* "lib.pyx":724
     *     cdef:
     *         ndarray[object] converted
     *         Py_ssize_t i, n = len(obj)             # <<<<<<<<<<<<<<
     *         object v
     *         bint all_arrays = 1
     */
      if (unlikely(((PyObject *)__pyx_v_obj) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_1 = PyList_GET_SIZE(((PyObject *)__pyx_v_obj)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_n = __pyx_t_1;

     725:         object v

     726:         bint all_arrays = 1

      /* "lib.pyx":726
     *         Py_ssize_t i, n = len(obj)
     *         object v
     *         bint all_arrays = 1             # <<<<<<<<<<<<<<
     *
     *     for i in range(n):
     */
      __pyx_v_all_arrays = 1;

     727:

     728:     for i in range(n):

      /* "lib.pyx":728
     *         bint all_arrays = 1
     *
     *     for i in range(n):             # <<<<<<<<<<<<<<
     *         v = obj[i]
     *         if not (PyList_Check(v) or np.PyArray_Check(v)):
     */
      __pyx_t_1 = __pyx_v_n;
      for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
        __pyx_v_i = __pyx_t_2;

     729:         v = obj[i]

        /* "lib.pyx":729
     *
     *     for i in range(n):
     *         v = obj[i]             # <<<<<<<<<<<<<<
     *         if not (PyList_Check(v) or np.PyArray_Check(v)):
     *             all_arrays = 0
     */
        if (unlikely(((PyObject *)__pyx_v_obj) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_obj), __pyx_v_i, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_XDECREF(__pyx_v_v);
        __pyx_v_v = __pyx_t_3;
        __pyx_t_3 = 0;

     730:         if not (PyList_Check(v) or np.PyArray_Check(v)):

        /* "lib.pyx":730
     *     for i in range(n):
     *         v = obj[i]
     *         if not (PyList_Check(v) or np.PyArray_Check(v)):             # <<<<<<<<<<<<<<
     *             all_arrays = 0
     *             break
     */
        __pyx_t_4 = PyList_Check(__pyx_v_v);
        if (!__pyx_t_4) {
          __pyx_t_5 = PyArray_Check(__pyx_v_v);
          __pyx_t_6 = __pyx_t_5;
        } else {
          __pyx_t_6 = __pyx_t_4;
        }
        __pyx_t_4 = (!__pyx_t_6);
        if (__pyx_t_4) {

     731:             all_arrays = 0

          /* "lib.pyx":731
     *         v = obj[i]
     *         if not (PyList_Check(v) or np.PyArray_Check(v)):
     *             all_arrays = 0             # <<<<<<<<<<<<<<
     *             break
     *
     */
          __pyx_v_all_arrays = 0;

     732:             break

          /* "lib.pyx":732
     *         if not (PyList_Check(v) or np.PyArray_Check(v)):
     *             all_arrays = 0
     *             break             # <<<<<<<<<<<<<<
     *
     *     if all_arrays:
     */
          goto __pyx_L4_break;
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
      __pyx_L4_break:;

     733:

     734:     if all_arrays:

      /* "lib.pyx":734
     *             break
     *
     *     if all_arrays:             # <<<<<<<<<<<<<<
     *         return obj, all_arrays
     *
     */
      if (__pyx_v_all_arrays) {

     735:         return obj, all_arrays

        /* "lib.pyx":735
     *
     *     if all_arrays:
     *         return obj, all_arrays             # <<<<<<<<<<<<<<
     *
     *     converted = np.empty(n, dtype=object)
     */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_all_arrays); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_INCREF(((PyObject *)__pyx_v_obj));
        PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_obj));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_obj));
        PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_r = ((PyObject *)__pyx_t_7);
        __pyx_t_7 = 0;
        goto __pyx_L0;
        goto __pyx_L6;
      }
      __pyx_L6:;

     736:

     737:     converted = np.empty(n, dtype=object)

      /* "lib.pyx":737
     *         return obj, all_arrays
     *
     *     converted = np.empty(n, dtype=object)             # <<<<<<<<<<<<<<
     *     for i in range(n):
     *         v = obj[i]
     */
      __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_3 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_7);
      __pyx_t_7 = 0;
      __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_7));
      if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_8), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
      if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_10 = ((PyArrayObject *)__pyx_t_9);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_converted.rcbuffer->pybuffer);
        __pyx_t_11 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_converted.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_11 < 0)) {
          PyErr_Fetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_converted.rcbuffer->pybuffer, (PyObject*)__pyx_v_converted, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_12, __pyx_t_13, __pyx_t_14);
          }
        }
        __pyx_pybuffernd_converted.diminfo[0].strides = __pyx_pybuffernd_converted.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_converted.diminfo[0].shape = __pyx_pybuffernd_converted.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_10 = 0;
      __pyx_v_converted = ((PyArrayObject *)__pyx_t_9);
      __pyx_t_9 = 0;

     738:     for i in range(n):

      /* "lib.pyx":738
     *
     *     converted = np.empty(n, dtype=object)
     *     for i in range(n):             # <<<<<<<<<<<<<<
     *         v = obj[i]
     *         if PyList_Check(v) or np.PyArray_Check(v):
     */
      __pyx_t_1 = __pyx_v_n;
      for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
        __pyx_v_i = __pyx_t_2;

     739:         v = obj[i]

        /* "lib.pyx":739
     *     converted = np.empty(n, dtype=object)
     *     for i in range(n):
     *         v = obj[i]             # <<<<<<<<<<<<<<
     *         if PyList_Check(v) or np.PyArray_Check(v):
     *             converted[i] = tuple(v)
     */
        if (unlikely(((PyObject *)__pyx_v_obj) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_9 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_obj), __pyx_v_i, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_9) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_XDECREF(__pyx_v_v);
        __pyx_v_v = __pyx_t_9;
        __pyx_t_9 = 0;

     740:         if PyList_Check(v) or np.PyArray_Check(v):

        /* "lib.pyx":740
     *     for i in range(n):
     *         v = obj[i]
     *         if PyList_Check(v) or np.PyArray_Check(v):             # <<<<<<<<<<<<<<
     *             converted[i] = tuple(v)
     *         else:
     */
        __pyx_t_4 = PyList_Check(__pyx_v_v);
        if (!__pyx_t_4) {
          __pyx_t_6 = PyArray_Check(__pyx_v_v);
          __pyx_t_5 = __pyx_t_6;
        } else {
          __pyx_t_5 = __pyx_t_4;
        }
        if (__pyx_t_5) {

     741:             converted[i] = tuple(v)

          /* "lib.pyx":741
     *         v = obj[i]
     *         if PyList_Check(v) or np.PyArray_Check(v):
     *             converted[i] = tuple(v)             # <<<<<<<<<<<<<<
     *         else:
     *             converted[i] = v
     */
          __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_INCREF(__pyx_v_v);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_v);
          __Pyx_GIVEREF(__pyx_v_v);
          __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
          __pyx_t_15 = __pyx_v_i;
          __pyx_t_11 = -1;
          if (__pyx_t_15 < 0) {
            __pyx_t_15 += __pyx_pybuffernd_converted.diminfo[0].shape;
            if (unlikely(__pyx_t_15 < 0)) __pyx_t_11 = 0;
          } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_converted.diminfo[0].shape)) __pyx_t_11 = 0;
          if (unlikely(__pyx_t_11 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_11);
            {__pyx_filename = __pyx_f[2]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_16 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_converted.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_converted.diminfo[0].strides);
          __Pyx_GOTREF(*__pyx_t_16);
          __Pyx_INCREF(__pyx_t_7); __Pyx_DECREF(*__pyx_t_16);
          *__pyx_t_16 = __pyx_t_7;
          __Pyx_GIVEREF(*__pyx_t_16);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          goto __pyx_L9;
        }
        /*else*/ {

     742:         else:

     743:             converted[i] = v

          /* "lib.pyx":743
     *             converted[i] = tuple(v)
     *         else:
     *             converted[i] = v             # <<<<<<<<<<<<<<
     *
     *     return maybe_convert_objects(converted), 0
     */
          __pyx_t_17 = __pyx_v_i;
          __pyx_t_11 = -1;
          if (__pyx_t_17 < 0) {
            __pyx_t_17 += __pyx_pybuffernd_converted.diminfo[0].shape;
            if (unlikely(__pyx_t_17 < 0)) __pyx_t_11 = 0;
          } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_converted.diminfo[0].shape)) __pyx_t_11 = 0;
          if (unlikely(__pyx_t_11 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_11);
            {__pyx_filename = __pyx_f[2]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_16 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_converted.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_converted.diminfo[0].strides);
          __Pyx_GOTREF(*__pyx_t_16);
          __Pyx_INCREF(__pyx_v_v); __Pyx_DECREF(*__pyx_t_16);
          *__pyx_t_16 = __pyx_v_v;
          __Pyx_GIVEREF(*__pyx_t_16);
        }
        __pyx_L9:;
      }

     744:

     745:     return maybe_convert_objects(converted), 0

      /* "lib.pyx":745
     *             converted[i] = v
     *
     *     return maybe_convert_objects(converted), 0             # <<<<<<<<<<<<<<
     *
     * @cython.boundscheck(False)
     */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(((PyObject *)__pyx_v_converted));
      PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_v_converted));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_converted));
      __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_int_0);
      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      __pyx_t_8 = 0;
      __pyx_r = ((PyObject *)__pyx_t_9);
      __pyx_t_9 = 0;
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_9);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_converted.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.clean_index_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_converted.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF((PyObject *)__pyx_v_converted);
      __Pyx_XDECREF(__pyx_v_v);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_67max_len_string_array(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/
    static char __pyx_doc_3lib_66max_len_string_array[] = " return the maximum size of elements in a 1-dim string array ";
    static PyMethodDef __pyx_mdef_3lib_67max_len_string_array = {__Pyx_NAMESTR("max_len_string_array"), (PyCFunction)__pyx_pw_3lib_67max_len_string_array, METH_O, __Pyx_DOCSTR(__pyx_doc_3lib_66max_len_string_array)};
    static PyObject *__pyx_pw_3lib_67max_len_string_array(PyObject *__pyx_self, PyObject *__pyx_v_arr) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("max_len_string_array (wrapper)", 0);
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_66max_len_string_array(__pyx_self, ((PyArrayObject *)__pyx_v_arr));
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     746:

     747: @cython.boundscheck(False)

     748: @cython.wraparound(False)

     749: def max_len_string_array(ndarray[object, ndim=1] arr):

    /* "lib.pyx":749
     * @cython.boundscheck(False)
     * @cython.wraparound(False)
     * def max_len_string_array(ndarray[object, ndim=1] arr):             # <<<<<<<<<<<<<<
     *     """ return the maximum size of elements in a 1-dim string array """
     *     cdef:
     */

    static PyObject *__pyx_pf_3lib_66max_len_string_array(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr) {
      int __pyx_v_i;
      int __pyx_v_m;
      int __pyx_v_l;
      PyObject *__pyx_v_length = 0;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_arr;
      __Pyx_Buffer __pyx_pybuffer_arr;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("max_len_string_array", 0);
      __pyx_pybuffer_arr.pybuffer.buf = NULL;
      __pyx_pybuffer_arr.refcount = 0;
      __pyx_pybuffernd_arr.data = NULL;
      __pyx_pybuffernd_arr.rcbuffer = &__pyx_pybuffer_arr;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_arr.rcbuffer->pybuffer, (PyObject*)__pyx_v_arr, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_arr.diminfo[0].strides = __pyx_pybuffernd_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_arr.diminfo[0].shape = __pyx_pybuffernd_arr.rcbuffer->pybuffer.shape[0];

      /* "lib.pyx":749
     * @cython.boundscheck(False)
     * @cython.wraparound(False)
     * def max_len_string_array(ndarray[object, ndim=1] arr):             # <<<<<<<<<<<<<<
     *     """ return the maximum size of elements in a 1-dim string array """
     *     cdef:
     */
      __pyx_k_tuple_159 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_159)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_159);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__arr));
      PyTuple_SET_ITEM(__pyx_k_tuple_159, 0, ((PyObject *)__pyx_n_s__arr));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__arr));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_159, 1, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__m));
      PyTuple_SET_ITEM(__pyx_k_tuple_159, 2, ((PyObject *)__pyx_n_s__m));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__m));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__l));
      PyTuple_SET_ITEM(__pyx_k_tuple_159, 3, ((PyObject *)__pyx_n_s__l));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__length));
      PyTuple_SET_ITEM(__pyx_k_tuple_159, 4, ((PyObject *)__pyx_n_s__length));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__length));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_159));

      /* "lib.pyx":749
     * @cython.boundscheck(False)
     * @cython.wraparound(False)
     * def max_len_string_array(ndarray[object, ndim=1] arr):             # <<<<<<<<<<<<<<
     *     """ return the maximum size of elements in a 1-dim string array """
     *     cdef:
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_67max_len_string_array, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s_161, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_160 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_159, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s_161, 749, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_160)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     750:     """ return the maximum size of elements in a 1-dim string array """

     751:     cdef:

     752:         int i, m, l

     753:         length = arr.shape[0]

      /* "lib.pyx":753
     *     cdef:
     *         int i, m, l
     *         length = arr.shape[0]             # <<<<<<<<<<<<<<
     *
     *     m = 0
     */
      __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_arr->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_length = __pyx_t_1;
      __pyx_t_1 = 0;

     754:

     755:     m = 0

      /* "lib.pyx":755
     *         length = arr.shape[0]
     *
     *     m = 0             # <<<<<<<<<<<<<<
     *     for i from 0 <= i < length:
     *         l = len(arr[i])
     */
      __pyx_v_m = 0;

     756:     for i from 0 <= i < length:

      /* "lib.pyx":756
     *
     *     m = 0
     *     for i from 0 <= i < length:             # <<<<<<<<<<<<<<
     *         l = len(arr[i])
     *
     */
      __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_v_length); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) {

     757:         l = len(arr[i])

        /* "lib.pyx":757
     *     m = 0
     *     for i from 0 <= i < length:
     *         l = len(arr[i])             # <<<<<<<<<<<<<<
     *
     *         if l > m:
     */
        __pyx_t_3 = __pyx_v_i;
        __pyx_t_1 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_arr.diminfo[0].strides);
        __Pyx_INCREF((PyObject*)__pyx_t_1);
        __pyx_t_4 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_v_l = __pyx_t_4;

     758:

     759:         if l > m:

        /* "lib.pyx":759
     *         l = len(arr[i])
     *
     *         if l > m:             # <<<<<<<<<<<<<<
     *             m = l
     *
     */
        __pyx_t_5 = (__pyx_v_l > __pyx_v_m);
        if (__pyx_t_5) {

     760:             m = l

          /* "lib.pyx":760
     *
     *         if l > m:
     *             m = l             # <<<<<<<<<<<<<<
     *
     *     return m
     */
          __pyx_v_m = __pyx_v_l;
          goto __pyx_L5;
        }
        __pyx_L5:;
      }

     761:

     762:     return m

      /* "lib.pyx":762
     *             m = l
     *
     *     return m             # <<<<<<<<<<<<<<
     *
     * @cython.boundscheck(False)
     */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = PyInt_FromLong(__pyx_v_m); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.max_len_string_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF(__pyx_v_length);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_69array_replace_from_nan_rep(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_3lib_68array_replace_from_nan_rep[] = " replace the values in the array with replacement if they are nan_rep; return the same array ";
    static PyMethodDef __pyx_mdef_3lib_69array_replace_from_nan_rep = {__Pyx_NAMESTR("array_replace_from_nan_rep"), (PyCFunction)__pyx_pw_3lib_69array_replace_from_nan_rep, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3lib_68array_replace_from_nan_rep)};
    static PyObject *__pyx_pw_3lib_69array_replace_from_nan_rep(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyArrayObject *__pyx_v_arr = 0;
      PyObject *__pyx_v_nan_rep = 0;
      PyObject *__pyx_v_replace = 0;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("array_replace_from_nan_rep (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__arr,&__pyx_n_s__nan_rep,&__pyx_n_s__replace,0};
        PyObject* values[3] = {0,0,0};

     763:

     764: @cython.boundscheck(False)

     765: @cython.wraparound(False)

     766: def array_replace_from_nan_rep(ndarray[object, ndim=1] arr, object nan_rep, object replace = None):

        /* "lib.pyx":766
     * @cython.boundscheck(False)
     * @cython.wraparound(False)
     * def array_replace_from_nan_rep(ndarray[object, ndim=1] arr, object nan_rep, object replace = None):             # <<<<<<<<<<<<<<
     *     """ replace the values in the array with replacement if they are nan_rep; return the same array """
     *
     */
        values[2] = ((PyObject *)Py_None);
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__arr)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            case  1:
            if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nan_rep)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("array_replace_from_nan_rep", 0, 2, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
            case  2:
            if (kw_args > 0) {
              PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__replace);
              if (value) { values[2] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "array_replace_from_nan_rep") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_arr = ((PyArrayObject *)values[0]);
        __pyx_v_nan_rep = values[1];
        __pyx_v_replace = values[2];
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("array_replace_from_nan_rep", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_L3_error:;
      __Pyx_AddTraceback("lib.array_replace_from_nan_rep", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_68array_replace_from_nan_rep(__pyx_self, __pyx_v_arr, __pyx_v_nan_rep, __pyx_v_replace);
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_3lib_68array_replace_from_nan_rep(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_nan_rep, PyObject *__pyx_v_replace) {
      int __pyx_v_length;
      int __pyx_v_i;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_arr;
      __Pyx_Buffer __pyx_pybuffer_arr;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("array_replace_from_nan_rep", 0);
      __Pyx_INCREF(__pyx_v_replace);
      __pyx_pybuffer_arr.pybuffer.buf = NULL;
      __pyx_pybuffer_arr.refcount = 0;
      __pyx_pybuffernd_arr.data = NULL;
      __pyx_pybuffernd_arr.rcbuffer = &__pyx_pybuffer_arr;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_arr.rcbuffer->pybuffer, (PyObject*)__pyx_v_arr, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_arr.diminfo[0].strides = __pyx_pybuffernd_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_arr.diminfo[0].shape = __pyx_pybuffernd_arr.rcbuffer->pybuffer.shape[0];

      /* "lib.pyx":766
     * @cython.boundscheck(False)
     * @cython.wraparound(False)
     * def array_replace_from_nan_rep(ndarray[object, ndim=1] arr, object nan_rep, object replace = None):             # <<<<<<<<<<<<<<
     *     """ replace the values in the array with replacement if they are nan_rep; return the same array """
     *
     */
      __pyx_k_tuple_162 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_162)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_162);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__arr));
      PyTuple_SET_ITEM(__pyx_k_tuple_162, 0, ((PyObject *)__pyx_n_s__arr));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__arr));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__nan_rep));
      PyTuple_SET_ITEM(__pyx_k_tuple_162, 1, ((PyObject *)__pyx_n_s__nan_rep));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nan_rep));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__replace));
      PyTuple_SET_ITEM(__pyx_k_tuple_162, 2, ((PyObject *)__pyx_n_s__replace));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__replace));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__length));
      PyTuple_SET_ITEM(__pyx_k_tuple_162, 3, ((PyObject *)__pyx_n_s__length));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__length));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_162, 4, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_162));

      /* "lib.pyx":766
     * @cython.boundscheck(False)
     * @cython.wraparound(False)
     * def array_replace_from_nan_rep(ndarray[object, ndim=1] arr, object nan_rep, object replace = None):             # <<<<<<<<<<<<<<
     *     """ replace the values in the array with replacement if they are nan_rep; return the same array """
     *
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_69array_replace_from_nan_rep, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s_164, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_163 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_162, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s_164, 766, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_163)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     767:     """ replace the values in the array with replacement if they are nan_rep; return the same array """

     768:

     769:     cdef int length = arr.shape[0]

      /* "lib.pyx":769
     *     """ replace the values in the array with replacement if they are nan_rep; return the same array """
     *
     *     cdef int length = arr.shape[0]             # <<<<<<<<<<<<<<
     *     cdef int i = 0
     *     if replace is None:
     */
      __pyx_v_length = (__pyx_v_arr->dimensions[0]);

     770:     cdef int i = 0

      /* "lib.pyx":770
     *
     *     cdef int length = arr.shape[0]
     *     cdef int i = 0             # <<<<<<<<<<<<<<
     *     if replace is None:
     *         replace = np.nan
     */
      __pyx_v_i = 0;

     771:     if replace is None:

      /* "lib.pyx":771
     *     cdef int length = arr.shape[0]
     *     cdef int i = 0
     *     if replace is None:             # <<<<<<<<<<<<<<
     *         replace = np.nan
     *
     */
      __pyx_t_1 = (__pyx_v_replace == Py_None);
      if (__pyx_t_1) {

     772:         replace = np.nan

        /* "lib.pyx":772
     *     cdef int i = 0
     *     if replace is None:
     *         replace = np.nan             # <<<<<<<<<<<<<<
     *
     *     for i from 0 <= i < length:
     */
        __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__nan); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_v_replace);
        __pyx_v_replace = __pyx_t_3;
        __pyx_t_3 = 0;
        goto __pyx_L3;
      }
      __pyx_L3:;

     773:

     774:     for i from 0 <= i < length:

      /* "lib.pyx":774
     *         replace = np.nan
     *
     *     for i from 0 <= i < length:             # <<<<<<<<<<<<<<
     *         if arr[i] == nan_rep:
     *             arr[i] = replace
     */
      __pyx_t_4 = __pyx_v_length;
      for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_4; __pyx_v_i++) {

     775:         if arr[i] == nan_rep:

        /* "lib.pyx":775
     *
     *     for i from 0 <= i < length:
     *         if arr[i] == nan_rep:             # <<<<<<<<<<<<<<
     *             arr[i] = replace
     *
     */
        __pyx_t_5 = __pyx_v_i;
        __pyx_t_3 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_arr.diminfo[0].strides);
        __Pyx_INCREF((PyObject*)__pyx_t_3);
        __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_v_nan_rep, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (__pyx_t_1) {

     776:             arr[i] = replace

          /* "lib.pyx":776
     *     for i from 0 <= i < length:
     *         if arr[i] == nan_rep:
     *             arr[i] = replace             # <<<<<<<<<<<<<<
     *
     *     return arr
     */
          __pyx_t_6 = __pyx_v_i;
          __pyx_t_7 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_arr.diminfo[0].strides);
          __Pyx_GOTREF(*__pyx_t_7);
          __Pyx_INCREF(__pyx_v_replace); __Pyx_DECREF(*__pyx_t_7);
          *__pyx_t_7 = __pyx_v_replace;
          __Pyx_GIVEREF(*__pyx_t_7);
          goto __pyx_L6;
        }
        __pyx_L6:;
      }

     777:

     778:     return arr

      /* "lib.pyx":778
     *             arr[i] = replace
     *
     *     return arr             # <<<<<<<<<<<<<<
     *
     * @cython.boundscheck(False)
     */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_arr));
      __pyx_r = ((PyObject *)__pyx_v_arr);
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.array_replace_from_nan_rep", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF(__pyx_v_replace);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_71create_hdf_rows_2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_3lib_70create_hdf_rows_2d[] = " return a list of objects ready to be converted to rec-array format ";
    static PyMethodDef __pyx_mdef_3lib_71create_hdf_rows_2d = {__Pyx_NAMESTR("create_hdf_rows_2d"), (PyCFunction)__pyx_pw_3lib_71create_hdf_rows_2d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3lib_70create_hdf_rows_2d)};
    static PyObject *__pyx_pw_3lib_71create_hdf_rows_2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyArrayObject *__pyx_v_indexer0 = 0;
      PyArrayObject *__pyx_v_mask = 0;
      PyArrayObject *__pyx_v_searchable = 0;
      PyObject *__pyx_v_values = 0;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("create_hdf_rows_2d (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__indexer0,&__pyx_n_s__mask,&__pyx_n_s__searchable,&__pyx_n_s__values,0};
        PyObject* values[4] = {0,0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indexer0)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            case  1:
            if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("create_hdf_rows_2d", 1, 4, 4, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
            case  2:
            if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__searchable)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("create_hdf_rows_2d", 1, 4, 4, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
            case  3:
            if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("create_hdf_rows_2d", 1, 4, 4, 3); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create_hdf_rows_2d") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
          values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
          values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        }
        __pyx_v_indexer0 = ((PyArrayObject *)values[0]);
        __pyx_v_mask = ((PyArrayObject *)values[1]);
        __pyx_v_searchable = ((PyArrayObject *)values[2]);
        __pyx_v_values = ((PyObject*)values[3]);
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("create_hdf_rows_2d", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_L3_error:;
      __Pyx_AddTraceback("lib.create_hdf_rows_2d", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indexer0), __pyx_ptype_5numpy_ndarray, 1, "indexer0", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_searchable), __pyx_ptype_5numpy_ndarray, 1, "searchable", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), (&PyList_Type), 1, "values", 1))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_70create_hdf_rows_2d(__pyx_self, __pyx_v_indexer0, __pyx_v_mask, __pyx_v_searchable, __pyx_v_values);
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     779:

     780: @cython.boundscheck(False)

     781: @cython.wraparound(False)

     782: def create_hdf_rows_2d(ndarray indexer0,

    /* "lib.pyx":782
     * @cython.boundscheck(False)
     * @cython.wraparound(False)
     * def create_hdf_rows_2d(ndarray indexer0,             # <<<<<<<<<<<<<<
     *                        ndarray[np.uint8_t, ndim=1] mask,
     *                        ndarray[np.uint8_t, ndim=1] searchable,
     */

    static PyObject *__pyx_pf_3lib_70create_hdf_rows_2d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_indexer0, PyArrayObject *__pyx_v_mask, PyArrayObject *__pyx_v_searchable, PyObject *__pyx_v_values) {
      int __pyx_v_i;
      int __pyx_v_b;
      int __pyx_v_n_indexer0;
      int __pyx_v_n_blocks;
      int __pyx_v_tup_size;
      PyObject *__pyx_v_l = 0;
      PyObject *__pyx_v_tup = 0;
      PyObject *__pyx_v_val = 0;
      PyObject *__pyx_v_v = 0;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_mask;
      __Pyx_Buffer __pyx_pybuffer_mask;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_searchable;
      __Pyx_Buffer __pyx_pybuffer_searchable;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("create_hdf_rows_2d", 0);
      __pyx_pybuffer_mask.pybuffer.buf = NULL;
      __pyx_pybuffer_mask.refcount = 0;
      __pyx_pybuffernd_mask.data = NULL;
      __pyx_pybuffernd_mask.rcbuffer = &__pyx_pybuffer_mask;
      __pyx_pybuffer_searchable.pybuffer.buf = NULL;
      __pyx_pybuffer_searchable.refcount = 0;
      __pyx_pybuffernd_searchable.data = NULL;
      __pyx_pybuffernd_searchable.rcbuffer = &__pyx_pybuffer_searchable;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_mask.diminfo[0].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask.diminfo[0].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_searchable.rcbuffer->pybuffer, (PyObject*)__pyx_v_searchable, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_searchable.diminfo[0].strides = __pyx_pybuffernd_searchable.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_searchable.diminfo[0].shape = __pyx_pybuffernd_searchable.rcbuffer->pybuffer.shape[0];

      /* "lib.pyx":782
     * @cython.boundscheck(False)
     * @cython.wraparound(False)
     * def create_hdf_rows_2d(ndarray indexer0,             # <<<<<<<<<<<<<<
     *                        ndarray[np.uint8_t, ndim=1] mask,
     *                        ndarray[np.uint8_t, ndim=1] searchable,
     */
      __pyx_k_tuple_165 = PyTuple_New(13); if (unlikely(!__pyx_k_tuple_165)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_165);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer0));
      PyTuple_SET_ITEM(__pyx_k_tuple_165, 0, ((PyObject *)__pyx_n_s__indexer0));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer0));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
      PyTuple_SET_ITEM(__pyx_k_tuple_165, 1, ((PyObject *)__pyx_n_s__mask));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__searchable));
      PyTuple_SET_ITEM(__pyx_k_tuple_165, 2, ((PyObject *)__pyx_n_s__searchable));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__searchable));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
      PyTuple_SET_ITEM(__pyx_k_tuple_165, 3, ((PyObject *)__pyx_n_s__values));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_165, 4, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__b));
      PyTuple_SET_ITEM(__pyx_k_tuple_165, 5, ((PyObject *)__pyx_n_s__b));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n_indexer0));
      PyTuple_SET_ITEM(__pyx_k_tuple_165, 6, ((PyObject *)__pyx_n_s__n_indexer0));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_indexer0));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n_blocks));
      PyTuple_SET_ITEM(__pyx_k_tuple_165, 7, ((PyObject *)__pyx_n_s__n_blocks));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_blocks));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__tup_size));
      PyTuple_SET_ITEM(__pyx_k_tuple_165, 8, ((PyObject *)__pyx_n_s__tup_size));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tup_size));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__l));
      PyTuple_SET_ITEM(__pyx_k_tuple_165, 9, ((PyObject *)__pyx_n_s__l));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__tup));
      PyTuple_SET_ITEM(__pyx_k_tuple_165, 10, ((PyObject *)__pyx_n_s__tup));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tup));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
      PyTuple_SET_ITEM(__pyx_k_tuple_165, 11, ((PyObject *)__pyx_n_s__val));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__v));
      PyTuple_SET_ITEM(__pyx_k_tuple_165, 12, ((PyObject *)__pyx_n_s__v));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_165));

      /* "lib.pyx":782
     * @cython.boundscheck(False)
     * @cython.wraparound(False)
     * def create_hdf_rows_2d(ndarray indexer0,             # <<<<<<<<<<<<<<
     *                        ndarray[np.uint8_t, ndim=1] mask,
     *                        ndarray[np.uint8_t, ndim=1] searchable,
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_71create_hdf_rows_2d, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__create_hdf_rows_2d, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_166 = (PyObject*)__Pyx_PyCode_New(4, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_165, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__create_hdf_rows_2d, 782, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_166)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     783:                        ndarray[np.uint8_t, ndim=1] mask,

     784:                        ndarray[np.uint8_t, ndim=1] searchable,

     785:                        list values):

     786:     """ return a list of objects ready to be converted to rec-array format """

     787:

     788:     cdef:

     789:         int i, b, n_indexer0, n_blocks, tup_size

     790:         list l

     791:         object tup, val, v

     792:

     793:     n_indexer0 = indexer0.shape[0]

      /* "lib.pyx":793
     *         object tup, val, v
     *
     *     n_indexer0 = indexer0.shape[0]             # <<<<<<<<<<<<<<
     *     n_blocks   = len(values)
     *     tup_size   = n_blocks+1
     */
      __pyx_v_n_indexer0 = (__pyx_v_indexer0->dimensions[0]);

     794:     n_blocks   = len(values)

      /* "lib.pyx":794
     *
     *     n_indexer0 = indexer0.shape[0]
     *     n_blocks   = len(values)             # <<<<<<<<<<<<<<
     *     tup_size   = n_blocks+1
     *     l = []
     */
      if (unlikely(((PyObject *)__pyx_v_values) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_1 = PyList_GET_SIZE(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_n_blocks = __pyx_t_1;

     795:     tup_size   = n_blocks+1

      /* "lib.pyx":795
     *     n_indexer0 = indexer0.shape[0]
     *     n_blocks   = len(values)
     *     tup_size   = n_blocks+1             # <<<<<<<<<<<<<<
     *     l = []
     *
     */
      __pyx_v_tup_size = (__pyx_v_n_blocks + 1);

     796:     l = []

      /* "lib.pyx":796
     *     n_blocks   = len(values)
     *     tup_size   = n_blocks+1
     *     l = []             # <<<<<<<<<<<<<<
     *
     *     for i from 0 <= i < n_indexer0:
     */
      __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_l = __pyx_t_2;
      __pyx_t_2 = 0;

     797:

     798:     for i from 0 <= i < n_indexer0:

      /* "lib.pyx":798
     *     l = []
     *
     *     for i from 0 <= i < n_indexer0:             # <<<<<<<<<<<<<<
     *
     *         if not mask[i]:
     */
      __pyx_t_3 = __pyx_v_n_indexer0;
      for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {

     799:

     800:         if not mask[i]:

        /* "lib.pyx":800
     *     for i from 0 <= i < n_indexer0:
     *
     *         if not mask[i]:             # <<<<<<<<<<<<<<
     *
     *             tup = PyTuple_New(tup_size)
     */
        __pyx_t_4 = __pyx_v_i;
        __pyx_t_5 = (!(*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_mask.diminfo[0].strides)));
        if (__pyx_t_5) {

     801:

     802:             tup = PyTuple_New(tup_size)

          /* "lib.pyx":802
     *         if not mask[i]:
     *
     *             tup = PyTuple_New(tup_size)             # <<<<<<<<<<<<<<
     *             val  = indexer0[i]
     *             PyTuple_SET_ITEM(tup, 0, val)
     */
          __pyx_t_2 = ((PyObject *)PyTuple_New(__pyx_v_tup_size)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_XDECREF(__pyx_v_tup);
          __pyx_v_tup = __pyx_t_2;
          __pyx_t_2 = 0;

     803:             val  = indexer0[i]

          /* "lib.pyx":803
     *
     *             tup = PyTuple_New(tup_size)
     *             val  = indexer0[i]             # <<<<<<<<<<<<<<
     *             PyTuple_SET_ITEM(tup, 0, val)
     *             Py_INCREF(val)
     */
          __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_indexer0), __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_XDECREF(__pyx_v_val);
          __pyx_v_val = __pyx_t_2;
          __pyx_t_2 = 0;

     804:             PyTuple_SET_ITEM(tup, 0, val)

          /* "lib.pyx":804
     *             tup = PyTuple_New(tup_size)
     *             val  = indexer0[i]
     *             PyTuple_SET_ITEM(tup, 0, val)             # <<<<<<<<<<<<<<
     *             Py_INCREF(val)
     *
     */
          PyTuple_SET_ITEM(__pyx_v_tup, 0, __pyx_v_val);

     805:             Py_INCREF(val)

          /* "lib.pyx":805
     *             val  = indexer0[i]
     *             PyTuple_SET_ITEM(tup, 0, val)
     *             Py_INCREF(val)             # <<<<<<<<<<<<<<
     *
     *             for b from 0 <= b < n_blocks:
     */
          Py_INCREF(__pyx_v_val);

     806:

     807:             for b from 0 <= b < n_blocks:

          /* "lib.pyx":807
     *             Py_INCREF(val)
     *
     *             for b from 0 <= b < n_blocks:             # <<<<<<<<<<<<<<
     *
     *                 v = values[b][:, i]
     */
          __pyx_t_6 = __pyx_v_n_blocks;
          for (__pyx_v_b = 0; __pyx_v_b < __pyx_t_6; __pyx_v_b++) {

     808:

     809:                 v = values[b][:, i]

            /* "lib.pyx":809
     *             for b from 0 <= b < n_blocks:
     *
     *                 v = values[b][:, i]             # <<<<<<<<<<<<<<
     *                 if searchable[b]:
     *                     v = v[0]
     */
            if (unlikely(((PyObject *)__pyx_v_values) == Py_None)) {
              PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
              {__pyx_filename = __pyx_f[2]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_2 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_2);
            __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_INCREF(__pyx_k_slice_10);
            PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_k_slice_10);
            __Pyx_GIVEREF(__pyx_k_slice_10);
            PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
            __Pyx_GIVEREF(__pyx_t_2);
            __pyx_t_2 = 0;
            __pyx_t_2 = PyObject_GetItem(PyList_GET_ITEM(__pyx_v_values, __pyx_v_b), ((PyObject *)__pyx_t_7)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
            __Pyx_XDECREF(__pyx_v_v);
            __pyx_v_v = __pyx_t_2;
            __pyx_t_2 = 0;

      /* "lib.pyx":809
     *             for b from 0 <= b < n_blocks:
     *
     *                 v = values[b][:, i]             # <<<<<<<<<<<<<<
     *                 if searchable[b]:
     *                     v = v[0]
     */
      __pyx_k_slice_10 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_slice_10);
      __Pyx_GIVEREF(__pyx_k_slice_10);

     810:                 if searchable[b]:

            /* "lib.pyx":810
     *
     *                 v = values[b][:, i]
     *                 if searchable[b]:             # <<<<<<<<<<<<<<
     *                     v = v[0]
     *                 PyTuple_SET_ITEM(tup, b+1, v)
     */
            __pyx_t_8 = __pyx_v_b;
            __pyx_t_9 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_searchable.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_searchable.diminfo[0].strides));
            if (__pyx_t_9) {

     811:                     v = v[0]

              /* "lib.pyx":811
     *                 v = values[b][:, i]
     *                 if searchable[b]:
     *                     v = v[0]             # <<<<<<<<<<<<<<
     *                 PyTuple_SET_ITEM(tup, b+1, v)
     *                 Py_INCREF(v)
     */
              __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_v, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_v_v);
              __pyx_v_v = __pyx_t_2;
              __pyx_t_2 = 0;
              goto __pyx_L8;
            }
            __pyx_L8:;

     812:                 PyTuple_SET_ITEM(tup, b+1, v)

            /* "lib.pyx":812
     *                 if searchable[b]:
     *                     v = v[0]
     *                 PyTuple_SET_ITEM(tup, b+1, v)             # <<<<<<<<<<<<<<
     *                 Py_INCREF(v)
     *
     */
            PyTuple_SET_ITEM(__pyx_v_tup, (__pyx_v_b + 1), __pyx_v_v);

     813:                 Py_INCREF(v)

            /* "lib.pyx":813
     *                     v = v[0]
     *                 PyTuple_SET_ITEM(tup, b+1, v)
     *                 Py_INCREF(v)             # <<<<<<<<<<<<<<
     *
     *             l.append(tup)
     */
            Py_INCREF(__pyx_v_v);
          }

     814:

     815:             l.append(tup)

          /* "lib.pyx":815
     *                 Py_INCREF(v)
     *
     *             l.append(tup)             # <<<<<<<<<<<<<<
     *
     *     return l
     */
          __pyx_t_10 = PyList_Append(__pyx_v_l, __pyx_v_tup); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          goto __pyx_L5;
        }
        __pyx_L5:;
      }

     816:

     817:     return l

      /* "lib.pyx":817
     *             l.append(tup)
     *
     *     return l             # <<<<<<<<<<<<<<
     *
     * @cython.boundscheck(False)
     */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_l));
      __pyx_r = ((PyObject *)__pyx_v_l);
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_7);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_searchable.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.create_hdf_rows_2d", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_searchable.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF(__pyx_v_l);
      __Pyx_XDECREF(__pyx_v_tup);
      __Pyx_XDECREF(__pyx_v_val);
      __Pyx_XDECREF(__pyx_v_v);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_73create_hdf_rows_3d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_3lib_72create_hdf_rows_3d[] = " return a list of objects ready to be converted to rec-array format ";
    static PyMethodDef __pyx_mdef_3lib_73create_hdf_rows_3d = {__Pyx_NAMESTR("create_hdf_rows_3d"), (PyCFunction)__pyx_pw_3lib_73create_hdf_rows_3d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3lib_72create_hdf_rows_3d)};
    static PyObject *__pyx_pw_3lib_73create_hdf_rows_3d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyArrayObject *__pyx_v_indexer0 = 0;
      PyArrayObject *__pyx_v_indexer1 = 0;
      PyArrayObject *__pyx_v_mask = 0;
      PyArrayObject *__pyx_v_searchable = 0;
      PyObject *__pyx_v_values = 0;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("create_hdf_rows_3d (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__indexer0,&__pyx_n_s__indexer1,&__pyx_n_s__mask,&__pyx_n_s__searchable,&__pyx_n_s__values,0};
        PyObject* values[5] = {0,0,0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indexer0)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            case  1:
            if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indexer1)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("create_hdf_rows_3d", 1, 5, 5, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
            case  2:
            if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("create_hdf_rows_3d", 1, 5, 5, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
            case  3:
            if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__searchable)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("create_hdf_rows_3d", 1, 5, 5, 3); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
            case  4:
            if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("create_hdf_rows_3d", 1, 5, 5, 4); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create_hdf_rows_3d") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
          values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
          values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
          values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        }
        __pyx_v_indexer0 = ((PyArrayObject *)values[0]);
        __pyx_v_indexer1 = ((PyArrayObject *)values[1]);
        __pyx_v_mask = ((PyArrayObject *)values[2]);
        __pyx_v_searchable = ((PyArrayObject *)values[3]);
        __pyx_v_values = ((PyObject*)values[4]);
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("create_hdf_rows_3d", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_L3_error:;
      __Pyx_AddTraceback("lib.create_hdf_rows_3d", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indexer0), __pyx_ptype_5numpy_ndarray, 1, "indexer0", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indexer1), __pyx_ptype_5numpy_ndarray, 1, "indexer1", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_searchable), __pyx_ptype_5numpy_ndarray, 1, "searchable", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), (&PyList_Type), 1, "values", 1))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_72create_hdf_rows_3d(__pyx_self, __pyx_v_indexer0, __pyx_v_indexer1, __pyx_v_mask, __pyx_v_searchable, __pyx_v_values);
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     818:

     819: @cython.boundscheck(False)

     820: @cython.wraparound(False)

     821: def create_hdf_rows_3d(ndarray indexer0, ndarray indexer1,

    /* "lib.pyx":821
     * @cython.boundscheck(False)
     * @cython.wraparound(False)
     * def create_hdf_rows_3d(ndarray indexer0, ndarray indexer1,             # <<<<<<<<<<<<<<
     *                        ndarray[np.uint8_t, ndim=2] mask,
     *                        ndarray[np.uint8_t, ndim=1] searchable,
     */

    static PyObject *__pyx_pf_3lib_72create_hdf_rows_3d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_indexer0, PyArrayObject *__pyx_v_indexer1, PyArrayObject *__pyx_v_mask, PyArrayObject *__pyx_v_searchable, PyObject *__pyx_v_values) {
      int __pyx_v_i;
      int __pyx_v_j;
      int __pyx_v_b;
      int __pyx_v_n_indexer0;
      int __pyx_v_n_indexer1;
      int __pyx_v_n_blocks;
      int __pyx_v_tup_size;
      PyObject *__pyx_v_l = 0;
      PyObject *__pyx_v_tup = 0;
      PyObject *__pyx_v_val = 0;
      PyObject *__pyx_v_v = 0;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_mask;
      __Pyx_Buffer __pyx_pybuffer_mask;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_searchable;
      __Pyx_Buffer __pyx_pybuffer_searchable;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("create_hdf_rows_3d", 0);
      __pyx_pybuffer_mask.pybuffer.buf = NULL;
      __pyx_pybuffer_mask.refcount = 0;
      __pyx_pybuffernd_mask.data = NULL;
      __pyx_pybuffernd_mask.rcbuffer = &__pyx_pybuffer_mask;
      __pyx_pybuffer_searchable.pybuffer.buf = NULL;
      __pyx_pybuffer_searchable.refcount = 0;
      __pyx_pybuffernd_searchable.data = NULL;
      __pyx_pybuffernd_searchable.rcbuffer = &__pyx_pybuffer_searchable;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_mask.diminfo[0].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask.diminfo[0].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mask.diminfo[1].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mask.diminfo[1].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[1];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_searchable.rcbuffer->pybuffer, (PyObject*)__pyx_v_searchable, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_searchable.diminfo[0].strides = __pyx_pybuffernd_searchable.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_searchable.diminfo[0].shape = __pyx_pybuffernd_searchable.rcbuffer->pybuffer.shape[0];

      /* "lib.pyx":821
     * @cython.boundscheck(False)
     * @cython.wraparound(False)
     * def create_hdf_rows_3d(ndarray indexer0, ndarray indexer1,             # <<<<<<<<<<<<<<
     *                        ndarray[np.uint8_t, ndim=2] mask,
     *                        ndarray[np.uint8_t, ndim=1] searchable,
     */
      __pyx_k_tuple_167 = PyTuple_New(16); if (unlikely(!__pyx_k_tuple_167)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_167);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer0));
      PyTuple_SET_ITEM(__pyx_k_tuple_167, 0, ((PyObject *)__pyx_n_s__indexer0));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer0));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer1));
      PyTuple_SET_ITEM(__pyx_k_tuple_167, 1, ((PyObject *)__pyx_n_s__indexer1));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer1));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
      PyTuple_SET_ITEM(__pyx_k_tuple_167, 2, ((PyObject *)__pyx_n_s__mask));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__searchable));
      PyTuple_SET_ITEM(__pyx_k_tuple_167, 3, ((PyObject *)__pyx_n_s__searchable));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__searchable));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
      PyTuple_SET_ITEM(__pyx_k_tuple_167, 4, ((PyObject *)__pyx_n_s__values));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_167, 5, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
      PyTuple_SET_ITEM(__pyx_k_tuple_167, 6, ((PyObject *)__pyx_n_s__j));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__b));
      PyTuple_SET_ITEM(__pyx_k_tuple_167, 7, ((PyObject *)__pyx_n_s__b));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n_indexer0));
      PyTuple_SET_ITEM(__pyx_k_tuple_167, 8, ((PyObject *)__pyx_n_s__n_indexer0));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_indexer0));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n_indexer1));
      PyTuple_SET_ITEM(__pyx_k_tuple_167, 9, ((PyObject *)__pyx_n_s__n_indexer1));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_indexer1));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n_blocks));
      PyTuple_SET_ITEM(__pyx_k_tuple_167, 10, ((PyObject *)__pyx_n_s__n_blocks));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_blocks));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__tup_size));
      PyTuple_SET_ITEM(__pyx_k_tuple_167, 11, ((PyObject *)__pyx_n_s__tup_size));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tup_size));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__l));
      PyTuple_SET_ITEM(__pyx_k_tuple_167, 12, ((PyObject *)__pyx_n_s__l));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__tup));
      PyTuple_SET_ITEM(__pyx_k_tuple_167, 13, ((PyObject *)__pyx_n_s__tup));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tup));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
      PyTuple_SET_ITEM(__pyx_k_tuple_167, 14, ((PyObject *)__pyx_n_s__val));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__v));
      PyTuple_SET_ITEM(__pyx_k_tuple_167, 15, ((PyObject *)__pyx_n_s__v));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_167));

      /* "lib.pyx":821
     * @cython.boundscheck(False)
     * @cython.wraparound(False)
     * def create_hdf_rows_3d(ndarray indexer0, ndarray indexer1,             # <<<<<<<<<<<<<<
     *                        ndarray[np.uint8_t, ndim=2] mask,
     *                        ndarray[np.uint8_t, ndim=1] searchable,
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_73create_hdf_rows_3d, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__create_hdf_rows_3d, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_168 = (PyObject*)__Pyx_PyCode_New(5, 0, 16, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_167, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__create_hdf_rows_3d, 821, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_168)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     822:                        ndarray[np.uint8_t, ndim=2] mask,

     823:                        ndarray[np.uint8_t, ndim=1] searchable,

     824:                        list values):

     825:     """ return a list of objects ready to be converted to rec-array format """

     826:

     827:     cdef:

     828:         int i, j, b, n_indexer0, n_indexer1, n_blocks, tup_size

     829:         list l

     830:         object tup, val, v

     831:

     832:     n_indexer0 = indexer0.shape[0]

      /* "lib.pyx":832
     *         object tup, val, v
     *
     *     n_indexer0 = indexer0.shape[0]             # <<<<<<<<<<<<<<
     *     n_indexer1 = indexer1.shape[0]
     *     n_blocks   = len(values)
     */
      __pyx_v_n_indexer0 = (__pyx_v_indexer0->dimensions[0]);

     833:     n_indexer1 = indexer1.shape[0]

      /* "lib.pyx":833
     *
     *     n_indexer0 = indexer0.shape[0]
     *     n_indexer1 = indexer1.shape[0]             # <<<<<<<<<<<<<<
     *     n_blocks   = len(values)
     *     tup_size   = n_blocks+2
     */
      __pyx_v_n_indexer1 = (__pyx_v_indexer1->dimensions[0]);

     834:     n_blocks   = len(values)

      /* "lib.pyx":834
     *     n_indexer0 = indexer0.shape[0]
     *     n_indexer1 = indexer1.shape[0]
     *     n_blocks   = len(values)             # <<<<<<<<<<<<<<
     *     tup_size   = n_blocks+2
     *     l = []
     */
      if (unlikely(((PyObject *)__pyx_v_values) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_1 = PyList_GET_SIZE(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_n_blocks = __pyx_t_1;

     835:     tup_size   = n_blocks+2

      /* "lib.pyx":835
     *     n_indexer1 = indexer1.shape[0]
     *     n_blocks   = len(values)
     *     tup_size   = n_blocks+2             # <<<<<<<<<<<<<<
     *     l = []
     *     for i from 0 <= i < n_indexer0:
     */
      __pyx_v_tup_size = (__pyx_v_n_blocks + 2);

     836:     l = []

      /* "lib.pyx":836
     *     n_blocks   = len(values)
     *     tup_size   = n_blocks+2
     *     l = []             # <<<<<<<<<<<<<<
     *     for i from 0 <= i < n_indexer0:
     *
     */
      __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_l = __pyx_t_2;
      __pyx_t_2 = 0;

     837:     for i from 0 <= i < n_indexer0:

      /* "lib.pyx":837
     *     tup_size   = n_blocks+2
     *     l = []
     *     for i from 0 <= i < n_indexer0:             # <<<<<<<<<<<<<<
     *
     *         for j from 0 <= j < n_indexer1:
     */
      __pyx_t_3 = __pyx_v_n_indexer0;
      for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {

     838:

     839:         for j from 0 <= j < n_indexer1:

        /* "lib.pyx":839
     *     for i from 0 <= i < n_indexer0:
     *
     *         for j from 0 <= j < n_indexer1:             # <<<<<<<<<<<<<<
     *
     *             if not mask[i, j]:
     */
        __pyx_t_4 = __pyx_v_n_indexer1;
        for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_4; __pyx_v_j++) {

     840:

     841:             if not mask[i, j]:

          /* "lib.pyx":841
     *         for j from 0 <= j < n_indexer1:
     *
     *             if not mask[i, j]:             # <<<<<<<<<<<<<<
     *
     *                 tup = PyTuple_New(tup_size)
     */
          __pyx_t_5 = __pyx_v_i;
          __pyx_t_6 = __pyx_v_j;
          __pyx_t_7 = (!(*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_mask.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_mask.diminfo[1].strides)));
          if (__pyx_t_7) {

     842:

     843:                 tup = PyTuple_New(tup_size)

            /* "lib.pyx":843
     *             if not mask[i, j]:
     *
     *                 tup = PyTuple_New(tup_size)             # <<<<<<<<<<<<<<
     *
     *                 val  = indexer0[i]
     */
            __pyx_t_2 = ((PyObject *)PyTuple_New(__pyx_v_tup_size)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_XDECREF(__pyx_v_tup);
            __pyx_v_tup = __pyx_t_2;
            __pyx_t_2 = 0;

     844:

     845:                 val  = indexer0[i]

            /* "lib.pyx":845
     *                 tup = PyTuple_New(tup_size)
     *
     *                 val  = indexer0[i]             # <<<<<<<<<<<<<<
     *                 PyTuple_SET_ITEM(tup, 0, val)
     *                 Py_INCREF(val)
     */
            __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_indexer0), __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_XDECREF(__pyx_v_val);
            __pyx_v_val = __pyx_t_2;
            __pyx_t_2 = 0;

     846:                 PyTuple_SET_ITEM(tup, 0, val)

            /* "lib.pyx":846
     *
     *                 val  = indexer0[i]
     *                 PyTuple_SET_ITEM(tup, 0, val)             # <<<<<<<<<<<<<<
     *                 Py_INCREF(val)
     *
     */
            PyTuple_SET_ITEM(__pyx_v_tup, 0, __pyx_v_val);

     847:                 Py_INCREF(val)

            /* "lib.pyx":847
     *                 val  = indexer0[i]
     *                 PyTuple_SET_ITEM(tup, 0, val)
     *                 Py_INCREF(val)             # <<<<<<<<<<<<<<
     *
     *                 val  = indexer1[j]
     */
            Py_INCREF(__pyx_v_val);

     848:

     849:                 val  = indexer1[j]

            /* "lib.pyx":849
     *                 Py_INCREF(val)
     *
     *                 val  = indexer1[j]             # <<<<<<<<<<<<<<
     *                 PyTuple_SET_ITEM(tup, 1, val)
     *                 Py_INCREF(val)
     */
            __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_indexer1), __pyx_v_j, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_v_val);
            __pyx_v_val = __pyx_t_2;
            __pyx_t_2 = 0;

     850:                 PyTuple_SET_ITEM(tup, 1, val)

            /* "lib.pyx":850
     *
     *                 val  = indexer1[j]
     *                 PyTuple_SET_ITEM(tup, 1, val)             # <<<<<<<<<<<<<<
     *                 Py_INCREF(val)
     *
     */
            PyTuple_SET_ITEM(__pyx_v_tup, 1, __pyx_v_val);

     851:                 Py_INCREF(val)

            /* "lib.pyx":851
     *                 val  = indexer1[j]
     *                 PyTuple_SET_ITEM(tup, 1, val)
     *                 Py_INCREF(val)             # <<<<<<<<<<<<<<
     *
     *                 for b from 0 <= b < n_blocks:
     */
            Py_INCREF(__pyx_v_val);

     852:

     853:                 for b from 0 <= b < n_blocks:

            /* "lib.pyx":853
     *                 Py_INCREF(val)
     *
     *                 for b from 0 <= b < n_blocks:             # <<<<<<<<<<<<<<
     *
     *                     v   = values[b][:, i, j]
     */
            __pyx_t_8 = __pyx_v_n_blocks;
            for (__pyx_v_b = 0; __pyx_v_b < __pyx_t_8; __pyx_v_b++) {

     854:

     855:                     v   = values[b][:, i, j]

              /* "lib.pyx":855
     *                 for b from 0 <= b < n_blocks:
     *
     *                     v   = values[b][:, i, j]             # <<<<<<<<<<<<<<
     *                     if searchable[b]:
     *                         v = v[0]
     */
              if (unlikely(((PyObject *)__pyx_v_values) == Py_None)) {
                PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
                {__pyx_filename = __pyx_f[2]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              }
              __pyx_t_2 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              __Pyx_GOTREF(__pyx_t_2);
              __pyx_t_9 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              __Pyx_GOTREF(__pyx_t_9);
              __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_INCREF(__pyx_k_slice_11);
              PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_k_slice_11);
              __Pyx_GIVEREF(__pyx_k_slice_11);
              PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_2);
              __Pyx_GIVEREF(__pyx_t_2);
              PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_9);
              __Pyx_GIVEREF(__pyx_t_9);
              __pyx_t_2 = 0;
              __pyx_t_9 = 0;
              __pyx_t_9 = PyObject_GetItem(PyList_GET_ITEM(__pyx_v_values, __pyx_v_b), ((PyObject *)__pyx_t_10)); if (!__pyx_t_9) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              __Pyx_GOTREF(__pyx_t_9);
              __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
              __Pyx_XDECREF(__pyx_v_v);
              __pyx_v_v = __pyx_t_9;
              __pyx_t_9 = 0;

      /* "lib.pyx":855
     *                 for b from 0 <= b < n_blocks:
     *
     *                     v   = values[b][:, i, j]             # <<<<<<<<<<<<<<
     *                     if searchable[b]:
     *                         v = v[0]
     */
      __pyx_k_slice_11 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_slice_11);
      __Pyx_GIVEREF(__pyx_k_slice_11);

     856:                     if searchable[b]:

              /* "lib.pyx":856
     *
     *                     v   = values[b][:, i, j]
     *                     if searchable[b]:             # <<<<<<<<<<<<<<
     *                         v = v[0]
     *                     PyTuple_SET_ITEM(tup, b+2, v)
     */
              __pyx_t_11 = __pyx_v_b;
              __pyx_t_12 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_searchable.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_searchable.diminfo[0].strides));
              if (__pyx_t_12) {

     857:                         v = v[0]

                /* "lib.pyx":857
     *                     v   = values[b][:, i, j]
     *                     if searchable[b]:
     *                         v = v[0]             # <<<<<<<<<<<<<<
     *                     PyTuple_SET_ITEM(tup, b+2, v)
     *                     Py_INCREF(v)
     */
                __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_v, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
                __Pyx_GOTREF(__pyx_t_9);
                __Pyx_DECREF(__pyx_v_v);
                __pyx_v_v = __pyx_t_9;
                __pyx_t_9 = 0;
                goto __pyx_L10;
              }
              __pyx_L10:;

     858:                     PyTuple_SET_ITEM(tup, b+2, v)

              /* "lib.pyx":858
     *                     if searchable[b]:
     *                         v = v[0]
     *                     PyTuple_SET_ITEM(tup, b+2, v)             # <<<<<<<<<<<<<<
     *                     Py_INCREF(v)
     *
     */
              PyTuple_SET_ITEM(__pyx_v_tup, (__pyx_v_b + 2), __pyx_v_v);

     859:                     Py_INCREF(v)

              /* "lib.pyx":859
     *                         v = v[0]
     *                     PyTuple_SET_ITEM(tup, b+2, v)
     *                     Py_INCREF(v)             # <<<<<<<<<<<<<<
     *
     *                 l.append(tup)
     */
              Py_INCREF(__pyx_v_v);
            }

     860:

     861:                 l.append(tup)

            /* "lib.pyx":861
     *                     Py_INCREF(v)
     *
     *                 l.append(tup)             # <<<<<<<<<<<<<<
     *
     *     return l
     */
            __pyx_t_13 = PyList_Append(__pyx_v_l, __pyx_v_tup); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            goto __pyx_L7;
          }
          __pyx_L7:;
        }
      }

     862:

     863:     return l

      /* "lib.pyx":863
     *                 l.append(tup)
     *
     *     return l             # <<<<<<<<<<<<<<
     *
     * @cython.boundscheck(False)
     */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_l));
      __pyx_r = ((PyObject *)__pyx_v_l);
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_10);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_searchable.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.create_hdf_rows_3d", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_searchable.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF(__pyx_v_l);
      __Pyx_XDECREF(__pyx_v_tup);
      __Pyx_XDECREF(__pyx_v_val);
      __Pyx_XDECREF(__pyx_v_v);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_75create_hdf_rows_4d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_3lib_74create_hdf_rows_4d[] = " return a list of objects ready to be converted to rec-array format ";
    static PyMethodDef __pyx_mdef_3lib_75create_hdf_rows_4d = {__Pyx_NAMESTR("create_hdf_rows_4d"), (PyCFunction)__pyx_pw_3lib_75create_hdf_rows_4d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3lib_74create_hdf_rows_4d)};
    static PyObject *__pyx_pw_3lib_75create_hdf_rows_4d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyArrayObject *__pyx_v_indexer0 = 0;
      PyArrayObject *__pyx_v_indexer1 = 0;
      PyArrayObject *__pyx_v_indexer2 = 0;
      PyArrayObject *__pyx_v_mask = 0;
      PyArrayObject *__pyx_v_searchable = 0;
      PyObject *__pyx_v_values = 0;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("create_hdf_rows_4d (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__indexer0,&__pyx_n_s__indexer1,&__pyx_n_s__indexer2,&__pyx_n_s__mask,&__pyx_n_s__searchable,&__pyx_n_s__values,0};
        PyObject* values[6] = {0,0,0,0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
            case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indexer0)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            case  1:
            if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indexer1)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("create_hdf_rows_4d", 1, 6, 6, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
            case  2:
            if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indexer2)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("create_hdf_rows_4d", 1, 6, 6, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
            case  3:
            if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("create_hdf_rows_4d", 1, 6, 6, 3); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
            case  4:
            if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__searchable)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("create_hdf_rows_4d", 1, 6, 6, 4); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
            case  5:
            if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("create_hdf_rows_4d", 1, 6, 6, 5); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create_hdf_rows_4d") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
          values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
          values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
          values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
          values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        }
        __pyx_v_indexer0 = ((PyArrayObject *)values[0]);
        __pyx_v_indexer1 = ((PyArrayObject *)values[1]);
        __pyx_v_indexer2 = ((PyArrayObject *)values[2]);
        __pyx_v_mask = ((PyArrayObject *)values[3]);
        __pyx_v_searchable = ((PyArrayObject *)values[4]);
        __pyx_v_values = ((PyObject*)values[5]);
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("create_hdf_rows_4d", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_L3_error:;
      __Pyx_AddTraceback("lib.create_hdf_rows_4d", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indexer0), __pyx_ptype_5numpy_ndarray, 1, "indexer0", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indexer1), __pyx_ptype_5numpy_ndarray, 1, "indexer1", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indexer2), __pyx_ptype_5numpy_ndarray, 1, "indexer2", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_searchable), __pyx_ptype_5numpy_ndarray, 1, "searchable", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), (&PyList_Type), 1, "values", 1))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_74create_hdf_rows_4d(__pyx_self, __pyx_v_indexer0, __pyx_v_indexer1, __pyx_v_indexer2, __pyx_v_mask, __pyx_v_searchable, __pyx_v_values);
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     864:

     865: @cython.boundscheck(False)

     866: @cython.wraparound(False)

     867: def create_hdf_rows_4d(ndarray indexer0, ndarray indexer1, ndarray indexer2,

    /* "lib.pyx":867
     * @cython.boundscheck(False)
     * @cython.wraparound(False)
     * def create_hdf_rows_4d(ndarray indexer0, ndarray indexer1, ndarray indexer2,             # <<<<<<<<<<<<<<
     *                        ndarray[np.uint8_t, ndim=3] mask,
     *                        ndarray[np.uint8_t, ndim=1] searchable,
     */

    static PyObject *__pyx_pf_3lib_74create_hdf_rows_4d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_indexer0, PyArrayObject *__pyx_v_indexer1, PyArrayObject *__pyx_v_indexer2, PyArrayObject *__pyx_v_mask, PyArrayObject *__pyx_v_searchable, PyObject *__pyx_v_values) {
      int __pyx_v_i;
      int __pyx_v_j;
      int __pyx_v_k;
      int __pyx_v_b;
      int __pyx_v_n_indexer0;
      int __pyx_v_n_indexer1;
      int __pyx_v_n_indexer2;
      int __pyx_v_n_blocks;
      int __pyx_v_tup_size;
      PyObject *__pyx_v_l = 0;
      PyObject *__pyx_v_tup = 0;
      PyObject *__pyx_v_val = 0;
      PyObject *__pyx_v_v = 0;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_mask;
      __Pyx_Buffer __pyx_pybuffer_mask;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_searchable;
      __Pyx_Buffer __pyx_pybuffer_searchable;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("create_hdf_rows_4d", 0);
      __pyx_pybuffer_mask.pybuffer.buf = NULL;
      __pyx_pybuffer_mask.refcount = 0;
      __pyx_pybuffernd_mask.data = NULL;
      __pyx_pybuffernd_mask.rcbuffer = &__pyx_pybuffer_mask;
      __pyx_pybuffer_searchable.pybuffer.buf = NULL;
      __pyx_pybuffer_searchable.refcount = 0;
      __pyx_pybuffernd_searchable.data = NULL;
      __pyx_pybuffernd_searchable.rcbuffer = &__pyx_pybuffer_searchable;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_mask.diminfo[0].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask.diminfo[0].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mask.diminfo[1].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mask.diminfo[1].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_mask.diminfo[2].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_mask.diminfo[2].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[2];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_searchable.rcbuffer->pybuffer, (PyObject*)__pyx_v_searchable, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_searchable.diminfo[0].strides = __pyx_pybuffernd_searchable.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_searchable.diminfo[0].shape = __pyx_pybuffernd_searchable.rcbuffer->pybuffer.shape[0];

      /* "lib.pyx":867
     * @cython.boundscheck(False)
     * @cython.wraparound(False)
     * def create_hdf_rows_4d(ndarray indexer0, ndarray indexer1, ndarray indexer2,             # <<<<<<<<<<<<<<
     *                        ndarray[np.uint8_t, ndim=3] mask,
     *                        ndarray[np.uint8_t, ndim=1] searchable,
     */
      __pyx_k_tuple_169 = PyTuple_New(19); if (unlikely(!__pyx_k_tuple_169)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_169);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer0));
      PyTuple_SET_ITEM(__pyx_k_tuple_169, 0, ((PyObject *)__pyx_n_s__indexer0));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer0));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer1));
      PyTuple_SET_ITEM(__pyx_k_tuple_169, 1, ((PyObject *)__pyx_n_s__indexer1));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer1));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer2));
      PyTuple_SET_ITEM(__pyx_k_tuple_169, 2, ((PyObject *)__pyx_n_s__indexer2));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer2));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
      PyTuple_SET_ITEM(__pyx_k_tuple_169, 3, ((PyObject *)__pyx_n_s__mask));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__searchable));
      PyTuple_SET_ITEM(__pyx_k_tuple_169, 4, ((PyObject *)__pyx_n_s__searchable));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__searchable));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
      PyTuple_SET_ITEM(__pyx_k_tuple_169, 5, ((PyObject *)__pyx_n_s__values));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_169, 6, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
      PyTuple_SET_ITEM(__pyx_k_tuple_169, 7, ((PyObject *)__pyx_n_s__j));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
      PyTuple_SET_ITEM(__pyx_k_tuple_169, 8, ((PyObject *)__pyx_n_s__k));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__b));
      PyTuple_SET_ITEM(__pyx_k_tuple_169, 9, ((PyObject *)__pyx_n_s__b));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n_indexer0));
      PyTuple_SET_ITEM(__pyx_k_tuple_169, 10, ((PyObject *)__pyx_n_s__n_indexer0));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_indexer0));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n_indexer1));
      PyTuple_SET_ITEM(__pyx_k_tuple_169, 11, ((PyObject *)__pyx_n_s__n_indexer1));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_indexer1));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n_indexer2));
      PyTuple_SET_ITEM(__pyx_k_tuple_169, 12, ((PyObject *)__pyx_n_s__n_indexer2));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_indexer2));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n_blocks));
      PyTuple_SET_ITEM(__pyx_k_tuple_169, 13, ((PyObject *)__pyx_n_s__n_blocks));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_blocks));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__tup_size));
      PyTuple_SET_ITEM(__pyx_k_tuple_169, 14, ((PyObject *)__pyx_n_s__tup_size));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tup_size));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__l));
      PyTuple_SET_ITEM(__pyx_k_tuple_169, 15, ((PyObject *)__pyx_n_s__l));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__tup));
      PyTuple_SET_ITEM(__pyx_k_tuple_169, 16, ((PyObject *)__pyx_n_s__tup));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tup));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
      PyTuple_SET_ITEM(__pyx_k_tuple_169, 17, ((PyObject *)__pyx_n_s__val));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__v));
      PyTuple_SET_ITEM(__pyx_k_tuple_169, 18, ((PyObject *)__pyx_n_s__v));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_169));

      /* "lib.pyx":867
     * @cython.boundscheck(False)
     * @cython.wraparound(False)
     * def create_hdf_rows_4d(ndarray indexer0, ndarray indexer1, ndarray indexer2,             # <<<<<<<<<<<<<<
     *                        ndarray[np.uint8_t, ndim=3] mask,
     *                        ndarray[np.uint8_t, ndim=1] searchable,
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_75create_hdf_rows_4d, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__create_hdf_rows_4d, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_170 = (PyObject*)__Pyx_PyCode_New(6, 0, 19, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_169, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__create_hdf_rows_4d, 867, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_170)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     868:                        ndarray[np.uint8_t, ndim=3] mask,

     869:                        ndarray[np.uint8_t, ndim=1] searchable,

     870:                        list values):

     871:     """ return a list of objects ready to be converted to rec-array format """

     872:

     873:     cdef:

     874:         int i, j, k, b, n_indexer0, n_indexer1, n_indexer2, n_blocks, tup_size

     875:         list l

     876:         object tup, val, v

     877:

     878:     n_indexer0 = indexer0.shape[0]

      /* "lib.pyx":878
     *         object tup, val, v
     *
     *     n_indexer0 = indexer0.shape[0]             # <<<<<<<<<<<<<<
     *     n_indexer1 = indexer1.shape[0]
     *     n_indexer2 = indexer2.shape[0]
     */
      __pyx_v_n_indexer0 = (__pyx_v_indexer0->dimensions[0]);

     879:     n_indexer1 = indexer1.shape[0]

      /* "lib.pyx":879
     *
     *     n_indexer0 = indexer0.shape[0]
     *     n_indexer1 = indexer1.shape[0]             # <<<<<<<<<<<<<<
     *     n_indexer2 = indexer2.shape[0]
     *     n_blocks   = len(values)
     */
      __pyx_v_n_indexer1 = (__pyx_v_indexer1->dimensions[0]);

     880:     n_indexer2 = indexer2.shape[0]

      /* "lib.pyx":880
     *     n_indexer0 = indexer0.shape[0]
     *     n_indexer1 = indexer1.shape[0]
     *     n_indexer2 = indexer2.shape[0]             # <<<<<<<<<<<<<<
     *     n_blocks   = len(values)
     *     tup_size   = n_blocks+3
     */
      __pyx_v_n_indexer2 = (__pyx_v_indexer2->dimensions[0]);

     881:     n_blocks   = len(values)

      /* "lib.pyx":881
     *     n_indexer1 = indexer1.shape[0]
     *     n_indexer2 = indexer2.shape[0]
     *     n_blocks   = len(values)             # <<<<<<<<<<<<<<
     *     tup_size   = n_blocks+3
     *     l = []
     */
      if (unlikely(((PyObject *)__pyx_v_values) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_1 = PyList_GET_SIZE(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_n_blocks = __pyx_t_1;

     882:     tup_size   = n_blocks+3

      /* "lib.pyx":882
     *     n_indexer2 = indexer2.shape[0]
     *     n_blocks   = len(values)
     *     tup_size   = n_blocks+3             # <<<<<<<<<<<<<<
     *     l = []
     *     for i from 0 <= i < n_indexer0:
     */
      __pyx_v_tup_size = (__pyx_v_n_blocks + 3);

     883:     l = []

      /* "lib.pyx":883
     *     n_blocks   = len(values)
     *     tup_size   = n_blocks+3
     *     l = []             # <<<<<<<<<<<<<<
     *     for i from 0 <= i < n_indexer0:
     *
     */
      __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_l = __pyx_t_2;
      __pyx_t_2 = 0;

     884:     for i from 0 <= i < n_indexer0:

      /* "lib.pyx":884
     *     tup_size   = n_blocks+3
     *     l = []
     *     for i from 0 <= i < n_indexer0:             # <<<<<<<<<<<<<<
     *
     *         for j from 0 <= j < n_indexer1:
     */
      __pyx_t_3 = __pyx_v_n_indexer0;
      for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {

     885:

     886:         for j from 0 <= j < n_indexer1:

        /* "lib.pyx":886
     *     for i from 0 <= i < n_indexer0:
     *
     *         for j from 0 <= j < n_indexer1:             # <<<<<<<<<<<<<<
     *
     *             for k from 0 <= k < n_indexer2:
     */
        __pyx_t_4 = __pyx_v_n_indexer1;
        for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_4; __pyx_v_j++) {

     887:

     888:             for k from 0 <= k < n_indexer2:

          /* "lib.pyx":888
     *         for j from 0 <= j < n_indexer1:
     *
     *             for k from 0 <= k < n_indexer2:             # <<<<<<<<<<<<<<
     *
     *                 if not mask[i, j, k]:
     */
          __pyx_t_5 = __pyx_v_n_indexer2;
          for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_5; __pyx_v_k++) {

     889:

     890:                 if not mask[i, j, k]:

            /* "lib.pyx":890
     *             for k from 0 <= k < n_indexer2:
     *
     *                 if not mask[i, j, k]:             # <<<<<<<<<<<<<<
     *
     *                     tup = PyTuple_New(tup_size)
     */
            __pyx_t_6 = __pyx_v_i;
            __pyx_t_7 = __pyx_v_j;
            __pyx_t_8 = __pyx_v_k;
            __pyx_t_9 = (!(*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_mask.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_mask.diminfo[1].strides, __pyx_t_8, __pyx_pybuffernd_mask.diminfo[2].strides)));
            if (__pyx_t_9) {

     891:

     892:                     tup = PyTuple_New(tup_size)

              /* "lib.pyx":892
     *                 if not mask[i, j, k]:
     *
     *                     tup = PyTuple_New(tup_size)             # <<<<<<<<<<<<<<
     *
     *                     val  = indexer0[i]
     */
              __pyx_t_2 = ((PyObject *)PyTuple_New(__pyx_v_tup_size)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_XDECREF(__pyx_v_tup);
              __pyx_v_tup = __pyx_t_2;
              __pyx_t_2 = 0;

     893:

     894:                     val  = indexer0[i]

              /* "lib.pyx":894
     *                     tup = PyTuple_New(tup_size)
     *
     *                     val  = indexer0[i]             # <<<<<<<<<<<<<<
     *                     PyTuple_SET_ITEM(tup, 0, val)
     *                     Py_INCREF(val)
     */
              __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_indexer0), __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_XDECREF(__pyx_v_val);
              __pyx_v_val = __pyx_t_2;
              __pyx_t_2 = 0;

     895:                     PyTuple_SET_ITEM(tup, 0, val)

              /* "lib.pyx":895
     *
     *                     val  = indexer0[i]
     *                     PyTuple_SET_ITEM(tup, 0, val)             # <<<<<<<<<<<<<<
     *                     Py_INCREF(val)
     *
     */
              PyTuple_SET_ITEM(__pyx_v_tup, 0, __pyx_v_val);

     896:                     Py_INCREF(val)

              /* "lib.pyx":896
     *                     val  = indexer0[i]
     *                     PyTuple_SET_ITEM(tup, 0, val)
     *                     Py_INCREF(val)             # <<<<<<<<<<<<<<
     *
     *                     val  = indexer1[j]
     */
              Py_INCREF(__pyx_v_val);

     897:

     898:                     val  = indexer1[j]

              /* "lib.pyx":898
     *                     Py_INCREF(val)
     *
     *                     val  = indexer1[j]             # <<<<<<<<<<<<<<
     *                     PyTuple_SET_ITEM(tup, 1, val)
     *                     Py_INCREF(val)
     */
              __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_indexer1), __pyx_v_j, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_v_val);
              __pyx_v_val = __pyx_t_2;
              __pyx_t_2 = 0;

     899:                     PyTuple_SET_ITEM(tup, 1, val)

              /* "lib.pyx":899
     *
     *                     val  = indexer1[j]
     *                     PyTuple_SET_ITEM(tup, 1, val)             # <<<<<<<<<<<<<<
     *                     Py_INCREF(val)
     *
     */
              PyTuple_SET_ITEM(__pyx_v_tup, 1, __pyx_v_val);

     900:                     Py_INCREF(val)

              /* "lib.pyx":900
     *                     val  = indexer1[j]
     *                     PyTuple_SET_ITEM(tup, 1, val)
     *                     Py_INCREF(val)             # <<<<<<<<<<<<<<
     *
     *                     val  = indexer2[k]
     */
              Py_INCREF(__pyx_v_val);

     901:

     902:                     val  = indexer2[k]

              /* "lib.pyx":902
     *                     Py_INCREF(val)
     *
     *                     val  = indexer2[k]             # <<<<<<<<<<<<<<
     *                     PyTuple_SET_ITEM(tup, 2, val)
     *                     Py_INCREF(val)
     */
              __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_indexer2), __pyx_v_k, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_v_val);
              __pyx_v_val = __pyx_t_2;
              __pyx_t_2 = 0;

     903:                     PyTuple_SET_ITEM(tup, 2, val)

              /* "lib.pyx":903
     *
     *                     val  = indexer2[k]
     *                     PyTuple_SET_ITEM(tup, 2, val)             # <<<<<<<<<<<<<<
     *                     Py_INCREF(val)
     *
     */
              PyTuple_SET_ITEM(__pyx_v_tup, 2, __pyx_v_val);

     904:                     Py_INCREF(val)

              /* "lib.pyx":904
     *                     val  = indexer2[k]
     *                     PyTuple_SET_ITEM(tup, 2, val)
     *                     Py_INCREF(val)             # <<<<<<<<<<<<<<
     *
     *                     for b from 0 <= b < n_blocks:
     */
              Py_INCREF(__pyx_v_val);

     905:

     906:                     for b from 0 <= b < n_blocks:

              /* "lib.pyx":906
     *                     Py_INCREF(val)
     *
     *                     for b from 0 <= b < n_blocks:             # <<<<<<<<<<<<<<
     *
     *                         v   = values[b][:, i, j, k]
     */
              __pyx_t_10 = __pyx_v_n_blocks;
              for (__pyx_v_b = 0; __pyx_v_b < __pyx_t_10; __pyx_v_b++) {

     907:

     908:                         v   = values[b][:, i, j, k]

                /* "lib.pyx":908
     *                     for b from 0 <= b < n_blocks:
     *
     *                         v   = values[b][:, i, j, k]             # <<<<<<<<<<<<<<
     *                         if searchable[b]:
     *                             v = v[0]
     */
                if (unlikely(((PyObject *)__pyx_v_values) == Py_None)) {
                  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
                  {__pyx_filename = __pyx_f[2]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
                }
                __pyx_t_2 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
                __Pyx_GOTREF(__pyx_t_2);
                __pyx_t_11 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
                __Pyx_GOTREF(__pyx_t_11);
                __pyx_t_12 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
                __Pyx_GOTREF(__pyx_t_12);
                __pyx_t_13 = PyTuple_New(4); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
                __Pyx_GOTREF(__pyx_t_13);
                __Pyx_INCREF(__pyx_k_slice_12);
                PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_k_slice_12);
                __Pyx_GIVEREF(__pyx_k_slice_12);
                PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_2);
                __Pyx_GIVEREF(__pyx_t_2);
                PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_11);
                __Pyx_GIVEREF(__pyx_t_11);
                PyTuple_SET_ITEM(__pyx_t_13, 3, __pyx_t_12);
                __Pyx_GIVEREF(__pyx_t_12);
                __pyx_t_2 = 0;
                __pyx_t_11 = 0;
                __pyx_t_12 = 0;
                __pyx_t_12 = PyObject_GetItem(PyList_GET_ITEM(__pyx_v_values, __pyx_v_b), ((PyObject *)__pyx_t_13)); if (!__pyx_t_12) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
                __Pyx_GOTREF(__pyx_t_12);
                __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
                __Pyx_XDECREF(__pyx_v_v);
                __pyx_v_v = __pyx_t_12;
                __pyx_t_12 = 0;

      /* "lib.pyx":908
     *                     for b from 0 <= b < n_blocks:
     *
     *                         v   = values[b][:, i, j, k]             # <<<<<<<<<<<<<<
     *                         if searchable[b]:
     *                             v = v[0]
     */
      __pyx_k_slice_12 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_slice_12);
      __Pyx_GIVEREF(__pyx_k_slice_12);

     909:                         if searchable[b]:

                /* "lib.pyx":909
     *
     *                         v   = values[b][:, i, j, k]
     *                         if searchable[b]:             # <<<<<<<<<<<<<<
     *                             v = v[0]
     *                         PyTuple_SET_ITEM(tup, b+3, v)
     */
                __pyx_t_14 = __pyx_v_b;
                __pyx_t_15 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_searchable.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_searchable.diminfo[0].strides));
                if (__pyx_t_15) {

     910:                             v = v[0]

                  /* "lib.pyx":910
     *                         v   = values[b][:, i, j, k]
     *                         if searchable[b]:
     *                             v = v[0]             # <<<<<<<<<<<<<<
     *                         PyTuple_SET_ITEM(tup, b+3, v)
     *                         Py_INCREF(v)
     */
                  __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_v, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_12) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
                  __Pyx_GOTREF(__pyx_t_12);
                  __Pyx_DECREF(__pyx_v_v);
                  __pyx_v_v = __pyx_t_12;
                  __pyx_t_12 = 0;
                  goto __pyx_L12;
                }
                __pyx_L12:;

     911:                         PyTuple_SET_ITEM(tup, b+3, v)

                /* "lib.pyx":911
     *                         if searchable[b]:
     *                             v = v[0]
     *                         PyTuple_SET_ITEM(tup, b+3, v)             # <<<<<<<<<<<<<<
     *                         Py_INCREF(v)
     *
     */
                PyTuple_SET_ITEM(__pyx_v_tup, (__pyx_v_b + 3), __pyx_v_v);

     912:                         Py_INCREF(v)

                /* "lib.pyx":912
     *                             v = v[0]
     *                         PyTuple_SET_ITEM(tup, b+3, v)
     *                         Py_INCREF(v)             # <<<<<<<<<<<<<<
     *
     *                     l.append(tup)
     */
                Py_INCREF(__pyx_v_v);
              }

     913:

     914:                     l.append(tup)

              /* "lib.pyx":914
     *                         Py_INCREF(v)
     *
     *                     l.append(tup)             # <<<<<<<<<<<<<<
     *
     *     return l
     */
              __pyx_t_16 = PyList_Append(__pyx_v_l, __pyx_v_tup); if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              goto __pyx_L9;
            }
            __pyx_L9:;
          }
        }
      }

     915:

     916:     return l

      /* "lib.pyx":916
     *                     l.append(tup)
     *
     *     return l             # <<<<<<<<<<<<<<
     *
     * #-------------------------------------------------------------------------------
     */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_l));
      __pyx_r = ((PyObject *)__pyx_v_l);
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_11);
      __Pyx_XDECREF(__pyx_t_12);
      __Pyx_XDECREF(__pyx_t_13);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_searchable.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.create_hdf_rows_4d", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_searchable.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF(__pyx_v_l);
      __Pyx_XDECREF(__pyx_v_tup);
      __Pyx_XDECREF(__pyx_v_val);
      __Pyx_XDECREF(__pyx_v_v);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_77arrmap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_77arrmap = {__Pyx_NAMESTR("arrmap"), (PyCFunction)__pyx_pw_3lib_77arrmap, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_77arrmap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyArrayObject *__pyx_v_index = 0;
      PyObject *__pyx_v_func = 0;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("arrmap (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__index,&__pyx_n_s__func,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            case  1:
            if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__func)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("arrmap", 1, 2, 2, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "arrmap") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        }
        __pyx_v_index = ((PyArrayObject *)values[0]);
        __pyx_v_func = values[1];
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("arrmap", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_L3_error:;
      __Pyx_AddTraceback("lib.arrmap", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_5numpy_ndarray, 1, "index", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_76arrmap(__pyx_self, __pyx_v_index, __pyx_v_func);
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     917:

     918: #-------------------------------------------------------------------------------

     919: # Groupby-related functions

     920:

     921: @cython.boundscheck(False)

     922: def arrmap(ndarray[object] index, object func):

    /* "lib.pyx":922
     *
     * @cython.boundscheck(False)
     * def arrmap(ndarray[object] index, object func):             # <<<<<<<<<<<<<<
     *     cdef int length = index.shape[0]
     *     cdef int i = 0
     */

    static PyObject *__pyx_pf_3lib_76arrmap(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_index, PyObject *__pyx_v_func) {
      int __pyx_v_length;
      int __pyx_v_i;
      PyArrayObject *__pyx_v_result = 0;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_index;
      __Pyx_Buffer __pyx_pybuffer_index;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
      __Pyx_Buffer __pyx_pybuffer_result;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("arrmap", 0);
      __pyx_pybuffer_result.pybuffer.buf = NULL;
      __pyx_pybuffer_result.refcount = 0;
      __pyx_pybuffernd_result.data = NULL;
      __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
      __pyx_pybuffer_index.pybuffer.buf = NULL;
      __pyx_pybuffer_index.refcount = 0;
      __pyx_pybuffernd_index.data = NULL;
      __pyx_pybuffernd_index.rcbuffer = &__pyx_pybuffer_index;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_index.rcbuffer->pybuffer, (PyObject*)__pyx_v_index, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_index.diminfo[0].strides = __pyx_pybuffernd_index.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_index.diminfo[0].shape = __pyx_pybuffernd_index.rcbuffer->pybuffer.shape[0];

      /* "lib.pyx":922
     *
     * @cython.boundscheck(False)
     * def arrmap(ndarray[object] index, object func):             # <<<<<<<<<<<<<<
     *     cdef int length = index.shape[0]
     *     cdef int i = 0
     */
      __pyx_k_tuple_171 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_171)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_171);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__index));
      PyTuple_SET_ITEM(__pyx_k_tuple_171, 0, ((PyObject *)__pyx_n_s__index));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__index));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__func));
      PyTuple_SET_ITEM(__pyx_k_tuple_171, 1, ((PyObject *)__pyx_n_s__func));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__func));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__length));
      PyTuple_SET_ITEM(__pyx_k_tuple_171, 2, ((PyObject *)__pyx_n_s__length));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__length));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_171, 3, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
      PyTuple_SET_ITEM(__pyx_k_tuple_171, 4, ((PyObject *)__pyx_n_s__result));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_171));

      /* "lib.pyx":922
     *
     * @cython.boundscheck(False)
     * def arrmap(ndarray[object] index, object func):             # <<<<<<<<<<<<<<
     *     cdef int length = index.shape[0]
     *     cdef int i = 0
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_77arrmap, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__arrmap, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_172 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_171, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__arrmap, 922, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_172)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     923:     cdef int length = index.shape[0]

      /* "lib.pyx":923
     * @cython.boundscheck(False)
     * def arrmap(ndarray[object] index, object func):
     *     cdef int length = index.shape[0]             # <<<<<<<<<<<<<<
     *     cdef int i = 0
     *
     */
      __pyx_v_length = (__pyx_v_index->dimensions[0]);

     924:     cdef int i = 0

      /* "lib.pyx":924
     * def arrmap(ndarray[object] index, object func):
     *     cdef int length = index.shape[0]
     *     cdef int i = 0             # <<<<<<<<<<<<<<
     *
     *     cdef ndarray[object] result = np.empty(length, dtype=np.object_)
     */
      __pyx_v_i = 0;

     925:

     926:     cdef ndarray[object] result = np.empty(length, dtype=np.object_)

      /* "lib.pyx":926
     *     cdef int i = 0
     *
     *     cdef ndarray[object] result = np.empty(length, dtype=np.object_)             # <<<<<<<<<<<<<<
     *
     *     for i from 0 <= i < length:
     */
      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyInt_FromLong(__pyx_v_length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__object_); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
          __pyx_v_result = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_result.rcbuffer->pybuffer.buf = NULL;
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        } else {__pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0];
        }
      }
      __pyx_t_6 = 0;
      __pyx_v_result = ((PyArrayObject *)__pyx_t_5);
      __pyx_t_5 = 0;

     927:

     928:     for i from 0 <= i < length:

      /* "lib.pyx":928
     *     cdef ndarray[object] result = np.empty(length, dtype=np.object_)
     *
     *     for i from 0 <= i < length:             # <<<<<<<<<<<<<<
     *         result[i] = func(index[i])
     *
     */
      __pyx_t_7 = __pyx_v_length;
      for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) {

     929:         result[i] = func(index[i])

        /* "lib.pyx":929
     *
     *     for i from 0 <= i < length:
     *         result[i] = func(index[i])             # <<<<<<<<<<<<<<
     *
     *     return result
     */
        __pyx_t_8 = __pyx_v_i;
        if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_pybuffernd_index.diminfo[0].shape;
        __pyx_t_5 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_index.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_index.diminfo[0].strides);
        __Pyx_INCREF((PyObject*)__pyx_t_5);
        __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_5);
        __pyx_t_5 = 0;
        __pyx_t_5 = PyObject_Call(__pyx_v_func, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
        __pyx_t_9 = __pyx_v_i;
        if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_pybuffernd_result.diminfo[0].shape;
        __pyx_t_10 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_result.diminfo[0].strides);
        __Pyx_GOTREF(*__pyx_t_10);
        __Pyx_INCREF(__pyx_t_5); __Pyx_DECREF(*__pyx_t_10);
        *__pyx_t_10 = __pyx_t_5;
        __Pyx_GIVEREF(*__pyx_t_10);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }

     930:

     931:     return result

      /* "lib.pyx":931
     *         result[i] = func(index[i])
     *
     *     return result             # <<<<<<<<<<<<<<
     *
     * @cython.wraparound(False)
     */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_result));
      __pyx_r = ((PyObject *)__pyx_v_result);
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.arrmap", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF((PyObject *)__pyx_v_result);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_79is_lexsorted(PyObject *__pyx_self, PyObject *__pyx_v_list_of_arrays); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_79is_lexsorted = {__Pyx_NAMESTR("is_lexsorted"), (PyCFunction)__pyx_pw_3lib_79is_lexsorted, METH_O, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_79is_lexsorted(PyObject *__pyx_self, PyObject *__pyx_v_list_of_arrays) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("is_lexsorted (wrapper)", 0);
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_list_of_arrays), (&PyList_Type), 1, "list_of_arrays", 1))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_78is_lexsorted(__pyx_self, ((PyObject*)__pyx_v_list_of_arrays));
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     932:

     933: @cython.wraparound(False)

     934: @cython.boundscheck(False)

     935: def is_lexsorted(list list_of_arrays):

    /* "lib.pyx":935
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def is_lexsorted(list list_of_arrays):             # <<<<<<<<<<<<<<
     *     cdef:
     *         int i
     */

    static PyObject *__pyx_pf_3lib_78is_lexsorted(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_list_of_arrays) {
      int __pyx_v_i;
      Py_ssize_t __pyx_v_n;
      Py_ssize_t __pyx_v_nlevels;
      __pyx_t_5numpy_int64_t __pyx_v_k;
      __pyx_t_5numpy_int64_t __pyx_v_cur;
      __pyx_t_5numpy_int64_t __pyx_v_pre;
      PyArrayObject *__pyx_v_arr = 0;
      __pyx_t_5numpy_int64_t **__pyx_v_vecs;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("is_lexsorted", 0);

      /* "lib.pyx":935
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def is_lexsorted(list list_of_arrays):             # <<<<<<<<<<<<<<
     *     cdef:
     *         int i
     */
      __pyx_k_tuple_173 = PyTuple_New(9); if (unlikely(!__pyx_k_tuple_173)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_173);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__list_of_arrays));
      PyTuple_SET_ITEM(__pyx_k_tuple_173, 0, ((PyObject *)__pyx_n_s__list_of_arrays));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__list_of_arrays));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_173, 1, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_173, 2, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__nlevels));
      PyTuple_SET_ITEM(__pyx_k_tuple_173, 3, ((PyObject *)__pyx_n_s__nlevels));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nlevels));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
      PyTuple_SET_ITEM(__pyx_k_tuple_173, 4, ((PyObject *)__pyx_n_s__k));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__cur));
      PyTuple_SET_ITEM(__pyx_k_tuple_173, 5, ((PyObject *)__pyx_n_s__cur));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cur));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__pre));
      PyTuple_SET_ITEM(__pyx_k_tuple_173, 6, ((PyObject *)__pyx_n_s__pre));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pre));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__arr));
      PyTuple_SET_ITEM(__pyx_k_tuple_173, 7, ((PyObject *)__pyx_n_s__arr));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__arr));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__vecs));
      PyTuple_SET_ITEM(__pyx_k_tuple_173, 8, ((PyObject *)__pyx_n_s__vecs));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__vecs));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_173));

      /* "lib.pyx":935
     * @cython.wraparound(False)
     * @cython.boundscheck(False)
     * def is_lexsorted(list list_of_arrays):             # <<<<<<<<<<<<<<
     *     cdef:
     *         int i
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_79is_lexsorted, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__is_lexsorted, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_174 = (PyObject*)__Pyx_PyCode_New(1, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_173, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__is_lexsorted, 935, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_174)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     936:     cdef:

     937:         int i

     938:         Py_ssize_t n, nlevels

     939:         int64_t k, cur, pre

     940:         ndarray arr

     941:

     942:     nlevels = len(list_of_arrays)

      /* "lib.pyx":942
     *         ndarray arr
     *
     *     nlevels = len(list_of_arrays)             # <<<<<<<<<<<<<<
     *     n = len(list_of_arrays[0])
     *
     */
      if (unlikely(((PyObject *)__pyx_v_list_of_arrays) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_1 = PyList_GET_SIZE(((PyObject *)__pyx_v_list_of_arrays)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_nlevels = __pyx_t_1;

     943:     n = len(list_of_arrays[0])

      /* "lib.pyx":943
     *
     *     nlevels = len(list_of_arrays)
     *     n = len(list_of_arrays[0])             # <<<<<<<<<<<<<<
     *
     *     cdef int64_t **vecs = <int64_t**> malloc(nlevels * sizeof(int64_t*))
     */
      if (unlikely(((PyObject *)__pyx_v_list_of_arrays) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_2 = PyList_GET_ITEM(__pyx_v_list_of_arrays, 0);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_n = __pyx_t_1;

     944:

     945:     cdef int64_t **vecs = <int64_t**> malloc(nlevels * sizeof(int64_t*))

      /* "lib.pyx":945
     *     n = len(list_of_arrays[0])
     *
     *     cdef int64_t **vecs = <int64_t**> malloc(nlevels * sizeof(int64_t*))             # <<<<<<<<<<<<<<
     *     for i from 0 <= i < nlevels:
     *         # vecs[i] = <int64_t *> (<ndarray> list_of_arrays[i]).data
     */
      __pyx_v_vecs = ((__pyx_t_5numpy_int64_t **)malloc((__pyx_v_nlevels * (sizeof(__pyx_t_5numpy_int64_t *)))));

     946:     for i from 0 <= i < nlevels:

      /* "lib.pyx":946
     *
     *     cdef int64_t **vecs = <int64_t**> malloc(nlevels * sizeof(int64_t*))
     *     for i from 0 <= i < nlevels:             # <<<<<<<<<<<<<<
     *         # vecs[i] = <int64_t *> (<ndarray> list_of_arrays[i]).data
     *
     */
      __pyx_t_1 = __pyx_v_nlevels;
      for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) {

     947:         # vecs[i] = <int64_t *> (<ndarray> list_of_arrays[i]).data

     948:

     949:         arr = list_of_arrays[i]

        /* "lib.pyx":949
     *         # vecs[i] = <int64_t *> (<ndarray> list_of_arrays[i]).data
     *
     *         arr = list_of_arrays[i]             # <<<<<<<<<<<<<<
     *         vecs[i] = <int64_t *> arr.data
     *     # assume uniqueness??
     */
        if (unlikely(((PyObject *)__pyx_v_list_of_arrays) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        if (!(likely(((PyList_GET_ITEM(__pyx_v_list_of_arrays, __pyx_v_i)) == Py_None) || likely(__Pyx_TypeTest(PyList_GET_ITEM(__pyx_v_list_of_arrays, __pyx_v_i), __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_2 = PyList_GET_ITEM(__pyx_v_list_of_arrays, __pyx_v_i);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_XDECREF(((PyObject *)__pyx_v_arr));
        __pyx_v_arr = ((PyArrayObject *)__pyx_t_2);
        __pyx_t_2 = 0;

     950:         vecs[i] = <int64_t *> arr.data

        /* "lib.pyx":950
     *
     *         arr = list_of_arrays[i]
     *         vecs[i] = <int64_t *> arr.data             # <<<<<<<<<<<<<<
     *     # assume uniqueness??
     *
     */
        (__pyx_v_vecs[__pyx_v_i]) = ((__pyx_t_5numpy_int64_t *)__pyx_v_arr->data);
      }

     951:     # assume uniqueness??

     952:

     953:     for i from 1 <= i < n:

      /* "lib.pyx":953
     *     # assume uniqueness??
     *
     *     for i from 1 <= i < n:             # <<<<<<<<<<<<<<
     *         for k from 0 <= k < nlevels:
     *             cur = vecs[k][i]
     */
      __pyx_t_1 = __pyx_v_n;
      for (__pyx_v_i = 1; __pyx_v_i < __pyx_t_1; __pyx_v_i++) {

     954:         for k from 0 <= k < nlevels:

        /* "lib.pyx":954
     *
     *     for i from 1 <= i < n:
     *         for k from 0 <= k < nlevels:             # <<<<<<<<<<<<<<
     *             cur = vecs[k][i]
     *             pre = vecs[k][i-1]
     */
        __pyx_t_3 = __pyx_v_nlevels;
        for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_3; __pyx_v_k++) {

     955:             cur = vecs[k][i]

          /* "lib.pyx":955
     *     for i from 1 <= i < n:
     *         for k from 0 <= k < nlevels:
     *             cur = vecs[k][i]             # <<<<<<<<<<<<<<
     *             pre = vecs[k][i-1]
     *             if cur == pre:
     */
          __pyx_v_cur = ((__pyx_v_vecs[__pyx_v_k])[__pyx_v_i]);

     956:             pre = vecs[k][i-1]

          /* "lib.pyx":956
     *         for k from 0 <= k < nlevels:
     *             cur = vecs[k][i]
     *             pre = vecs[k][i-1]             # <<<<<<<<<<<<<<
     *             if cur == pre:
     *                 continue
     */
          __pyx_v_pre = ((__pyx_v_vecs[__pyx_v_k])[(__pyx_v_i - 1)]);

     957:             if cur == pre:

          /* "lib.pyx":957
     *             cur = vecs[k][i]
     *             pre = vecs[k][i-1]
     *             if cur == pre:             # <<<<<<<<<<<<<<
     *                 continue
     *             elif cur > pre:
     */
          __pyx_t_4 = (__pyx_v_cur == __pyx_v_pre);
          if (__pyx_t_4) {

     958:                 continue

            /* "lib.pyx":958
     *             pre = vecs[k][i-1]
     *             if cur == pre:
     *                 continue             # <<<<<<<<<<<<<<
     *             elif cur > pre:
     *                 break
     */
            goto __pyx_L7_continue;
            goto __pyx_L9;
          }

     959:             elif cur > pre:

          /* "lib.pyx":959
     *             if cur == pre:
     *                 continue
     *             elif cur > pre:             # <<<<<<<<<<<<<<
     *                 break
     *             else:
     */
          __pyx_t_4 = (__pyx_v_cur > __pyx_v_pre);
          if (__pyx_t_4) {

     960:                 break

            /* "lib.pyx":960
     *                 continue
     *             elif cur > pre:
     *                 break             # <<<<<<<<<<<<<<
     *             else:
     *                 return False
     */
            goto __pyx_L8_break;
            goto __pyx_L9;
          }
          /*else*/ {

     961:             else:

     962:                 return False

            /* "lib.pyx":962
     *                 break
     *             else:
     *                 return False             # <<<<<<<<<<<<<<
     *     free(vecs)
     *     return True
     */
            __Pyx_XDECREF(__pyx_r);
            __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_2);
            __pyx_r = __pyx_t_2;
            __pyx_t_2 = 0;
            goto __pyx_L0;
          }
          __pyx_L9:;
          __pyx_L7_continue:;
        }
        __pyx_L8_break:;
      }

     963:     free(vecs)

      /* "lib.pyx":963
     *             else:
     *                 return False
     *     free(vecs)             # <<<<<<<<<<<<<<
     *     return True
     *
     */
      free(__pyx_v_vecs);

     964:     return True

      /* "lib.pyx":964
     *                 return False
     *     free(vecs)
     *     return True             # <<<<<<<<<<<<<<
     *
     *
     */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("lib.is_lexsorted", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XDECREF((PyObject *)__pyx_v_arr);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_81generate_bins_dt64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_3lib_80generate_bins_dt64[] = "\n    Int64 (datetime64) version of generic python version in groupby.py\n    ";
    static PyMethodDef __pyx_mdef_3lib_81generate_bins_dt64 = {__Pyx_NAMESTR("generate_bins_dt64"), (PyCFunction)__pyx_pw_3lib_81generate_bins_dt64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3lib_80generate_bins_dt64)};
    static PyObject *__pyx_pw_3lib_81generate_bins_dt64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyArrayObject *__pyx_v_values = 0;
      PyArrayObject *__pyx_v_binner = 0;
      PyObject *__pyx_v_closed = 0;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("generate_bins_dt64 (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__binner,&__pyx_n_s__closed,0};
        PyObject* values[3] = {0,0,0};
        values[2] = ((PyObject *)__pyx_n_s__left);
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            case  1:
            if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__binner)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("generate_bins_dt64", 0, 2, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
            case  2:
            if (kw_args > 0) {
              PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__closed);
              if (value) { values[2] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "generate_bins_dt64") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_values = ((PyArrayObject *)values[0]);
        __pyx_v_binner = ((PyArrayObject *)values[1]);
        __pyx_v_closed = values[2];
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("generate_bins_dt64", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_L3_error:;
      __Pyx_AddTraceback("lib.generate_bins_dt64", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_binner), __pyx_ptype_5numpy_ndarray, 1, "binner", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_80generate_bins_dt64(__pyx_self, __pyx_v_values, __pyx_v_binner, __pyx_v_closed);
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     965:

     966:

     967:

     968: # TODO: could do even better if we know something about the data. eg, index has

     969: # 1-min data, binner has 5-min data, then  bins are just strides in index. This

     970: # is a general, O(max(len(values), len(binner))) method.

     971:

     972: @cython.boundscheck(False)

     973: @cython.wraparound(False)

     974: def generate_bins_dt64(ndarray[int64_t] values, ndarray[int64_t] binner,

    /* "lib.pyx":974
     * @cython.boundscheck(False)
     * @cython.wraparound(False)
     * def generate_bins_dt64(ndarray[int64_t] values, ndarray[int64_t] binner,             # <<<<<<<<<<<<<<
     *                        object closed='left'):
     *     """
     */

    static PyObject *__pyx_pf_3lib_80generate_bins_dt64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_binner, PyObject *__pyx_v_closed) {
      Py_ssize_t __pyx_v_lenidx;
      Py_ssize_t __pyx_v_lenbin;
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_j;
      Py_ssize_t __pyx_v_bc;
      PyArrayObject *__pyx_v_bins = 0;
      CYTHON_UNUSED __pyx_t_5numpy_int64_t __pyx_v_l_bin;
      __pyx_t_5numpy_int64_t __pyx_v_r_bin;
      int __pyx_v_right_closed;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_binner;
      __Pyx_Buffer __pyx_pybuffer_binner;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_bins;
      __Pyx_Buffer __pyx_pybuffer_bins;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
      __Pyx_Buffer __pyx_pybuffer_values;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("generate_bins_dt64", 0);
      __pyx_pybuffer_bins.pybuffer.buf = NULL;
      __pyx_pybuffer_bins.refcount = 0;
      __pyx_pybuffernd_bins.data = NULL;
      __pyx_pybuffernd_bins.rcbuffer = &__pyx_pybuffer_bins;
      __pyx_pybuffer_values.pybuffer.buf = NULL;
      __pyx_pybuffer_values.refcount = 0;
      __pyx_pybuffernd_values.data = NULL;
      __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
      __pyx_pybuffer_binner.pybuffer.buf = NULL;
      __pyx_pybuffer_binner.refcount = 0;
      __pyx_pybuffernd_binner.data = NULL;
      __pyx_pybuffernd_binner.rcbuffer = &__pyx_pybuffer_binner;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_binner.rcbuffer->pybuffer, (PyObject*)__pyx_v_binner, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_binner.diminfo[0].strides = __pyx_pybuffernd_binner.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_binner.diminfo[0].shape = __pyx_pybuffernd_binner.rcbuffer->pybuffer.shape[0];

      /* "lib.pyx":974
     * @cython.boundscheck(False)
     * @cython.wraparound(False)
     * def generate_bins_dt64(ndarray[int64_t] values, ndarray[int64_t] binner,             # <<<<<<<<<<<<<<
     *                        object closed='left'):
     *     """
     */
      __pyx_k_tuple_175 = PyTuple_New(13); if (unlikely(!__pyx_k_tuple_175)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_175);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
      PyTuple_SET_ITEM(__pyx_k_tuple_175, 0, ((PyObject *)__pyx_n_s__values));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__binner));
      PyTuple_SET_ITEM(__pyx_k_tuple_175, 1, ((PyObject *)__pyx_n_s__binner));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__binner));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__closed));
      PyTuple_SET_ITEM(__pyx_k_tuple_175, 2, ((PyObject *)__pyx_n_s__closed));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__closed));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__lenidx));
      PyTuple_SET_ITEM(__pyx_k_tuple_175, 3, ((PyObject *)__pyx_n_s__lenidx));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lenidx));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__lenbin));
      PyTuple_SET_ITEM(__pyx_k_tuple_175, 4, ((PyObject *)__pyx_n_s__lenbin));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lenbin));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_175, 5, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
      PyTuple_SET_ITEM(__pyx_k_tuple_175, 6, ((PyObject *)__pyx_n_s__j));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__bc));
      PyTuple_SET_ITEM(__pyx_k_tuple_175, 7, ((PyObject *)__pyx_n_s__bc));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bc));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__vc));
      PyTuple_SET_ITEM(__pyx_k_tuple_175, 8, ((PyObject *)__pyx_n_s__vc));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__vc));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__bins));
      PyTuple_SET_ITEM(__pyx_k_tuple_175, 9, ((PyObject *)__pyx_n_s__bins));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__l_bin));
      PyTuple_SET_ITEM(__pyx_k_tuple_175, 10, ((PyObject *)__pyx_n_s__l_bin));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l_bin));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__r_bin));
      PyTuple_SET_ITEM(__pyx_k_tuple_175, 11, ((PyObject *)__pyx_n_s__r_bin));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__r_bin));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__right_closed));
      PyTuple_SET_ITEM(__pyx_k_tuple_175, 12, ((PyObject *)__pyx_n_s__right_closed));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right_closed));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_175));

      /* "lib.pyx":974
     * @cython.boundscheck(False)
     * @cython.wraparound(False)
     * def generate_bins_dt64(ndarray[int64_t] values, ndarray[int64_t] binner,             # <<<<<<<<<<<<<<
     *                        object closed='left'):
     *     """
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_81generate_bins_dt64, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__generate_bins_dt64, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_176 = (PyObject*)__Pyx_PyCode_New(3, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_175, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__generate_bins_dt64, 974, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_176)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     975:                        object closed='left'):

     976:     """

     977:     Int64 (datetime64) version of generic python version in groupby.py

     978:     """

     979:     cdef:

     980:         Py_ssize_t lenidx, lenbin, i, j, bc, vc

     981:         ndarray[int64_t] bins

     982:         int64_t l_bin, r_bin

     983:         bint right_closed = closed == 'right'

      /* "lib.pyx":983
     *         ndarray[int64_t] bins
     *         int64_t l_bin, r_bin
     *         bint right_closed = closed == 'right'             # <<<<<<<<<<<<<<
     *
     *     lenidx = len(values)
     */
      __pyx_t_1 = PyObject_RichCompare(__pyx_v_closed, ((PyObject *)__pyx_n_s__right), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_right_closed = __pyx_t_2;

     984:

     985:     lenidx = len(values)

      /* "lib.pyx":985
     *         bint right_closed = closed == 'right'
     *
     *     lenidx = len(values)             # <<<<<<<<<<<<<<
     *     lenbin = len(binner)
     *
     */
      __pyx_t_3 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_lenidx = __pyx_t_3;

     986:     lenbin = len(binner)

      /* "lib.pyx":986
     *
     *     lenidx = len(values)
     *     lenbin = len(binner)             # <<<<<<<<<<<<<<
     *
     *     if lenidx <= 0 or lenbin <= 0:
     */
      __pyx_t_3 = PyObject_Length(((PyObject *)__pyx_v_binner)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_lenbin = __pyx_t_3;

     987:

     988:     if lenidx <= 0 or lenbin <= 0:

      /* "lib.pyx":988
     *     lenbin = len(binner)
     *
     *     if lenidx <= 0 or lenbin <= 0:             # <<<<<<<<<<<<<<
     *         raise ValueError("Invalid length for values or for binner")
     *
     */
      __pyx_t_2 = (__pyx_v_lenidx <= 0);
      if (!__pyx_t_2) {
        __pyx_t_4 = (__pyx_v_lenbin <= 0);
        __pyx_t_5 = __pyx_t_4;
      } else {
        __pyx_t_5 = __pyx_t_2;
      }
      if (__pyx_t_5) {

     989:         raise ValueError("Invalid length for values or for binner")

        /* "lib.pyx":989
     *
     *     if lenidx <= 0 or lenbin <= 0:
     *         raise ValueError("Invalid length for values or for binner")             # <<<<<<<<<<<<<<
     *
     *     # check binner fits data
     */
        __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_Raise(__pyx_t_1, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L3;
      }
      __pyx_L3:;

      /* "lib.pyx":989
     *
     *     if lenidx <= 0 or lenbin <= 0:
     *         raise ValueError("Invalid length for values or for binner")             # <<<<<<<<<<<<<<
     *
     *     # check binner fits data
     */
      __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_14);
      __Pyx_INCREF(((PyObject *)__pyx_kp_s_13));
      PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_s_13));
      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_13));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14));

     990:

     991:     # check binner fits data

     992:     if values[0] < binner[0]:

      /* "lib.pyx":992
     *
     *     # check binner fits data
     *     if values[0] < binner[0]:             # <<<<<<<<<<<<<<
     *         raise ValueError("Values falls before first bin")
     *
     */
      __pyx_t_6 = 0;
      __pyx_t_7 = 0;
      __pyx_t_5 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_values.diminfo[0].strides)) < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_binner.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_binner.diminfo[0].strides)));
      if (__pyx_t_5) {

     993:         raise ValueError("Values falls before first bin")

        /* "lib.pyx":993
     *     # check binner fits data
     *     if values[0] < binner[0]:
     *         raise ValueError("Values falls before first bin")             # <<<<<<<<<<<<<<
     *
     *     if values[lenidx-1] > binner[lenbin-1]:
     */
        __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_Raise(__pyx_t_1, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L4;
      }
      __pyx_L4:;

      /* "lib.pyx":993
     *     # check binner fits data
     *     if values[0] < binner[0]:
     *         raise ValueError("Values falls before first bin")             # <<<<<<<<<<<<<<
     *
     *     if values[lenidx-1] > binner[lenbin-1]:
     */
      __pyx_k_tuple_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_16);
      __Pyx_INCREF(((PyObject *)__pyx_kp_s_15));
      PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, ((PyObject *)__pyx_kp_s_15));
      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_15));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16));

     994:

     995:     if values[lenidx-1] > binner[lenbin-1]:

      /* "lib.pyx":995
     *         raise ValueError("Values falls before first bin")
     *
     *     if values[lenidx-1] > binner[lenbin-1]:             # <<<<<<<<<<<<<<
     *         raise ValueError("Values falls after last bin")
     *
     */
      __pyx_t_3 = (__pyx_v_lenidx - 1);
      __pyx_t_8 = (__pyx_v_lenbin - 1);
      __pyx_t_5 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_values.diminfo[0].strides)) > (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_binner.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_binner.diminfo[0].strides)));
      if (__pyx_t_5) {

     996:         raise ValueError("Values falls after last bin")

        /* "lib.pyx":996
     *
     *     if values[lenidx-1] > binner[lenbin-1]:
     *         raise ValueError("Values falls after last bin")             # <<<<<<<<<<<<<<
     *
     *     bins   = np.empty(lenbin - 1, dtype=np.int64)
     */
        __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_Raise(__pyx_t_1, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L5;
      }
      __pyx_L5:;

      /* "lib.pyx":996
     *
     *     if values[lenidx-1] > binner[lenbin-1]:
     *         raise ValueError("Values falls after last bin")             # <<<<<<<<<<<<<<
     *
     *     bins   = np.empty(lenbin - 1, dtype=np.int64)
     */
      __pyx_k_tuple_18 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_18);
      __Pyx_INCREF(((PyObject *)__pyx_kp_s_17));
      PyTuple_SET_ITEM(__pyx_k_tuple_18, 0, ((PyObject *)__pyx_kp_s_17));
      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_17));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18));

     997:

     998:     bins   = np.empty(lenbin - 1, dtype=np.int64)

      /* "lib.pyx":998
     *         raise ValueError("Values falls after last bin")
     *
     *     bins   = np.empty(lenbin - 1, dtype=np.int64)             # <<<<<<<<<<<<<<
     *
     *     j  = 0 # index into values
     */
      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_lenbin - 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__int64); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_10), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_13 = ((PyArrayObject *)__pyx_t_12);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bins.rcbuffer->pybuffer);
        __pyx_t_14 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bins.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_14 < 0)) {
          PyErr_Fetch(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bins.rcbuffer->pybuffer, (PyObject*)__pyx_v_bins, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_15, __pyx_t_16, __pyx_t_17);
          }
        }
        __pyx_pybuffernd_bins.diminfo[0].strides = __pyx_pybuffernd_bins.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bins.diminfo[0].shape = __pyx_pybuffernd_bins.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_13 = 0;
      __pyx_v_bins = ((PyArrayObject *)__pyx_t_12);
      __pyx_t_12 = 0;

     999:

     1000:     j  = 0 # index into values

      /* "lib.pyx":1000
     *     bins   = np.empty(lenbin - 1, dtype=np.int64)
     *
     *     j  = 0 # index into values             # <<<<<<<<<<<<<<
     *     bc = 0 # bin count
     *
     */
      __pyx_v_j = 0;

     1001:     bc = 0 # bin count

      /* "lib.pyx":1001
     *
     *     j  = 0 # index into values
     *     bc = 0 # bin count             # <<<<<<<<<<<<<<
     *
     *     # linear scan
     */
      __pyx_v_bc = 0;

     1002:

     1003:     # linear scan

     1004:     for i in range(0, lenbin - 1):

      /* "lib.pyx":1004
     *
     *     # linear scan
     *     for i in range(0, lenbin - 1):             # <<<<<<<<<<<<<<
     *         l_bin = binner[i]
     *         r_bin = binner[i+1]
     */
      __pyx_t_18 = (__pyx_v_lenbin - 1);
      for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
        __pyx_v_i = __pyx_t_19;

     1005:         l_bin = binner[i]

        /* "lib.pyx":1005
     *     # linear scan
     *     for i in range(0, lenbin - 1):
     *         l_bin = binner[i]             # <<<<<<<<<<<<<<
     *         r_bin = binner[i+1]
     *
     */
        __pyx_t_20 = __pyx_v_i;
        __pyx_v_l_bin = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_binner.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_binner.diminfo[0].strides));

     1006:         r_bin = binner[i+1]

        /* "lib.pyx":1006
     *     for i in range(0, lenbin - 1):
     *         l_bin = binner[i]
     *         r_bin = binner[i+1]             # <<<<<<<<<<<<<<
     *
     *         # count values in current bin, advance to next bin
     */
        __pyx_t_21 = (__pyx_v_i + 1);
        __pyx_v_r_bin = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_binner.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_binner.diminfo[0].strides));

     1007:

     1008:         # count values in current bin, advance to next bin

     1009:         while j < lenidx and (values[j] < r_bin or

        /* "lib.pyx":1009
     *
     *         # count values in current bin, advance to next bin
     *         while j < lenidx and (values[j] < r_bin or             # <<<<<<<<<<<<<<
     *                               (right_closed and values[j] == r_bin)):
     *             j += 1
     */
        while (1) {
          __pyx_t_5 = (__pyx_v_j < __pyx_v_lenidx);
          if (__pyx_t_5) {
            __pyx_t_22 = __pyx_v_j;
            __pyx_t_2 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_values.diminfo[0].strides)) < __pyx_v_r_bin);
            if (!__pyx_t_2) {

     1010:                               (right_closed and values[j] == r_bin)):

              /* "lib.pyx":1010
     *         # count values in current bin, advance to next bin
     *         while j < lenidx and (values[j] < r_bin or
     *                               (right_closed and values[j] == r_bin)):             # <<<<<<<<<<<<<<
     *             j += 1
     *
     */
              if (__pyx_v_right_closed) {
                __pyx_t_23 = __pyx_v_j;
                __pyx_t_4 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_values.diminfo[0].strides)) == __pyx_v_r_bin);
                __pyx_t_24 = __pyx_t_4;
              } else {
                __pyx_t_24 = __pyx_v_right_closed;
              }
              __pyx_t_4 = __pyx_t_24;
            } else {
              __pyx_t_4 = __pyx_t_2;
            }
            __pyx_t_2 = __pyx_t_4;
          } else {
            __pyx_t_2 = __pyx_t_5;
          }
          if (!__pyx_t_2) break;

     1011:             j += 1

          /* "lib.pyx":1011
     *         while j < lenidx and (values[j] < r_bin or
     *                               (right_closed and values[j] == r_bin)):
     *             j += 1             # <<<<<<<<<<<<<<
     *
     *         bins[bc] = j
     */
          __pyx_v_j = (__pyx_v_j + 1);
        }

     1012:

     1013:         bins[bc] = j

        /* "lib.pyx":1013
     *             j += 1
     *
     *         bins[bc] = j             # <<<<<<<<<<<<<<
     *         bc += 1
     *
     */
        __pyx_t_25 = __pyx_v_bc;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_bins.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_bins.diminfo[0].strides) = __pyx_v_j;

     1014:         bc += 1

        /* "lib.pyx":1014
     *
     *         bins[bc] = j
     *         bc += 1             # <<<<<<<<<<<<<<
     *
     *     return bins
     */
        __pyx_v_bc = (__pyx_v_bc + 1);
      }

     1015:

     1016:     return bins

      /* "lib.pyx":1016
     *         bc += 1
     *
     *     return bins             # <<<<<<<<<<<<<<
     *
     *
     */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_bins));
      __pyx_r = ((PyObject *)__pyx_v_bins);
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_10);
      __Pyx_XDECREF(__pyx_t_11);
      __Pyx_XDECREF(__pyx_t_12);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_binner.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bins.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.generate_bins_dt64", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_binner.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bins.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF((PyObject *)__pyx_v_bins);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_83row_bool_subset(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_83row_bool_subset = {__Pyx_NAMESTR("row_bool_subset"), (PyCFunction)__pyx_pw_3lib_83row_bool_subset, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_83row_bool_subset(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyArrayObject *__pyx_v_values = 0;
      PyArrayObject *__pyx_v_mask = 0;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("row_bool_subset (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__mask,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            case  1:
            if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("row_bool_subset", 1, 2, 2, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "row_bool_subset") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        }
        __pyx_v_values = ((PyArrayObject *)values[0]);
        __pyx_v_mask = ((PyArrayObject *)values[1]);
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("row_bool_subset", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_L3_error:;
      __Pyx_AddTraceback("lib.row_bool_subset", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_82row_bool_subset(__pyx_self, __pyx_v_values, __pyx_v_mask);
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     1017:

     1018:

     1019:

     1020:

     1021: @cython.boundscheck(False)

     1022: @cython.wraparound(False)

     1023: def row_bool_subset(ndarray[float64_t, ndim=2] values,

    /* "lib.pyx":1023
     * @cython.boundscheck(False)
     * @cython.wraparound(False)
     * def row_bool_subset(ndarray[float64_t, ndim=2] values,             # <<<<<<<<<<<<<<
     *                     ndarray[uint8_t, cast=True] mask):
     *     cdef:
     */

    static PyObject *__pyx_pf_3lib_82row_bool_subset(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask) {
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_j;
      Py_ssize_t __pyx_v_n;
      Py_ssize_t __pyx_v_k;
      Py_ssize_t __pyx_v_pos;
      PyArrayObject *__pyx_v_out = 0;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_mask;
      __Pyx_Buffer __pyx_pybuffer_mask;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_out;
      __Pyx_Buffer __pyx_pybuffer_out;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
      __Pyx_Buffer __pyx_pybuffer_values;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("row_bool_subset", 0);
      __pyx_pybuffer_out.pybuffer.buf = NULL;
      __pyx_pybuffer_out.refcount = 0;
      __pyx_pybuffernd_out.data = NULL;
      __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;
      __pyx_pybuffer_values.pybuffer.buf = NULL;
      __pyx_pybuffer_values.refcount = 0;
      __pyx_pybuffernd_values.data = NULL;
      __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
      __pyx_pybuffer_mask.pybuffer.buf = NULL;
      __pyx_pybuffer_mask.refcount = 0;
      __pyx_pybuffernd_mask.data = NULL;
      __pyx_pybuffernd_mask.rcbuffer = &__pyx_pybuffer_mask;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 1, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_mask.diminfo[0].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask.diminfo[0].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[0];

      /* "lib.pyx":1023
     * @cython.boundscheck(False)
     * @cython.wraparound(False)
     * def row_bool_subset(ndarray[float64_t, ndim=2] values,             # <<<<<<<<<<<<<<
     *                     ndarray[uint8_t, cast=True] mask):
     *     cdef:
     */
      __pyx_k_tuple_177 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_177)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_177);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
      PyTuple_SET_ITEM(__pyx_k_tuple_177, 0, ((PyObject *)__pyx_n_s__values));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
      PyTuple_SET_ITEM(__pyx_k_tuple_177, 1, ((PyObject *)__pyx_n_s__mask));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_177, 2, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
      PyTuple_SET_ITEM(__pyx_k_tuple_177, 3, ((PyObject *)__pyx_n_s__j));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_177, 4, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
      PyTuple_SET_ITEM(__pyx_k_tuple_177, 5, ((PyObject *)__pyx_n_s__k));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__pos));
      PyTuple_SET_ITEM(__pyx_k_tuple_177, 6, ((PyObject *)__pyx_n_s__pos));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
      PyTuple_SET_ITEM(__pyx_k_tuple_177, 7, ((PyObject *)__pyx_n_s__out));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_177));

      /* "lib.pyx":1023
     * @cython.boundscheck(False)
     * @cython.wraparound(False)
     * def row_bool_subset(ndarray[float64_t, ndim=2] values,             # <<<<<<<<<<<<<<
     *                     ndarray[uint8_t, cast=True] mask):
     *     cdef:
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_83row_bool_subset, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__row_bool_subset, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_178 = (PyObject*)__Pyx_PyCode_New(2, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_177, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__row_bool_subset, 1023, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_178)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     1024:                     ndarray[uint8_t, cast=True] mask):

     1025:     cdef:

     1026:         Py_ssize_t i, j, n, k, pos = 0

      /* "lib.pyx":1026
     *                     ndarray[uint8_t, cast=True] mask):
     *     cdef:
     *         Py_ssize_t i, j, n, k, pos = 0             # <<<<<<<<<<<<<<
     *         ndarray[float64_t, ndim=2] out
     *
     */
      __pyx_v_pos = 0;

     1027:         ndarray[float64_t, ndim=2] out

     1028:

     1029:     n, k = (<object> values).shape

      /* "lib.pyx":1029
     *         ndarray[float64_t, ndim=2] out
     *
     *     n, k = (<object> values).shape             # <<<<<<<<<<<<<<
     *     assert(n == len(mask))
     *
     */
      __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
        PyObject* sequence = __pyx_t_1;
        #if CYTHON_COMPILING_IN_CPYTHON
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
        } else {
          __pyx_t_2 = PyList_GET_ITEM(sequence, 0);
          __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
        }
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        #else
        __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else
      {
        Py_ssize_t index = -1;
        __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
        index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_2);
        index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_3);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_5 = NULL;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L4_unpacking_done;
        __pyx_L3_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_5 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L4_unpacking_done:;
      }
      __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_n = __pyx_t_6;
      __pyx_v_k = __pyx_t_7;

     1030:     assert(n == len(mask))

      /* "lib.pyx":1030
     *
     *     n, k = (<object> values).shape
     *     assert(n == len(mask))             # <<<<<<<<<<<<<<
     *
     *     out = np.empty((mask.sum(), k), dtype=np.float64)
     */
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      __pyx_t_7 = PyObject_Length(((PyObject *)__pyx_v_mask)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (unlikely(!(__pyx_v_n == __pyx_t_7))) {
        PyErr_SetNone(PyExc_AssertionError);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #endif

     1031:

     1032:     out = np.empty((mask.sum(), k), dtype=np.float64)

      /* "lib.pyx":1032
     *     assert(n == len(mask))
     *
     *     out = np.empty((mask.sum(), k), dtype=np.float64)             # <<<<<<<<<<<<<<
     *
     *     for i in range(n):
     */
      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_mask), __pyx_n_s__sum); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __pyx_t_2 = 0;
      __pyx_t_1 = 0;
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_4));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
      __pyx_t_4 = 0;
      __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__float64); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = ((PyArrayObject *)__pyx_t_8);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
        __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_10 < 0)) {
          PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
          }
        }
        __pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_9 = 0;
      __pyx_v_out = ((PyArrayObject *)__pyx_t_8);
      __pyx_t_8 = 0;

     1033:

     1034:     for i in range(n):

      /* "lib.pyx":1034
     *     out = np.empty((mask.sum(), k), dtype=np.float64)
     *
     *     for i in range(n):             # <<<<<<<<<<<<<<
     *         if mask[i]:
     *             for j in range(k):
     */
      __pyx_t_7 = __pyx_v_n;
      for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_7; __pyx_t_6+=1) {
        __pyx_v_i = __pyx_t_6;

     1035:         if mask[i]:

        /* "lib.pyx":1035
     *
     *     for i in range(n):
     *         if mask[i]:             # <<<<<<<<<<<<<<
     *             for j in range(k):
     *                 out[pos, j] = values[i, j]
     */
        __pyx_t_14 = __pyx_v_i;
        __pyx_t_15 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_mask.diminfo[0].strides));
        if (__pyx_t_15) {

     1036:             for j in range(k):

          /* "lib.pyx":1036
     *     for i in range(n):
     *         if mask[i]:
     *             for j in range(k):             # <<<<<<<<<<<<<<
     *                 out[pos, j] = values[i, j]
     *             pos += 1
     */
          __pyx_t_16 = __pyx_v_k;
          for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
            __pyx_v_j = __pyx_t_17;

     1037:                 out[pos, j] = values[i, j]

            /* "lib.pyx":1037
     *         if mask[i]:
     *             for j in range(k):
     *                 out[pos, j] = values[i, j]             # <<<<<<<<<<<<<<
     *             pos += 1
     *
     */
            __pyx_t_18 = __pyx_v_i;
            __pyx_t_19 = __pyx_v_j;
            __pyx_t_20 = __pyx_v_pos;
            __pyx_t_21 = __pyx_v_j;
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_out.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_values.diminfo[1].strides));
          }

     1038:             pos += 1

          /* "lib.pyx":1038
     *             for j in range(k):
     *                 out[pos, j] = values[i, j]
     *             pos += 1             # <<<<<<<<<<<<<<
     *
     *     return out
     */
          __pyx_v_pos = (__pyx_v_pos + 1);
          goto __pyx_L7;
        }
        __pyx_L7:;
      }

     1039:

     1040:     return out

      /* "lib.pyx":1040
     *             pos += 1
     *
     *     return out             # <<<<<<<<<<<<<<
     *
     * @cython.boundscheck(False)
     */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_out));
      __pyx_r = ((PyObject *)__pyx_v_out);
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_8);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.row_bool_subset", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF((PyObject *)__pyx_v_out);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_85row_bool_subset_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_85row_bool_subset_object = {__Pyx_NAMESTR("row_bool_subset_object"), (PyCFunction)__pyx_pw_3lib_85row_bool_subset_object, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_85row_bool_subset_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyArrayObject *__pyx_v_values = 0;
      PyArrayObject *__pyx_v_mask = 0;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("row_bool_subset_object (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__mask,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            case  1:
            if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("row_bool_subset_object", 1, 2, 2, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "row_bool_subset_object") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        }
        __pyx_v_values = ((PyArrayObject *)values[0]);
        __pyx_v_mask = ((PyArrayObject *)values[1]);
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("row_bool_subset_object", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_L3_error:;
      __Pyx_AddTraceback("lib.row_bool_subset_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_84row_bool_subset_object(__pyx_self, __pyx_v_values, __pyx_v_mask);
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     1041:

     1042: @cython.boundscheck(False)

     1043: @cython.wraparound(False)

     1044: def row_bool_subset_object(ndarray[object, ndim=2] values,

    /* "lib.pyx":1044
     * @cython.boundscheck(False)
     * @cython.wraparound(False)
     * def row_bool_subset_object(ndarray[object, ndim=2] values,             # <<<<<<<<<<<<<<
     *                            ndarray[uint8_t, cast=True] mask):
     *     cdef:
     */

    static PyObject *__pyx_pf_3lib_84row_bool_subset_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask) {
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_j;
      Py_ssize_t __pyx_v_n;
      Py_ssize_t __pyx_v_k;
      Py_ssize_t __pyx_v_pos;
      PyArrayObject *__pyx_v_out = 0;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_mask;
      __Pyx_Buffer __pyx_pybuffer_mask;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_out;
      __Pyx_Buffer __pyx_pybuffer_out;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
      __Pyx_Buffer __pyx_pybuffer_values;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("row_bool_subset_object", 0);
      __pyx_pybuffer_out.pybuffer.buf = NULL;
      __pyx_pybuffer_out.refcount = 0;
      __pyx_pybuffernd_out.data = NULL;
      __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;
      __pyx_pybuffer_values.pybuffer.buf = NULL;
      __pyx_pybuffer_values.refcount = 0;
      __pyx_pybuffernd_values.data = NULL;
      __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
      __pyx_pybuffer_mask.pybuffer.buf = NULL;
      __pyx_pybuffer_mask.refcount = 0;
      __pyx_pybuffernd_mask.data = NULL;
      __pyx_pybuffernd_mask.rcbuffer = &__pyx_pybuffer_mask;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 1, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_mask.diminfo[0].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask.diminfo[0].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[0];

      /* "lib.pyx":1044
     * @cython.boundscheck(False)
     * @cython.wraparound(False)
     * def row_bool_subset_object(ndarray[object, ndim=2] values,             # <<<<<<<<<<<<<<
     *                            ndarray[uint8_t, cast=True] mask):
     *     cdef:
     */
      __pyx_k_tuple_179 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_179)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_179);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
      PyTuple_SET_ITEM(__pyx_k_tuple_179, 0, ((PyObject *)__pyx_n_s__values));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
      PyTuple_SET_ITEM(__pyx_k_tuple_179, 1, ((PyObject *)__pyx_n_s__mask));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_179, 2, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
      PyTuple_SET_ITEM(__pyx_k_tuple_179, 3, ((PyObject *)__pyx_n_s__j));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_179, 4, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
      PyTuple_SET_ITEM(__pyx_k_tuple_179, 5, ((PyObject *)__pyx_n_s__k));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__pos));
      PyTuple_SET_ITEM(__pyx_k_tuple_179, 6, ((PyObject *)__pyx_n_s__pos));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
      PyTuple_SET_ITEM(__pyx_k_tuple_179, 7, ((PyObject *)__pyx_n_s__out));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_179));

      /* "lib.pyx":1044
     * @cython.boundscheck(False)
     * @cython.wraparound(False)
     * def row_bool_subset_object(ndarray[object, ndim=2] values,             # <<<<<<<<<<<<<<
     *                            ndarray[uint8_t, cast=True] mask):
     *     cdef:
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_85row_bool_subset_object, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s_181, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_180 = (PyObject*)__Pyx_PyCode_New(2, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_179, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s_181, 1044, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_180)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     1045:                            ndarray[uint8_t, cast=True] mask):

     1046:     cdef:

     1047:         Py_ssize_t i, j, n, k, pos = 0

      /* "lib.pyx":1047
     *                            ndarray[uint8_t, cast=True] mask):
     *     cdef:
     *         Py_ssize_t i, j, n, k, pos = 0             # <<<<<<<<<<<<<<
     *         ndarray[object, ndim=2] out
     *
     */
      __pyx_v_pos = 0;

     1048:         ndarray[object, ndim=2] out

     1049:

     1050:     n, k = (<object> values).shape

      /* "lib.pyx":1050
     *         ndarray[object, ndim=2] out
     *
     *     n, k = (<object> values).shape             # <<<<<<<<<<<<<<
     *     assert(n == len(mask))
     *
     */
      __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
        PyObject* sequence = __pyx_t_1;
        #if CYTHON_COMPILING_IN_CPYTHON
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
        } else {
          __pyx_t_2 = PyList_GET_ITEM(sequence, 0);
          __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
        }
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        #else
        __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else
      {
        Py_ssize_t index = -1;
        __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
        index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_2);
        index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_3);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_5 = NULL;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L4_unpacking_done;
        __pyx_L3_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_5 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L4_unpacking_done:;
      }
      __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_n = __pyx_t_6;
      __pyx_v_k = __pyx_t_7;

     1051:     assert(n == len(mask))

      /* "lib.pyx":1051
     *
     *     n, k = (<object> values).shape
     *     assert(n == len(mask))             # <<<<<<<<<<<<<<
     *
     *     out = np.empty((mask.sum(), k), dtype=object)
     */
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      __pyx_t_7 = PyObject_Length(((PyObject *)__pyx_v_mask)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (unlikely(!(__pyx_v_n == __pyx_t_7))) {
        PyErr_SetNone(PyExc_AssertionError);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #endif

     1052:

     1053:     out = np.empty((mask.sum(), k), dtype=object)

      /* "lib.pyx":1053
     *     assert(n == len(mask))
     *
     *     out = np.empty((mask.sum(), k), dtype=object)             # <<<<<<<<<<<<<<
     *
     *     for i in range(n):
     */
      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_mask), __pyx_n_s__sum); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __pyx_t_2 = 0;
      __pyx_t_1 = 0;
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_4));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
      __pyx_t_4 = 0;
      __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = ((PyArrayObject *)__pyx_t_2);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
        __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_9 < 0)) {
          PyErr_Fetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
          }
        }
        __pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_8 = 0;
      __pyx_v_out = ((PyArrayObject *)__pyx_t_2);
      __pyx_t_2 = 0;

     1054:

     1055:     for i in range(n):

      /* "lib.pyx":1055
     *     out = np.empty((mask.sum(), k), dtype=object)
     *
     *     for i in range(n):             # <<<<<<<<<<<<<<
     *         if mask[i]:
     *             for j in range(k):
     */
      __pyx_t_7 = __pyx_v_n;
      for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_7; __pyx_t_6+=1) {
        __pyx_v_i = __pyx_t_6;

     1056:         if mask[i]:

        /* "lib.pyx":1056
     *
     *     for i in range(n):
     *         if mask[i]:             # <<<<<<<<<<<<<<
     *             for j in range(k):
     *                 out[pos, j] = values[i, j]
     */
        __pyx_t_13 = __pyx_v_i;
        __pyx_t_14 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_mask.diminfo[0].strides));
        if (__pyx_t_14) {

     1057:             for j in range(k):

          /* "lib.pyx":1057
     *     for i in range(n):
     *         if mask[i]:
     *             for j in range(k):             # <<<<<<<<<<<<<<
     *                 out[pos, j] = values[i, j]
     *             pos += 1
     */
          __pyx_t_15 = __pyx_v_k;
          for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
            __pyx_v_j = __pyx_t_16;

     1058:                 out[pos, j] = values[i, j]

            /* "lib.pyx":1058
     *         if mask[i]:
     *             for j in range(k):
     *                 out[pos, j] = values[i, j]             # <<<<<<<<<<<<<<
     *             pos += 1
     *
     */
            __pyx_t_17 = __pyx_v_i;
            __pyx_t_18 = __pyx_v_j;
            __pyx_t_2 = *__Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_values.diminfo[1].strides);
            __Pyx_INCREF((PyObject*)__pyx_t_2);
            __pyx_t_19 = __pyx_v_pos;
            __pyx_t_20 = __pyx_v_j;
            __pyx_t_21 = __Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_out.diminfo[1].strides);
            __Pyx_GOTREF(*__pyx_t_21);
            __Pyx_INCREF(__pyx_t_2); __Pyx_DECREF(*__pyx_t_21);
            *__pyx_t_21 = __pyx_t_2;
            __Pyx_GIVEREF(*__pyx_t_21);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          }

     1059:             pos += 1

          /* "lib.pyx":1059
     *             for j in range(k):
     *                 out[pos, j] = values[i, j]
     *             pos += 1             # <<<<<<<<<<<<<<
     *
     *     return out
     */
          __pyx_v_pos = (__pyx_v_pos + 1);
          goto __pyx_L7;
        }
        __pyx_L7:;
      }

     1060:

     1061:     return out

      /* "lib.pyx":1061
     *             pos += 1
     *
     *     return out             # <<<<<<<<<<<<<<
     *
     *
     */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_out));
      __pyx_r = ((PyObject *)__pyx_v_out);
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.row_bool_subset_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF((PyObject *)__pyx_v_out);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_87group_count(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_87group_count = {__Pyx_NAMESTR("group_count"), (PyCFunction)__pyx_pw_3lib_87group_count, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_87group_count(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyArrayObject *__pyx_v_values = 0;
      Py_ssize_t __pyx_v_size;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("group_count (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__size,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            case  1:
            if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("group_count", 1, 2, 2, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "group_count") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        }
        __pyx_v_values = ((PyArrayObject *)values[0]);
        __pyx_v_size = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_size == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("group_count", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_L3_error:;
      __Pyx_AddTraceback("lib.group_count", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_86group_count(__pyx_self, __pyx_v_values, __pyx_v_size);
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     1062:

     1063:

     1064: def group_count(ndarray[int64_t] values, Py_ssize_t size):

    /* "lib.pyx":1064
     *
     *
     * def group_count(ndarray[int64_t] values, Py_ssize_t size):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(values)
     */

    static PyObject *__pyx_pf_3lib_86group_count(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, Py_ssize_t __pyx_v_size) {
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_n;
      PyArrayObject *__pyx_v_counts = 0;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_counts;
      __Pyx_Buffer __pyx_pybuffer_counts;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
      __Pyx_Buffer __pyx_pybuffer_values;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("group_count", 0);
      __pyx_pybuffer_counts.pybuffer.buf = NULL;
      __pyx_pybuffer_counts.refcount = 0;
      __pyx_pybuffernd_counts.data = NULL;
      __pyx_pybuffernd_counts.rcbuffer = &__pyx_pybuffer_counts;
      __pyx_pybuffer_values.pybuffer.buf = NULL;
      __pyx_pybuffer_values.refcount = 0;
      __pyx_pybuffernd_values.data = NULL;
      __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0];

      /* "lib.pyx":1064
     *
     *
     * def group_count(ndarray[int64_t] values, Py_ssize_t size):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(values)
     */
      __pyx_k_tuple_182 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_182)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_182);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
      PyTuple_SET_ITEM(__pyx_k_tuple_182, 0, ((PyObject *)__pyx_n_s__values));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__size));
      PyTuple_SET_ITEM(__pyx_k_tuple_182, 1, ((PyObject *)__pyx_n_s__size));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_182, 2, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_182, 3, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__counts));
      PyTuple_SET_ITEM(__pyx_k_tuple_182, 4, ((PyObject *)__pyx_n_s__counts));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__counts));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_182));

      /* "lib.pyx":1064
     *
     *
     * def group_count(ndarray[int64_t] values, Py_ssize_t size):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(values)
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_87group_count, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__group_count, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_183 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_182, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__group_count, 1064, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_183)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     1065:     cdef:

     1066:         Py_ssize_t i, n = len(values)

      /* "lib.pyx":1066
     * def group_count(ndarray[int64_t] values, Py_ssize_t size):
     *     cdef:
     *         Py_ssize_t i, n = len(values)             # <<<<<<<<<<<<<<
     *         ndarray[int64_t] counts
     *
     */
      __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_n = __pyx_t_1;

     1067:         ndarray[int64_t] counts

     1068:

     1069:     counts = np.zeros(size, dtype=np.int64)

      /* "lib.pyx":1069
     *         ndarray[int64_t] counts
     *
     *     counts = np.zeros(size, dtype=np.int64)             # <<<<<<<<<<<<<<
     *     for i in range(n):
     *         counts[values[i]] += 1
     */
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
        __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_8 < 0)) {
          PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_v_counts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
          }
        }
        __pyx_pybuffernd_counts.diminfo[0].strides = __pyx_pybuffernd_counts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_counts.diminfo[0].shape = __pyx_pybuffernd_counts.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_7 = 0;
      __pyx_v_counts = ((PyArrayObject *)__pyx_t_6);
      __pyx_t_6 = 0;

     1070:     for i in range(n):

      /* "lib.pyx":1070
     *
     *     counts = np.zeros(size, dtype=np.int64)
     *     for i in range(n):             # <<<<<<<<<<<<<<
     *         counts[values[i]] += 1
     *     return counts
     */
      __pyx_t_1 = __pyx_v_n;
      for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_1; __pyx_t_12+=1) {
        __pyx_v_i = __pyx_t_12;

     1071:         counts[values[i]] += 1

        /* "lib.pyx":1071
     *     counts = np.zeros(size, dtype=np.int64)
     *     for i in range(n):
     *         counts[values[i]] += 1             # <<<<<<<<<<<<<<
     *     return counts
     *
     */
        __pyx_t_13 = __pyx_v_i;
        __pyx_t_8 = -1;
        if (__pyx_t_13 < 0) {
          __pyx_t_13 += __pyx_pybuffernd_values.diminfo[0].shape;
          if (unlikely(__pyx_t_13 < 0)) __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_values.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_14 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_values.diminfo[0].strides));
        __pyx_t_8 = -1;
        if (__pyx_t_14 < 0) {
          __pyx_t_14 += __pyx_pybuffernd_counts.diminfo[0].shape;
          if (unlikely(__pyx_t_14 < 0)) __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_counts.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;
      }

     1072:     return counts

      /* "lib.pyx":1072
     *     for i in range(n):
     *         counts[values[i]] += 1
     *     return counts             # <<<<<<<<<<<<<<
     *
     * def lookup_values(ndarray[object] values, dict mapping):
     */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_counts));
      __pyx_r = ((PyObject *)__pyx_v_counts);
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.group_count", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF((PyObject *)__pyx_v_counts);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_89lookup_values(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_89lookup_values = {__Pyx_NAMESTR("lookup_values"), (PyCFunction)__pyx_pw_3lib_89lookup_values, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_89lookup_values(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyArrayObject *__pyx_v_values = 0;
      PyObject *__pyx_v_mapping = 0;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("lookup_values (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__mapping,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            case  1:
            if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mapping)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("lookup_values", 1, 2, 2, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lookup_values") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        }
        __pyx_v_values = ((PyArrayObject *)values[0]);
        __pyx_v_mapping = ((PyObject*)values[1]);
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("lookup_values", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_L3_error:;
      __Pyx_AddTraceback("lib.lookup_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mapping), (&PyDict_Type), 1, "mapping", 1))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_88lookup_values(__pyx_self, __pyx_v_values, __pyx_v_mapping);
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     1073:

     1074: def lookup_values(ndarray[object] values, dict mapping):

    /* "lib.pyx":1074
     *     return counts
     *
     * def lookup_values(ndarray[object] values, dict mapping):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(values)
     */

    static PyObject *__pyx_pf_3lib_88lookup_values(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyObject *__pyx_v_mapping) {
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_n;
      PyObject *__pyx_v_result = NULL;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
      __Pyx_Buffer __pyx_pybuffer_values;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("lookup_values", 0);
      __pyx_pybuffer_values.pybuffer.buf = NULL;
      __pyx_pybuffer_values.refcount = 0;
      __pyx_pybuffernd_values.data = NULL;
      __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0];

      /* "lib.pyx":1074
     *     return counts
     *
     * def lookup_values(ndarray[object] values, dict mapping):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(values)
     */
      __pyx_k_tuple_184 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_184)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_184);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
      PyTuple_SET_ITEM(__pyx_k_tuple_184, 0, ((PyObject *)__pyx_n_s__values));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__mapping));
      PyTuple_SET_ITEM(__pyx_k_tuple_184, 1, ((PyObject *)__pyx_n_s__mapping));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mapping));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_184, 2, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_184, 3, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
      PyTuple_SET_ITEM(__pyx_k_tuple_184, 4, ((PyObject *)__pyx_n_s__result));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_184));

      /* "lib.pyx":1074
     *     return counts
     *
     * def lookup_values(ndarray[object] values, dict mapping):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n = len(values)
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_89lookup_values, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__lookup_values, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_185 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_184, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__lookup_values, 1074, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_185)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     1075:     cdef:

     1076:         Py_ssize_t i, n = len(values)

      /* "lib.pyx":1076
     * def lookup_values(ndarray[object] values, dict mapping):
     *     cdef:
     *         Py_ssize_t i, n = len(values)             # <<<<<<<<<<<<<<
     *
     *     result = np.empty(n, dtype='O')
     */
      __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_n = __pyx_t_1;

     1077:

     1078:     result = np.empty(n, dtype='O')

      /* "lib.pyx":1078
     *         Py_ssize_t i, n = len(values)
     *
     *     result = np.empty(n, dtype='O')             # <<<<<<<<<<<<<<
     *     for i in range(n):
     *         result[i] = mapping[values[i]]
     */
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__O)) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __pyx_v_result = __pyx_t_5;
      __pyx_t_5 = 0;

     1079:     for i in range(n):

      /* "lib.pyx":1079
     *
     *     result = np.empty(n, dtype='O')
     *     for i in range(n):             # <<<<<<<<<<<<<<
     *         result[i] = mapping[values[i]]
     *     return maybe_convert_objects(result)
     */
      __pyx_t_1 = __pyx_v_n;
      for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_1; __pyx_t_6+=1) {
        __pyx_v_i = __pyx_t_6;

     1080:         result[i] = mapping[values[i]]

        /* "lib.pyx":1080
     *     result = np.empty(n, dtype='O')
     *     for i in range(n):
     *         result[i] = mapping[values[i]]             # <<<<<<<<<<<<<<
     *     return maybe_convert_objects(result)
     *
     */
        if (unlikely(((PyObject *)__pyx_v_mapping) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_7 = __pyx_v_i;
        __pyx_t_8 = -1;
        if (__pyx_t_7 < 0) {
          __pyx_t_7 += __pyx_pybuffernd_values.diminfo[0].shape;
          if (unlikely(__pyx_t_7 < 0)) __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_values.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_5 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_values.diminfo[0].strides);
        __Pyx_INCREF((PyObject*)__pyx_t_5);
        __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_mapping), __pyx_t_5); if (!__pyx_t_2) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (__Pyx_SetItemInt(__pyx_v_result, __pyx_v_i, __pyx_t_2, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }

     1081:     return maybe_convert_objects(result)

      /* "lib.pyx":1081
     *     for i in range(n):
     *         result[i] = mapping[values[i]]
     *     return maybe_convert_objects(result)             # <<<<<<<<<<<<<<
     *
     *
     */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s_9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_result);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_result);
      __Pyx_GIVEREF(__pyx_v_result);
      __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.lookup_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF(__pyx_v_result);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_91count_level_1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_91count_level_1d = {__Pyx_NAMESTR("count_level_1d"), (PyCFunction)__pyx_pw_3lib_91count_level_1d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_91count_level_1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyArrayObject *__pyx_v_mask = 0;
      PyArrayObject *__pyx_v_labels = 0;
      Py_ssize_t __pyx_v_max_bin;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("count_level_1d (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__mask,&__pyx_n_s__labels,&__pyx_n_s__max_bin,0};
        PyObject* values[3] = {0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            case  1:
            if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__labels)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("count_level_1d", 1, 3, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
            case  2:
            if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_bin)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("count_level_1d", 1, 3, 3, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "count_level_1d") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
          values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        }
        __pyx_v_mask = ((PyArrayObject *)values[0]);
        __pyx_v_labels = ((PyArrayObject *)values[1]);
        __pyx_v_max_bin = __Pyx_PyIndex_AsSsize_t(values[2]); if (unlikely((__pyx_v_max_bin == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("count_level_1d", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_L3_error:;
      __Pyx_AddTraceback("lib.count_level_1d", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_labels), __pyx_ptype_5numpy_ndarray, 1, "labels", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_90count_level_1d(__pyx_self, __pyx_v_mask, __pyx_v_labels, __pyx_v_max_bin);
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     1082:

     1083:

     1084: def count_level_1d(ndarray[uint8_t, cast=True] mask,

    /* "lib.pyx":1084
     *
     *
     * def count_level_1d(ndarray[uint8_t, cast=True] mask,             # <<<<<<<<<<<<<<
     *                    ndarray[int64_t] labels, Py_ssize_t max_bin):
     *     cdef:
     */

    static PyObject *__pyx_pf_3lib_90count_level_1d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_mask, PyArrayObject *__pyx_v_labels, Py_ssize_t __pyx_v_max_bin) {
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_n;
      PyArrayObject *__pyx_v_counts = 0;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_counts;
      __Pyx_Buffer __pyx_pybuffer_counts;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_labels;
      __Pyx_Buffer __pyx_pybuffer_labels;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_mask;
      __Pyx_Buffer __pyx_pybuffer_mask;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("count_level_1d", 0);
      __pyx_pybuffer_counts.pybuffer.buf = NULL;
      __pyx_pybuffer_counts.refcount = 0;
      __pyx_pybuffernd_counts.data = NULL;
      __pyx_pybuffernd_counts.rcbuffer = &__pyx_pybuffer_counts;
      __pyx_pybuffer_mask.pybuffer.buf = NULL;
      __pyx_pybuffer_mask.refcount = 0;
      __pyx_pybuffernd_mask.data = NULL;
      __pyx_pybuffernd_mask.rcbuffer = &__pyx_pybuffer_mask;
      __pyx_pybuffer_labels.pybuffer.buf = NULL;
      __pyx_pybuffer_labels.refcount = 0;
      __pyx_pybuffernd_labels.data = NULL;
      __pyx_pybuffernd_labels.rcbuffer = &__pyx_pybuffer_labels;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 1, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_mask.diminfo[0].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask.diminfo[0].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_labels.rcbuffer->pybuffer, (PyObject*)__pyx_v_labels, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_labels.diminfo[0].strides = __pyx_pybuffernd_labels.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_labels.diminfo[0].shape = __pyx_pybuffernd_labels.rcbuffer->pybuffer.shape[0];

      /* "lib.pyx":1084
     *
     *
     * def count_level_1d(ndarray[uint8_t, cast=True] mask,             # <<<<<<<<<<<<<<
     *                    ndarray[int64_t] labels, Py_ssize_t max_bin):
     *     cdef:
     */
      __pyx_k_tuple_186 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_186)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_186);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
      PyTuple_SET_ITEM(__pyx_k_tuple_186, 0, ((PyObject *)__pyx_n_s__mask));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__labels));
      PyTuple_SET_ITEM(__pyx_k_tuple_186, 1, ((PyObject *)__pyx_n_s__labels));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__labels));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__max_bin));
      PyTuple_SET_ITEM(__pyx_k_tuple_186, 2, ((PyObject *)__pyx_n_s__max_bin));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__max_bin));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_186, 3, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_186, 4, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__counts));
      PyTuple_SET_ITEM(__pyx_k_tuple_186, 5, ((PyObject *)__pyx_n_s__counts));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__counts));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_186));

      /* "lib.pyx":1084
     *
     *
     * def count_level_1d(ndarray[uint8_t, cast=True] mask,             # <<<<<<<<<<<<<<
     *                    ndarray[int64_t] labels, Py_ssize_t max_bin):
     *     cdef:
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_91count_level_1d, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__count_level_1d, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_187 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_186, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__count_level_1d, 1084, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_187)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     1085:                    ndarray[int64_t] labels, Py_ssize_t max_bin):

     1086:     cdef:

     1087:         Py_ssize_t i, n

     1088:         ndarray[int64_t] counts

     1089:

     1090:     counts = np.zeros(max_bin, dtype='i8')

      /* "lib.pyx":1090
     *         ndarray[int64_t] counts
     *
     *     counts = np.zeros(max_bin, dtype='i8')             # <<<<<<<<<<<<<<
     *
     *     n = len(mask)
     */
      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_max_bin); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__i8)) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_5 = ((PyArrayObject *)__pyx_t_4);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
        __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_6 < 0)) {
          PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_v_counts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
          }
        }
        __pyx_pybuffernd_counts.diminfo[0].strides = __pyx_pybuffernd_counts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_counts.diminfo[0].shape = __pyx_pybuffernd_counts.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_5 = 0;
      __pyx_v_counts = ((PyArrayObject *)__pyx_t_4);
      __pyx_t_4 = 0;

     1091:

     1092:     n = len(mask)

      /* "lib.pyx":1092
     *     counts = np.zeros(max_bin, dtype='i8')
     *
     *     n = len(mask)             # <<<<<<<<<<<<<<
     *
     *     for i from 0 <= i < n:
     */
      __pyx_t_10 = PyObject_Length(((PyObject *)__pyx_v_mask)); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_n = __pyx_t_10;

     1093:

     1094:     for i from 0 <= i < n:

      /* "lib.pyx":1094
     *     n = len(mask)
     *
     *     for i from 0 <= i < n:             # <<<<<<<<<<<<<<
     *         if mask[i]:
     *             counts[labels[i]] += 1
     */
      __pyx_t_10 = __pyx_v_n;
      for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_10; __pyx_v_i++) {

     1095:         if mask[i]:

        /* "lib.pyx":1095
     *
     *     for i from 0 <= i < n:
     *         if mask[i]:             # <<<<<<<<<<<<<<
     *             counts[labels[i]] += 1
     *
     */
        __pyx_t_11 = __pyx_v_i;
        __pyx_t_6 = -1;
        if (__pyx_t_11 < 0) {
          __pyx_t_11 += __pyx_pybuffernd_mask.diminfo[0].shape;
          if (unlikely(__pyx_t_11 < 0)) __pyx_t_6 = 0;
        } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_mask.diminfo[0].shape)) __pyx_t_6 = 0;
        if (unlikely(__pyx_t_6 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_6);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_12 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_mask.diminfo[0].strides));
        if (__pyx_t_12) {

     1096:             counts[labels[i]] += 1

          /* "lib.pyx":1096
     *     for i from 0 <= i < n:
     *         if mask[i]:
     *             counts[labels[i]] += 1             # <<<<<<<<<<<<<<
     *
     *     return counts
     */
          __pyx_t_13 = __pyx_v_i;
          __pyx_t_6 = -1;
          if (__pyx_t_13 < 0) {
            __pyx_t_13 += __pyx_pybuffernd_labels.diminfo[0].shape;
            if (unlikely(__pyx_t_13 < 0)) __pyx_t_6 = 0;
          } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_labels.diminfo[0].shape)) __pyx_t_6 = 0;
          if (unlikely(__pyx_t_6 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_6);
            {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_14 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_labels.diminfo[0].strides));
          __pyx_t_6 = -1;
          if (__pyx_t_14 < 0) {
            __pyx_t_14 += __pyx_pybuffernd_counts.diminfo[0].shape;
            if (unlikely(__pyx_t_14 < 0)) __pyx_t_6 = 0;
          } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_counts.diminfo[0].shape)) __pyx_t_6 = 0;
          if (unlikely(__pyx_t_6 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_6);
            {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;
          goto __pyx_L5;
        }
        __pyx_L5:;
      }

     1097:

     1098:     return counts

      /* "lib.pyx":1098
     *             counts[labels[i]] += 1
     *
     *     return counts             # <<<<<<<<<<<<<<
     *
     *
     */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_counts));
      __pyx_r = ((PyObject *)__pyx_v_counts);
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.count_level_1d", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF((PyObject *)__pyx_v_counts);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_93count_level_2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_93count_level_2d = {__Pyx_NAMESTR("count_level_2d"), (PyCFunction)__pyx_pw_3lib_93count_level_2d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_93count_level_2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyArrayObject *__pyx_v_mask = 0;
      PyArrayObject *__pyx_v_labels = 0;
      Py_ssize_t __pyx_v_max_bin;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("count_level_2d (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__mask,&__pyx_n_s__labels,&__pyx_n_s__max_bin,0};
        PyObject* values[3] = {0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            case  1:
            if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__labels)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("count_level_2d", 1, 3, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
            case  2:
            if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_bin)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("count_level_2d", 1, 3, 3, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "count_level_2d") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
          values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        }
        __pyx_v_mask = ((PyArrayObject *)values[0]);
        __pyx_v_labels = ((PyArrayObject *)values[1]);
        __pyx_v_max_bin = __Pyx_PyIndex_AsSsize_t(values[2]); if (unlikely((__pyx_v_max_bin == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("count_level_2d", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_L3_error:;
      __Pyx_AddTraceback("lib.count_level_2d", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_labels), __pyx_ptype_5numpy_ndarray, 1, "labels", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_92count_level_2d(__pyx_self, __pyx_v_mask, __pyx_v_labels, __pyx_v_max_bin);
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     1099:

     1100:

     1101: def count_level_2d(ndarray[uint8_t, ndim=2, cast=True] mask,

    /* "lib.pyx":1101
     *
     *
     * def count_level_2d(ndarray[uint8_t, ndim=2, cast=True] mask,             # <<<<<<<<<<<<<<
     *                    ndarray[int64_t] labels, Py_ssize_t max_bin):
     *     cdef:
     */

    static PyObject *__pyx_pf_3lib_92count_level_2d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_mask, PyArrayObject *__pyx_v_labels, Py_ssize_t __pyx_v_max_bin) {
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_j;
      Py_ssize_t __pyx_v_k;
      Py_ssize_t __pyx_v_n;
      PyArrayObject *__pyx_v_counts = 0;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_counts;
      __Pyx_Buffer __pyx_pybuffer_counts;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_labels;
      __Pyx_Buffer __pyx_pybuffer_labels;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_mask;
      __Pyx_Buffer __pyx_pybuffer_mask;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("count_level_2d", 0);
      __pyx_pybuffer_counts.pybuffer.buf = NULL;
      __pyx_pybuffer_counts.refcount = 0;
      __pyx_pybuffernd_counts.data = NULL;
      __pyx_pybuffernd_counts.rcbuffer = &__pyx_pybuffer_counts;
      __pyx_pybuffer_mask.pybuffer.buf = NULL;
      __pyx_pybuffer_mask.refcount = 0;
      __pyx_pybuffernd_mask.data = NULL;
      __pyx_pybuffernd_mask.rcbuffer = &__pyx_pybuffer_mask;
      __pyx_pybuffer_labels.pybuffer.buf = NULL;
      __pyx_pybuffer_labels.refcount = 0;
      __pyx_pybuffernd_labels.data = NULL;
      __pyx_pybuffernd_labels.rcbuffer = &__pyx_pybuffer_labels;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 1, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_mask.diminfo[0].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask.diminfo[0].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mask.diminfo[1].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mask.diminfo[1].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[1];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_labels.rcbuffer->pybuffer, (PyObject*)__pyx_v_labels, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_labels.diminfo[0].strides = __pyx_pybuffernd_labels.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_labels.diminfo[0].shape = __pyx_pybuffernd_labels.rcbuffer->pybuffer.shape[0];

      /* "lib.pyx":1101
     *
     *
     * def count_level_2d(ndarray[uint8_t, ndim=2, cast=True] mask,             # <<<<<<<<<<<<<<
     *                    ndarray[int64_t] labels, Py_ssize_t max_bin):
     *     cdef:
     */
      __pyx_k_tuple_188 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_188)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_188);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
      PyTuple_SET_ITEM(__pyx_k_tuple_188, 0, ((PyObject *)__pyx_n_s__mask));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__labels));
      PyTuple_SET_ITEM(__pyx_k_tuple_188, 1, ((PyObject *)__pyx_n_s__labels));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__labels));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__max_bin));
      PyTuple_SET_ITEM(__pyx_k_tuple_188, 2, ((PyObject *)__pyx_n_s__max_bin));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__max_bin));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_188, 3, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
      PyTuple_SET_ITEM(__pyx_k_tuple_188, 4, ((PyObject *)__pyx_n_s__j));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
      PyTuple_SET_ITEM(__pyx_k_tuple_188, 5, ((PyObject *)__pyx_n_s__k));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_188, 6, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__counts));
      PyTuple_SET_ITEM(__pyx_k_tuple_188, 7, ((PyObject *)__pyx_n_s__counts));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__counts));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_188));

      /* "lib.pyx":1101
     *
     *
     * def count_level_2d(ndarray[uint8_t, ndim=2, cast=True] mask,             # <<<<<<<<<<<<<<
     *                    ndarray[int64_t] labels, Py_ssize_t max_bin):
     *     cdef:
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_93count_level_2d, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__count_level_2d, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_189 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_188, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__count_level_2d, 1101, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_189)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     1102:                    ndarray[int64_t] labels, Py_ssize_t max_bin):

     1103:     cdef:

     1104:         Py_ssize_t i, j, k, n

     1105:         ndarray[int64_t, ndim=2] counts

     1106:

     1107:     n, k = (<object> mask).shape

      /* "lib.pyx":1107
     *         ndarray[int64_t, ndim=2] counts
     *
     *     n, k = (<object> mask).shape             # <<<<<<<<<<<<<<
     *     counts = np.zeros((max_bin, k), dtype='i8')
     *
     */
      __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_mask), __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
        PyObject* sequence = __pyx_t_1;
        #if CYTHON_COMPILING_IN_CPYTHON
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
        } else {
          __pyx_t_2 = PyList_GET_ITEM(sequence, 0);
          __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
        }
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        #else
        __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else
      {
        Py_ssize_t index = -1;
        __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
        index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_2);
        index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_3);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_5 = NULL;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L4_unpacking_done;
        __pyx_L3_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_5 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L4_unpacking_done:;
      }
      __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_n = __pyx_t_6;
      __pyx_v_k = __pyx_t_7;

     1108:     counts = np.zeros((max_bin, k), dtype='i8')

      /* "lib.pyx":1108
     *
     *     n, k = (<object> mask).shape
     *     counts = np.zeros((max_bin, k), dtype='i8')             # <<<<<<<<<<<<<<
     *
     *     for i from 0 <= i < n:
     */
      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_max_bin); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_1 = 0;
      __pyx_t_2 = 0;
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_4));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
      __pyx_t_4 = 0;
      __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__i8)) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
        __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_9 < 0)) {
          PyErr_Fetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_v_counts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
          }
        }
        __pyx_pybuffernd_counts.diminfo[0].strides = __pyx_pybuffernd_counts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_counts.diminfo[0].shape = __pyx_pybuffernd_counts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_counts.diminfo[1].strides = __pyx_pybuffernd_counts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_counts.diminfo[1].shape = __pyx_pybuffernd_counts.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_8 = 0;
      __pyx_v_counts = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

     1109:

     1110:     for i from 0 <= i < n:

      /* "lib.pyx":1110
     *     counts = np.zeros((max_bin, k), dtype='i8')
     *
     *     for i from 0 <= i < n:             # <<<<<<<<<<<<<<
     *         for j from 0 <= j < k:
     *             if mask[i, j]:
     */
      __pyx_t_7 = __pyx_v_n;
      for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) {

     1111:         for j from 0 <= j < k:

        /* "lib.pyx":1111
     *
     *     for i from 0 <= i < n:
     *         for j from 0 <= j < k:             # <<<<<<<<<<<<<<
     *             if mask[i, j]:
     *                 counts[labels[i], j] += 1
     */
        __pyx_t_6 = __pyx_v_k;
        for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_6; __pyx_v_j++) {

     1112:             if mask[i, j]:

          /* "lib.pyx":1112
     *     for i from 0 <= i < n:
     *         for j from 0 <= j < k:
     *             if mask[i, j]:             # <<<<<<<<<<<<<<
     *                 counts[labels[i], j] += 1
     *
     */
          __pyx_t_13 = __pyx_v_i;
          __pyx_t_14 = __pyx_v_j;
          __pyx_t_9 = -1;
          if (__pyx_t_13 < 0) {
            __pyx_t_13 += __pyx_pybuffernd_mask.diminfo[0].shape;
            if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 0;
          } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_mask.diminfo[0].shape)) __pyx_t_9 = 0;
          if (__pyx_t_14 < 0) {
            __pyx_t_14 += __pyx_pybuffernd_mask.diminfo[1].shape;
            if (unlikely(__pyx_t_14 < 0)) __pyx_t_9 = 1;
          } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_mask.diminfo[1].shape)) __pyx_t_9 = 1;
          if (unlikely(__pyx_t_9 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_9);
            {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_15 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_mask.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_mask.diminfo[1].strides));
          if (__pyx_t_15) {

     1113:                 counts[labels[i], j] += 1

            /* "lib.pyx":1113
     *         for j from 0 <= j < k:
     *             if mask[i, j]:
     *                 counts[labels[i], j] += 1             # <<<<<<<<<<<<<<
     *
     *     return counts
     */
            __pyx_t_16 = __pyx_v_i;
            __pyx_t_9 = -1;
            if (__pyx_t_16 < 0) {
              __pyx_t_16 += __pyx_pybuffernd_labels.diminfo[0].shape;
              if (unlikely(__pyx_t_16 < 0)) __pyx_t_9 = 0;
            } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_labels.diminfo[0].shape)) __pyx_t_9 = 0;
            if (unlikely(__pyx_t_9 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_9);
              {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_17 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_labels.diminfo[0].strides));
            __pyx_t_18 = __pyx_v_j;
            __pyx_t_9 = -1;
            if (__pyx_t_17 < 0) {
              __pyx_t_17 += __pyx_pybuffernd_counts.diminfo[0].shape;
              if (unlikely(__pyx_t_17 < 0)) __pyx_t_9 = 0;
            } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_counts.diminfo[0].shape)) __pyx_t_9 = 0;
            if (__pyx_t_18 < 0) {
              __pyx_t_18 += __pyx_pybuffernd_counts.diminfo[1].shape;
              if (unlikely(__pyx_t_18 < 0)) __pyx_t_9 = 1;
            } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_counts.diminfo[1].shape)) __pyx_t_9 = 1;
            if (unlikely(__pyx_t_9 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_9);
              {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_counts.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_counts.diminfo[1].strides) += 1;
            goto __pyx_L9;
          }
          __pyx_L9:;
        }
      }

     1114:

     1115:     return counts

      /* "lib.pyx":1115
     *                 counts[labels[i], j] += 1
     *
     *     return counts             # <<<<<<<<<<<<<<
     *
     * cdef class _PandasNull:
     */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_counts));
      __pyx_r = ((PyObject *)__pyx_v_counts);
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.count_level_2d", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF((PyObject *)__pyx_v_counts);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_11_PandasNull_1__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/
    static PyObject *__pyx_pw_3lib_11_PandasNull_1__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_self), __pyx_ptype_3lib__PandasNull, 1, "self", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_11_PandasNull___richcmp__(((struct __pyx_obj_3lib__PandasNull *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((int)__pyx_v_op));
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     1116:

     1117: cdef class _PandasNull:

    /* "lib.pyx":1117
     *     return counts
     *
     * cdef class _PandasNull:             # <<<<<<<<<<<<<<
     *
     *     def __richcmp__(_PandasNull self, object other, int op):
     */
    struct __pyx_obj_3lib__PandasNull {
      PyObject_HEAD
    };

     1118:

     1119:     def __richcmp__(_PandasNull self, object other, int op):

    /* "lib.pyx":1119
     * cdef class _PandasNull:
     *
     *     def __richcmp__(_PandasNull self, object other, int op):             # <<<<<<<<<<<<<<
     *         if op == 2: # ==
     *             return isinstance(other, _PandasNull)
     */

    static PyObject *__pyx_pf_3lib_11_PandasNull___richcmp__(CYTHON_UNUSED struct __pyx_obj_3lib__PandasNull *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__richcmp__", 0);

     1120:         if op == 2: # ==

        /* "lib.pyx":1120
     *
     *     def __richcmp__(_PandasNull self, object other, int op):
     *         if op == 2: # ==             # <<<<<<<<<<<<<<
     *             return isinstance(other, _PandasNull)
     *         elif op == 3: # !=
     */
        case 2:

     1121:             return isinstance(other, _PandasNull)

        /* "lib.pyx":1121
     *     def __richcmp__(_PandasNull self, object other, int op):
     *         if op == 2: # ==
     *             return isinstance(other, _PandasNull)             # <<<<<<<<<<<<<<
     *         elif op == 3: # !=
     *             return not isinstance(other, _PandasNull)
     */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_3lib__PandasNull));
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, __pyx_t_1);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_r = __pyx_t_1;
        __pyx_t_1 = 0;
        goto __pyx_L0;
        break;

     1122:         elif op == 3: # !=

      /* "lib.pyx":1122
     *         if op == 2: # ==
     *             return isinstance(other, _PandasNull)
     *         elif op == 3: # !=             # <<<<<<<<<<<<<<
     *             return not isinstance(other, _PandasNull)
     *         else:
     */
      switch (__pyx_v_op) {

        /* "lib.pyx":1122
     *         if op == 2: # ==
     *             return isinstance(other, _PandasNull)
     *         elif op == 3: # !=             # <<<<<<<<<<<<<<
     *             return not isinstance(other, _PandasNull)
     *         else:
     */
        case 3:

     1123:             return not isinstance(other, _PandasNull)

        /* "lib.pyx":1123
     *             return isinstance(other, _PandasNull)
     *         elif op == 3: # !=
     *             return not isinstance(other, _PandasNull)             # <<<<<<<<<<<<<<
     *         else:
     *             return False
     */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_3lib__PandasNull));
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, __pyx_t_1);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyBool_FromLong((!__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_r = __pyx_t_1;
        __pyx_t_1 = 0;
        goto __pyx_L0;
        break;
        default:

     1124:         else:

     1125:             return False

        /* "lib.pyx":1125
     *             return not isinstance(other, _PandasNull)
     *         else:
     *             return False             # <<<<<<<<<<<<<<
     *
     *     def __hash__(self):
     */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_r = __pyx_t_1;
        __pyx_t_1 = 0;
        goto __pyx_L0;
        break;
      }

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("lib._PandasNull.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static Py_hash_t __pyx_pw_3lib_11_PandasNull_3__hash__(PyObject *__pyx_v_self); /*proto*/
    static Py_hash_t __pyx_pw_3lib_11_PandasNull_3__hash__(PyObject *__pyx_v_self) {
      Py_hash_t __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0);
      __pyx_r = __pyx_pf_3lib_11_PandasNull_2__hash__(((struct __pyx_obj_3lib__PandasNull *)__pyx_v_self));
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     1126:

     1127:     def __hash__(self):

    /* "lib.pyx":1127
     *             return False
     *
     *     def __hash__(self):             # <<<<<<<<<<<<<<
     *         return 0
     *
     */

    static Py_hash_t __pyx_pf_3lib_11_PandasNull_2__hash__(CYTHON_UNUSED struct __pyx_obj_3lib__PandasNull *__pyx_v_self) {
      Py_hash_t __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__hash__", 0);

     1128:         return 0

      /* "lib.pyx":1128
     *
     *     def __hash__(self):
     *         return 0             # <<<<<<<<<<<<<<
     *
     * pandas_null = _PandasNull()
     */
      __pyx_r = 0;
      goto __pyx_L0;

      __pyx_r = 0;
      __pyx_L0:;
      if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_95fast_zip_fillna(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_3lib_94fast_zip_fillna[] = "\n    For zipping multiple ndarrays into an ndarray of tuples\n    ";
    static PyMethodDef __pyx_mdef_3lib_95fast_zip_fillna = {__Pyx_NAMESTR("fast_zip_fillna"), (PyCFunction)__pyx_pw_3lib_95fast_zip_fillna, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3lib_94fast_zip_fillna)};
    static PyObject *__pyx_pw_3lib_95fast_zip_fillna(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_ndarrays = 0;
      PyObject *__pyx_v_fill_value = 0;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("fast_zip_fillna (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__ndarrays,&__pyx_n_s__fill_value,0};
        PyObject* values[2] = {0,0};
        values[1] = __pyx_k_19;
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ndarrays)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            case  1:
            if (kw_args > 0) {
              PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fill_value);
              if (value) { values[1] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fast_zip_fillna") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_ndarrays = ((PyObject*)values[0]);
        __pyx_v_fill_value = values[1];
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("fast_zip_fillna", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_L3_error:;
      __Pyx_AddTraceback("lib.fast_zip_fillna", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ndarrays), (&PyList_Type), 1, "ndarrays", 1))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_94fast_zip_fillna(__pyx_self, __pyx_v_ndarrays, __pyx_v_fill_value);
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     1129:

     1130: pandas_null = _PandasNull()

      /* "lib.pyx":1130
     *         return 0
     *
     * pandas_null = _PandasNull()             # <<<<<<<<<<<<<<
     *
     * def fast_zip_fillna(list ndarrays, fill_value=pandas_null):
     */
      __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3lib__PandasNull)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pandas_null, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     1131:

     1132: def fast_zip_fillna(list ndarrays, fill_value=pandas_null):

    /* "lib.pyx":1132
     * pandas_null = _PandasNull()
     *
     * def fast_zip_fillna(list ndarrays, fill_value=pandas_null):             # <<<<<<<<<<<<<<
     *     '''
     *     For zipping multiple ndarrays into an ndarray of tuples
     */

    static PyObject *__pyx_pf_3lib_94fast_zip_fillna(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ndarrays, PyObject *__pyx_v_fill_value) {
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_j;
      Py_ssize_t __pyx_v_k;
      Py_ssize_t __pyx_v_n;
      PyArrayObject *__pyx_v_result = 0;
      PyArrayIterObject *__pyx_v_it = 0;
      PyObject *__pyx_v_val = 0;
      PyObject *__pyx_v_tup = 0;
      PyObject *__pyx_v_arr = NULL;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
      __Pyx_Buffer __pyx_pybuffer_result;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("fast_zip_fillna", 0);
      __pyx_pybuffer_result.pybuffer.buf = NULL;
      __pyx_pybuffer_result.refcount = 0;
      __pyx_pybuffernd_result.data = NULL;
      __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;

      /* "lib.pyx":1132
     * pandas_null = _PandasNull()
     *
     * def fast_zip_fillna(list ndarrays, fill_value=pandas_null):             # <<<<<<<<<<<<<<
     *     '''
     *     For zipping multiple ndarrays into an ndarray of tuples
     */
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__pandas_null); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_k_19 = __pyx_t_2;
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;

      /* "lib.pyx":1132
     * pandas_null = _PandasNull()
     *
     * def fast_zip_fillna(list ndarrays, fill_value=pandas_null):             # <<<<<<<<<<<<<<
     *     '''
     *     For zipping multiple ndarrays into an ndarray of tuples
     */
      __pyx_k_tuple_190 = PyTuple_New(11); if (unlikely(!__pyx_k_tuple_190)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_190);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__ndarrays));
      PyTuple_SET_ITEM(__pyx_k_tuple_190, 0, ((PyObject *)__pyx_n_s__ndarrays));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ndarrays));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_value));
      PyTuple_SET_ITEM(__pyx_k_tuple_190, 1, ((PyObject *)__pyx_n_s__fill_value));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_value));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_190, 2, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
      PyTuple_SET_ITEM(__pyx_k_tuple_190, 3, ((PyObject *)__pyx_n_s__j));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
      PyTuple_SET_ITEM(__pyx_k_tuple_190, 4, ((PyObject *)__pyx_n_s__k));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_190, 5, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
      PyTuple_SET_ITEM(__pyx_k_tuple_190, 6, ((PyObject *)__pyx_n_s__result));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__it));
      PyTuple_SET_ITEM(__pyx_k_tuple_190, 7, ((PyObject *)__pyx_n_s__it));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__it));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
      PyTuple_SET_ITEM(__pyx_k_tuple_190, 8, ((PyObject *)__pyx_n_s__val));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__tup));
      PyTuple_SET_ITEM(__pyx_k_tuple_190, 9, ((PyObject *)__pyx_n_s__tup));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tup));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__arr));
      PyTuple_SET_ITEM(__pyx_k_tuple_190, 10, ((PyObject *)__pyx_n_s__arr));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__arr));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_190));
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_95fast_zip_fillna, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__fast_zip_fillna, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_191 = (PyObject*)__Pyx_PyCode_New(2, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_190, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__fast_zip_fillna, 1132, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_191)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     1133:     '''

     1134:     For zipping multiple ndarrays into an ndarray of tuples

     1135:     '''

     1136:     cdef:

     1137:         Py_ssize_t i, j, k, n

     1138:         ndarray[object] result

     1139:         flatiter it

     1140:         object val, tup

     1141:

     1142:     k = len(ndarrays)

      /* "lib.pyx":1142
     *         object val, tup
     *
     *     k = len(ndarrays)             # <<<<<<<<<<<<<<
     *     n = len(ndarrays[0])
     *
     */
      if (unlikely(((PyObject *)__pyx_v_ndarrays) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_1 = PyList_GET_SIZE(((PyObject *)__pyx_v_ndarrays)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_k = __pyx_t_1;

     1143:     n = len(ndarrays[0])

      /* "lib.pyx":1143
     *
     *     k = len(ndarrays)
     *     n = len(ndarrays[0])             # <<<<<<<<<<<<<<
     *
     *     result = np.empty(n, dtype=object)
     */
      if (unlikely(((PyObject *)__pyx_v_ndarrays) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_ndarrays), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_n = __pyx_t_1;

     1144:

     1145:     result = np.empty(n, dtype=object)

      /* "lib.pyx":1145
     *     n = len(ndarrays[0])
     *
     *     result = np.empty(n, dtype=object)             # <<<<<<<<<<<<<<
     *
     *     # initialize tuples on first pass
     */
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
        __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_7 < 0)) {
          PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
          }
        }
        __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_6 = 0;
      __pyx_v_result = ((PyArrayObject *)__pyx_t_5);
      __pyx_t_5 = 0;

     1146:

     1147:     # initialize tuples on first pass

     1148:     arr = ndarrays[0]

      /* "lib.pyx":1148
     *
     *     # initialize tuples on first pass
     *     arr = ndarrays[0]             # <<<<<<<<<<<<<<
     *     it = <flatiter> PyArray_IterNew(arr)
     *     for i in range(n):
     */
      if (unlikely(((PyObject *)__pyx_v_ndarrays) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_5 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_ndarrays), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_arr = __pyx_t_5;
      __pyx_t_5 = 0;

     1149:     it = <flatiter> PyArray_IterNew(arr)

      /* "lib.pyx":1149
     *     # initialize tuples on first pass
     *     arr = ndarrays[0]
     *     it = <flatiter> PyArray_IterNew(arr)             # <<<<<<<<<<<<<<
     *     for i in range(n):
     *         val = PyArray_GETITEM(arr, PyArray_ITER_DATA(it))
     */
      __pyx_t_5 = PyArray_IterNew(__pyx_v_arr); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = __pyx_t_5;
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_it = ((PyArrayIterObject *)__pyx_t_2);
      __pyx_t_2 = 0;

     1150:     for i in range(n):

      /* "lib.pyx":1150
     *     arr = ndarrays[0]
     *     it = <flatiter> PyArray_IterNew(arr)
     *     for i in range(n):             # <<<<<<<<<<<<<<
     *         val = PyArray_GETITEM(arr, PyArray_ITER_DATA(it))
     *         tup = PyTuple_New(k)
     */
      __pyx_t_1 = __pyx_v_n;
      for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_1; __pyx_t_11+=1) {
        __pyx_v_i = __pyx_t_11;

     1151:         val = PyArray_GETITEM(arr, PyArray_ITER_DATA(it))

        /* "lib.pyx":1151
     *     it = <flatiter> PyArray_IterNew(arr)
     *     for i in range(n):
     *         val = PyArray_GETITEM(arr, PyArray_ITER_DATA(it))             # <<<<<<<<<<<<<<
     *         tup = PyTuple_New(k)
     *
     */
        if (!(likely(((__pyx_v_arr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_arr, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_2 = __pyx_v_arr;
        __Pyx_INCREF(__pyx_t_2);
        __pyx_t_5 = PyArray_GETITEM(((PyArrayObject *)__pyx_t_2), PyArray_ITER_DATA(__pyx_v_it)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_v_val);
        __pyx_v_val = __pyx_t_5;
        __pyx_t_5 = 0;

     1152:         tup = PyTuple_New(k)

        /* "lib.pyx":1152
     *     for i in range(n):
     *         val = PyArray_GETITEM(arr, PyArray_ITER_DATA(it))
     *         tup = PyTuple_New(k)             # <<<<<<<<<<<<<<
     *
     *         if val != val:
     */
        __pyx_t_5 = ((PyObject *)PyTuple_New(__pyx_v_k)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_XDECREF(__pyx_v_tup);
        __pyx_v_tup = __pyx_t_5;
        __pyx_t_5 = 0;

     1153:

     1154:         if val != val:

        /* "lib.pyx":1154
     *         tup = PyTuple_New(k)
     *
     *         if val != val:             # <<<<<<<<<<<<<<
     *             val = fill_value
     *
     */
        __pyx_t_5 = PyObject_RichCompare(__pyx_v_val, __pyx_v_val, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (__pyx_t_12) {

     1155:             val = fill_value

          /* "lib.pyx":1155
     *
     *         if val != val:
     *             val = fill_value             # <<<<<<<<<<<<<<
     *
     *         PyTuple_SET_ITEM(tup, 0, val)
     */
          __Pyx_INCREF(__pyx_v_fill_value);
          __Pyx_DECREF(__pyx_v_val);
          __pyx_v_val = __pyx_v_fill_value;
          goto __pyx_L5;
        }
        __pyx_L5:;

     1156:

     1157:         PyTuple_SET_ITEM(tup, 0, val)

        /* "lib.pyx":1157
     *             val = fill_value
     *
     *         PyTuple_SET_ITEM(tup, 0, val)             # <<<<<<<<<<<<<<
     *         Py_INCREF(val)
     *         result[i] = tup
     */
        PyTuple_SET_ITEM(__pyx_v_tup, 0, __pyx_v_val);

     1158:         Py_INCREF(val)

        /* "lib.pyx":1158
     *
     *         PyTuple_SET_ITEM(tup, 0, val)
     *         Py_INCREF(val)             # <<<<<<<<<<<<<<
     *         result[i] = tup
     *         PyArray_ITER_NEXT(it)
     */
        Py_INCREF(__pyx_v_val);

     1159:         result[i] = tup

        /* "lib.pyx":1159
     *         PyTuple_SET_ITEM(tup, 0, val)
     *         Py_INCREF(val)
     *         result[i] = tup             # <<<<<<<<<<<<<<
     *         PyArray_ITER_NEXT(it)
     *
     */
        __pyx_t_13 = __pyx_v_i;
        __pyx_t_7 = -1;
        if (__pyx_t_13 < 0) {
          __pyx_t_13 += __pyx_pybuffernd_result.diminfo[0].shape;
          if (unlikely(__pyx_t_13 < 0)) __pyx_t_7 = 0;
        } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_result.diminfo[0].shape)) __pyx_t_7 = 0;
        if (unlikely(__pyx_t_7 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_7);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_14 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_result.diminfo[0].strides);
        __Pyx_GOTREF(*__pyx_t_14);
        __Pyx_INCREF(__pyx_v_tup); __Pyx_DECREF(*__pyx_t_14);
        *__pyx_t_14 = __pyx_v_tup;
        __Pyx_GIVEREF(*__pyx_t_14);

     1160:         PyArray_ITER_NEXT(it)

        /* "lib.pyx":1160
     *         Py_INCREF(val)
     *         result[i] = tup
     *         PyArray_ITER_NEXT(it)             # <<<<<<<<<<<<<<
     *
     *     for j in range(1, k):
     */
        PyArray_ITER_NEXT(__pyx_v_it);
      }

     1161:

     1162:     for j in range(1, k):

      /* "lib.pyx":1162
     *         PyArray_ITER_NEXT(it)
     *
     *     for j in range(1, k):             # <<<<<<<<<<<<<<
     *         arr = ndarrays[j]
     *         it = <flatiter> PyArray_IterNew(arr)
     */
      __pyx_t_1 = __pyx_v_k;
      for (__pyx_t_11 = 1; __pyx_t_11 < __pyx_t_1; __pyx_t_11+=1) {
        __pyx_v_j = __pyx_t_11;

     1163:         arr = ndarrays[j]

        /* "lib.pyx":1163
     *
     *     for j in range(1, k):
     *         arr = ndarrays[j]             # <<<<<<<<<<<<<<
     *         it = <flatiter> PyArray_IterNew(arr)
     *         if len(arr) != n:
     */
        if (unlikely(((PyObject *)__pyx_v_ndarrays) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_5 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_ndarrays), __pyx_v_j, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_5) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_v_arr);
        __pyx_v_arr = __pyx_t_5;
        __pyx_t_5 = 0;

     1164:         it = <flatiter> PyArray_IterNew(arr)

        /* "lib.pyx":1164
     *     for j in range(1, k):
     *         arr = ndarrays[j]
     *         it = <flatiter> PyArray_IterNew(arr)             # <<<<<<<<<<<<<<
     *         if len(arr) != n:
     *             raise ValueError('all arrays must be same length')
     */
        __pyx_t_5 = PyArray_IterNew(__pyx_v_arr); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_2 = __pyx_t_5;
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_v_it));
        __pyx_v_it = ((PyArrayIterObject *)__pyx_t_2);
        __pyx_t_2 = 0;

     1165:         if len(arr) != n:

        /* "lib.pyx":1165
     *         arr = ndarrays[j]
     *         it = <flatiter> PyArray_IterNew(arr)
     *         if len(arr) != n:             # <<<<<<<<<<<<<<
     *             raise ValueError('all arrays must be same length')
     *
     */
        __pyx_t_15 = PyObject_Length(__pyx_v_arr); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_12 = (__pyx_t_15 != __pyx_v_n);
        if (__pyx_t_12) {

     1166:             raise ValueError('all arrays must be same length')

          /* "lib.pyx":1166
     *         it = <flatiter> PyArray_IterNew(arr)
     *         if len(arr) != n:
     *             raise ValueError('all arrays must be same length')             # <<<<<<<<<<<<<<
     *
     *         for i in range(n):
     */
          __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_Raise(__pyx_t_2, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          goto __pyx_L8;
        }
        __pyx_L8:;

      /* "lib.pyx":1166
     *         it = <flatiter> PyArray_IterNew(arr)
     *         if len(arr) != n:
     *             raise ValueError('all arrays must be same length')             # <<<<<<<<<<<<<<
     *
     *         for i in range(n):
     */
      __pyx_k_tuple_20 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_20);
      __Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
      PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, ((PyObject *)__pyx_kp_s_1));
      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20));

     1167:

     1168:         for i in range(n):

        /* "lib.pyx":1168
     *             raise ValueError('all arrays must be same length')
     *
     *         for i in range(n):             # <<<<<<<<<<<<<<
     *             val = PyArray_GETITEM(arr, PyArray_ITER_DATA(it))
     *             if val != val:
     */
        __pyx_t_15 = __pyx_v_n;
        for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
          __pyx_v_i = __pyx_t_16;

     1169:             val = PyArray_GETITEM(arr, PyArray_ITER_DATA(it))

          /* "lib.pyx":1169
     *
     *         for i in range(n):
     *             val = PyArray_GETITEM(arr, PyArray_ITER_DATA(it))             # <<<<<<<<<<<<<<
     *             if val != val:
     *                 val = fill_value
     */
          if (!(likely(((__pyx_v_arr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_arr, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __pyx_t_2 = __pyx_v_arr;
          __Pyx_INCREF(__pyx_t_2);
          __pyx_t_5 = PyArray_GETITEM(((PyArrayObject *)__pyx_t_2), PyArray_ITER_DATA(__pyx_v_it)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF(__pyx_v_val);
          __pyx_v_val = __pyx_t_5;
          __pyx_t_5 = 0;

     1170:             if val != val:

          /* "lib.pyx":1170
     *         for i in range(n):
     *             val = PyArray_GETITEM(arr, PyArray_ITER_DATA(it))
     *             if val != val:             # <<<<<<<<<<<<<<
     *                 val = fill_value
     *
     */
          __pyx_t_5 = PyObject_RichCompare(__pyx_v_val, __pyx_v_val, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (__pyx_t_12) {

     1171:                 val = fill_value

            /* "lib.pyx":1171
     *             val = PyArray_GETITEM(arr, PyArray_ITER_DATA(it))
     *             if val != val:
     *                 val = fill_value             # <<<<<<<<<<<<<<
     *
     *             PyTuple_SET_ITEM(result[i], j, val)
     */
            __Pyx_INCREF(__pyx_v_fill_value);
            __Pyx_DECREF(__pyx_v_val);
            __pyx_v_val = __pyx_v_fill_value;
            goto __pyx_L11;
          }
          __pyx_L11:;

     1172:

     1173:             PyTuple_SET_ITEM(result[i], j, val)

          /* "lib.pyx":1173
     *                 val = fill_value
     *
     *             PyTuple_SET_ITEM(result[i], j, val)             # <<<<<<<<<<<<<<
     *             Py_INCREF(val)
     *             PyArray_ITER_NEXT(it)
     */
          __pyx_t_17 = __pyx_v_i;
          __pyx_t_7 = -1;
          if (__pyx_t_17 < 0) {
            __pyx_t_17 += __pyx_pybuffernd_result.diminfo[0].shape;
            if (unlikely(__pyx_t_17 < 0)) __pyx_t_7 = 0;
          } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_result.diminfo[0].shape)) __pyx_t_7 = 0;
          if (unlikely(__pyx_t_7 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_7);
            {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_5 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_result.diminfo[0].strides);
          __Pyx_INCREF((PyObject*)__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_5, __pyx_v_j, __pyx_v_val);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

     1174:             Py_INCREF(val)

          /* "lib.pyx":1174
     *
     *             PyTuple_SET_ITEM(result[i], j, val)
     *             Py_INCREF(val)             # <<<<<<<<<<<<<<
     *             PyArray_ITER_NEXT(it)
     *
     */
          Py_INCREF(__pyx_v_val);

     1175:             PyArray_ITER_NEXT(it)

          /* "lib.pyx":1175
     *             PyTuple_SET_ITEM(result[i], j, val)
     *             Py_INCREF(val)
     *             PyArray_ITER_NEXT(it)             # <<<<<<<<<<<<<<
     *
     *     return result
     */
          PyArray_ITER_NEXT(__pyx_v_it);
        }
      }

     1176:

     1177:     return result

      /* "lib.pyx":1177
     *             PyArray_ITER_NEXT(it)
     *
     *     return result             # <<<<<<<<<<<<<<
     *
     * def duplicated(ndarray[object] values, take_last=False):
     */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_result));
      __pyx_r = ((PyObject *)__pyx_v_result);
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.fast_zip_fillna", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF((PyObject *)__pyx_v_result);
      __Pyx_XDECREF((PyObject *)__pyx_v_it);
      __Pyx_XDECREF(__pyx_v_val);
      __Pyx_XDECREF(__pyx_v_tup);
      __Pyx_XDECREF(__pyx_v_arr);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_97duplicated(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_97duplicated = {__Pyx_NAMESTR("duplicated"), (PyCFunction)__pyx_pw_3lib_97duplicated, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_97duplicated(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyArrayObject *__pyx_v_values = 0;
      PyObject *__pyx_v_take_last = 0;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("duplicated (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__take_last,0};
        PyObject* values[2] = {0,0};
        values[1] = __pyx_k_21;
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            case  1:
            if (kw_args > 0) {
              PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__take_last);
              if (value) { values[1] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "duplicated") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_values = ((PyArrayObject *)values[0]);
        __pyx_v_take_last = values[1];
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("duplicated", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_L3_error:;
      __Pyx_AddTraceback("lib.duplicated", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_96duplicated(__pyx_self, __pyx_v_values, __pyx_v_take_last);
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     1178:

     1179: def duplicated(ndarray[object] values, take_last=False):

    /* "lib.pyx":1179
     *     return result
     *
     * def duplicated(ndarray[object] values, take_last=False):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n
     */

    static PyObject *__pyx_pf_3lib_96duplicated(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyObject *__pyx_v_take_last) {
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_n;
      PyObject *__pyx_v_seen = 0;
      PyObject *__pyx_v_row = 0;
      PyArrayObject *__pyx_v_result = 0;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
      __Pyx_Buffer __pyx_pybuffer_result;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
      __Pyx_Buffer __pyx_pybuffer_values;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("duplicated", 0);
      __pyx_pybuffer_result.pybuffer.buf = NULL;
      __pyx_pybuffer_result.refcount = 0;
      __pyx_pybuffernd_result.data = NULL;
      __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
      __pyx_pybuffer_values.pybuffer.buf = NULL;
      __pyx_pybuffer_values.refcount = 0;
      __pyx_pybuffernd_values.data = NULL;
      __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0];

      /* "lib.pyx":1179
     *     return result
     *
     * def duplicated(ndarray[object] values, take_last=False):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n
     */
      __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_k_21 = __pyx_t_2;
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;

      /* "lib.pyx":1179
     *     return result
     *
     * def duplicated(ndarray[object] values, take_last=False):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, n
     */
      __pyx_k_tuple_192 = PyTuple_New(7); if (unlikely(!__pyx_k_tuple_192)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_192);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
      PyTuple_SET_ITEM(__pyx_k_tuple_192, 0, ((PyObject *)__pyx_n_s__values));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__take_last));
      PyTuple_SET_ITEM(__pyx_k_tuple_192, 1, ((PyObject *)__pyx_n_s__take_last));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__take_last));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_192, 2, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_192, 3, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__seen));
      PyTuple_SET_ITEM(__pyx_k_tuple_192, 4, ((PyObject *)__pyx_n_s__seen));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__seen));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__row));
      PyTuple_SET_ITEM(__pyx_k_tuple_192, 5, ((PyObject *)__pyx_n_s__row));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__row));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
      PyTuple_SET_ITEM(__pyx_k_tuple_192, 6, ((PyObject *)__pyx_n_s__result));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_192));
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_97duplicated, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__duplicated, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_193 = (PyObject*)__Pyx_PyCode_New(2, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_192, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__duplicated, 1179, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_193)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     1180:     cdef:

     1181:         Py_ssize_t i, n

     1182:         dict seen = {}

      /* "lib.pyx":1182
     *     cdef:
     *         Py_ssize_t i, n
     *         dict seen = {}             # <<<<<<<<<<<<<<
     *         object row
     *
     */
      __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __pyx_v_seen = __pyx_t_1;
      __pyx_t_1 = 0;

     1183:         object row

     1184:

     1185:     n = len(values)

      /* "lib.pyx":1185
     *         object row
     *
     *     n = len(values)             # <<<<<<<<<<<<<<
     *     cdef ndarray[uint8_t] result = np.zeros(n, dtype=np.uint8)
     *
     */
      __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_n = __pyx_t_2;

     1186:     cdef ndarray[uint8_t] result = np.zeros(n, dtype=np.uint8)

      /* "lib.pyx":1186
     *
     *     n = len(values)
     *     cdef ndarray[uint8_t] result = np.zeros(n, dtype=np.uint8)             # <<<<<<<<<<<<<<
     *
     *     if take_last:
     */
      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__uint8); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
          __pyx_v_result = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_result.rcbuffer->pybuffer.buf = NULL;
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        } else {__pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0];
        }
      }
      __pyx_t_7 = 0;
      __pyx_v_result = ((PyArrayObject *)__pyx_t_6);
      __pyx_t_6 = 0;

     1187:

     1188:     if take_last:

      /* "lib.pyx":1188
     *     cdef ndarray[uint8_t] result = np.zeros(n, dtype=np.uint8)
     *
     *     if take_last:             # <<<<<<<<<<<<<<
     *         for i from n > i >= 0:
     *             row = values[i]
     */
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_take_last); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__pyx_t_8) {

     1189:         for i from n > i >= 0:

        /* "lib.pyx":1189
     *
     *     if take_last:
     *         for i from n > i >= 0:             # <<<<<<<<<<<<<<
     *             row = values[i]
     *
     */
        for (__pyx_v_i = __pyx_v_n-1; __pyx_v_i >= 0; __pyx_v_i--) {

     1190:             row = values[i]

          /* "lib.pyx":1190
     *     if take_last:
     *         for i from n > i >= 0:
     *             row = values[i]             # <<<<<<<<<<<<<<
     *
     *             if row in seen:
     */
          __pyx_t_2 = __pyx_v_i;
          __pyx_t_9 = -1;
          if (__pyx_t_2 < 0) {
            __pyx_t_2 += __pyx_pybuffernd_values.diminfo[0].shape;
            if (unlikely(__pyx_t_2 < 0)) __pyx_t_9 = 0;
          } else if (unlikely(__pyx_t_2 >= __pyx_pybuffernd_values.diminfo[0].shape)) __pyx_t_9 = 0;
          if (unlikely(__pyx_t_9 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_9);
            {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_2, __pyx_pybuffernd_values.diminfo[0].strides);
          __Pyx_INCREF((PyObject*)__pyx_t_6);
          __Pyx_XDECREF(__pyx_v_row);
          __pyx_v_row = __pyx_t_6;
          __pyx_t_6 = 0;

     1191:

     1192:             if row in seen:

          /* "lib.pyx":1192
     *             row = values[i]
     *
     *             if row in seen:             # <<<<<<<<<<<<<<
     *                 result[i] = 1
     *             else:
     */
          __pyx_t_8 = (__Pyx_PyDict_Contains(__pyx_v_row, ((PyObject *)__pyx_v_seen), Py_EQ)); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          if (__pyx_t_8) {

     1193:                 result[i] = 1

            /* "lib.pyx":1193
     *
     *             if row in seen:
     *                 result[i] = 1             # <<<<<<<<<<<<<<
     *             else:
     *                 seen[row] = None
     */
            __pyx_t_10 = __pyx_v_i;
            __pyx_t_9 = -1;
            if (__pyx_t_10 < 0) {
              __pyx_t_10 += __pyx_pybuffernd_result.diminfo[0].shape;
              if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
            } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_result.diminfo[0].shape)) __pyx_t_9 = 0;
            if (unlikely(__pyx_t_9 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_9);
              {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_result.diminfo[0].strides) = 1;
            goto __pyx_L6;
          }
          /*else*/ {

     1194:             else:

     1195:                 seen[row] = None

            /* "lib.pyx":1195
     *                 result[i] = 1
     *             else:
     *                 seen[row] = None             # <<<<<<<<<<<<<<
     *                 result[i] = 0
     *     else:
     */
            if (PyDict_SetItem(((PyObject *)__pyx_v_seen), __pyx_v_row, Py_None) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     1196:                 result[i] = 0

            /* "lib.pyx":1196
     *             else:
     *                 seen[row] = None
     *                 result[i] = 0             # <<<<<<<<<<<<<<
     *     else:
     *         for i from 0 <= i < n:
     */
            __pyx_t_11 = __pyx_v_i;
            __pyx_t_9 = -1;
            if (__pyx_t_11 < 0) {
              __pyx_t_11 += __pyx_pybuffernd_result.diminfo[0].shape;
              if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 0;
            } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_result.diminfo[0].shape)) __pyx_t_9 = 0;
            if (unlikely(__pyx_t_9 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_9);
              {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_result.diminfo[0].strides) = 0;
          }
          __pyx_L6:;
        }
        goto __pyx_L3;
      }
      /*else*/ {

     1197:     else:

     1198:         for i from 0 <= i < n:

        /* "lib.pyx":1198
     *                 result[i] = 0
     *     else:
     *         for i from 0 <= i < n:             # <<<<<<<<<<<<<<
     *             row = values[i]
     *             if row in seen:
     */
        __pyx_t_12 = __pyx_v_n;
        for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_12; __pyx_v_i++) {

     1199:             row = values[i]

          /* "lib.pyx":1199
     *     else:
     *         for i from 0 <= i < n:
     *             row = values[i]             # <<<<<<<<<<<<<<
     *             if row in seen:
     *                 result[i] = 1
     */
          __pyx_t_13 = __pyx_v_i;
          __pyx_t_9 = -1;
          if (__pyx_t_13 < 0) {
            __pyx_t_13 += __pyx_pybuffernd_values.diminfo[0].shape;
            if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 0;
          } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_values.diminfo[0].shape)) __pyx_t_9 = 0;
          if (unlikely(__pyx_t_9 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_9);
            {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_values.diminfo[0].strides);
          __Pyx_INCREF((PyObject*)__pyx_t_6);
          __Pyx_XDECREF(__pyx_v_row);
          __pyx_v_row = __pyx_t_6;
          __pyx_t_6 = 0;

     1200:             if row in seen:

          /* "lib.pyx":1200
     *         for i from 0 <= i < n:
     *             row = values[i]
     *             if row in seen:             # <<<<<<<<<<<<<<
     *                 result[i] = 1
     *             else:
     */
          __pyx_t_8 = (__Pyx_PyDict_Contains(__pyx_v_row, ((PyObject *)__pyx_v_seen), Py_EQ)); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          if (__pyx_t_8) {

     1201:                 result[i] = 1

            /* "lib.pyx":1201
     *             row = values[i]
     *             if row in seen:
     *                 result[i] = 1             # <<<<<<<<<<<<<<
     *             else:
     *                 seen[row] = None
     */
            __pyx_t_14 = __pyx_v_i;
            __pyx_t_9 = -1;
            if (__pyx_t_14 < 0) {
              __pyx_t_14 += __pyx_pybuffernd_result.diminfo[0].shape;
              if (unlikely(__pyx_t_14 < 0)) __pyx_t_9 = 0;
            } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_result.diminfo[0].shape)) __pyx_t_9 = 0;
            if (unlikely(__pyx_t_9 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_9);
              {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_result.diminfo[0].strides) = 1;
            goto __pyx_L9;
          }
          /*else*/ {

     1202:             else:

     1203:                 seen[row] = None

            /* "lib.pyx":1203
     *                 result[i] = 1
     *             else:
     *                 seen[row] = None             # <<<<<<<<<<<<<<
     *                 result[i] = 0
     *
     */
            if (PyDict_SetItem(((PyObject *)__pyx_v_seen), __pyx_v_row, Py_None) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     1204:                 result[i] = 0

            /* "lib.pyx":1204
     *             else:
     *                 seen[row] = None
     *                 result[i] = 0             # <<<<<<<<<<<<<<
     *
     *     return result.view(np.bool_)
     */
            __pyx_t_15 = __pyx_v_i;
            __pyx_t_9 = -1;
            if (__pyx_t_15 < 0) {
              __pyx_t_15 += __pyx_pybuffernd_result.diminfo[0].shape;
              if (unlikely(__pyx_t_15 < 0)) __pyx_t_9 = 0;
            } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_result.diminfo[0].shape)) __pyx_t_9 = 0;
            if (unlikely(__pyx_t_9 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_9);
              {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_result.diminfo[0].strides) = 0;
          }
          __pyx_L9:;
        }
      }
      __pyx_L3:;

     1205:

     1206:     return result.view(np.bool_)

      /* "lib.pyx":1206
     *                 result[i] = 0
     *
     *     return result.view(np.bool_)             # <<<<<<<<<<<<<<
     *
     * def generate_slices(ndarray[int64_t] labels, Py_ssize_t ngroups):
     */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__view); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__bool_); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.duplicated", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF(__pyx_v_seen);
      __Pyx_XDECREF(__pyx_v_row);
      __Pyx_XDECREF((PyObject *)__pyx_v_result);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_99generate_slices(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_99generate_slices = {__Pyx_NAMESTR("generate_slices"), (PyCFunction)__pyx_pw_3lib_99generate_slices, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_99generate_slices(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyArrayObject *__pyx_v_labels = 0;
      Py_ssize_t __pyx_v_ngroups;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("generate_slices (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__labels,&__pyx_n_s__ngroups,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__labels)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            case  1:
            if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ngroups)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("generate_slices", 1, 2, 2, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "generate_slices") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        }
        __pyx_v_labels = ((PyArrayObject *)values[0]);
        __pyx_v_ngroups = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_ngroups == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("generate_slices", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_L3_error:;
      __Pyx_AddTraceback("lib.generate_slices", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_labels), __pyx_ptype_5numpy_ndarray, 1, "labels", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_98generate_slices(__pyx_self, __pyx_v_labels, __pyx_v_ngroups);
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     1207:

     1208: def generate_slices(ndarray[int64_t] labels, Py_ssize_t ngroups):

    /* "lib.pyx":1208
     *     return result.view(np.bool_)
     *
     * def generate_slices(ndarray[int64_t] labels, Py_ssize_t ngroups):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, group_size, n, lab, start
     */

    static PyObject *__pyx_pf_3lib_98generate_slices(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_labels, Py_ssize_t __pyx_v_ngroups) {
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_group_size;
      Py_ssize_t __pyx_v_n;
      Py_ssize_t __pyx_v_lab;
      Py_ssize_t __pyx_v_start;
      PyArrayObject *__pyx_v_starts = 0;
      PyObject *__pyx_v_ends = NULL;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_labels;
      __Pyx_Buffer __pyx_pybuffer_labels;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_starts;
      __Pyx_Buffer __pyx_pybuffer_starts;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("generate_slices", 0);
      __pyx_pybuffer_starts.pybuffer.buf = NULL;
      __pyx_pybuffer_starts.refcount = 0;
      __pyx_pybuffernd_starts.data = NULL;
      __pyx_pybuffernd_starts.rcbuffer = &__pyx_pybuffer_starts;
      __pyx_pybuffer_labels.pybuffer.buf = NULL;
      __pyx_pybuffer_labels.refcount = 0;
      __pyx_pybuffernd_labels.data = NULL;
      __pyx_pybuffernd_labels.rcbuffer = &__pyx_pybuffer_labels;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_labels.rcbuffer->pybuffer, (PyObject*)__pyx_v_labels, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_labels.diminfo[0].strides = __pyx_pybuffernd_labels.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_labels.diminfo[0].shape = __pyx_pybuffernd_labels.rcbuffer->pybuffer.shape[0];

      /* "lib.pyx":1208
     *     return result.view(np.bool_)
     *
     * def generate_slices(ndarray[int64_t] labels, Py_ssize_t ngroups):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, group_size, n, lab, start
     */
      __pyx_k_tuple_194 = PyTuple_New(10); if (unlikely(!__pyx_k_tuple_194)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_194);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__labels));
      PyTuple_SET_ITEM(__pyx_k_tuple_194, 0, ((PyObject *)__pyx_n_s__labels));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__labels));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__ngroups));
      PyTuple_SET_ITEM(__pyx_k_tuple_194, 1, ((PyObject *)__pyx_n_s__ngroups));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ngroups));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_194, 2, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__group_size));
      PyTuple_SET_ITEM(__pyx_k_tuple_194, 3, ((PyObject *)__pyx_n_s__group_size));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__group_size));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_194, 4, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__lab));
      PyTuple_SET_ITEM(__pyx_k_tuple_194, 5, ((PyObject *)__pyx_n_s__lab));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lab));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__start));
      PyTuple_SET_ITEM(__pyx_k_tuple_194, 6, ((PyObject *)__pyx_n_s__start));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__start));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__slobj));
      PyTuple_SET_ITEM(__pyx_k_tuple_194, 7, ((PyObject *)__pyx_n_s__slobj));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__slobj));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__starts));
      PyTuple_SET_ITEM(__pyx_k_tuple_194, 8, ((PyObject *)__pyx_n_s__starts));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__starts));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__ends));
      PyTuple_SET_ITEM(__pyx_k_tuple_194, 9, ((PyObject *)__pyx_n_s__ends));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ends));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_194));

      /* "lib.pyx":1208
     *     return result.view(np.bool_)
     *
     * def generate_slices(ndarray[int64_t] labels, Py_ssize_t ngroups):             # <<<<<<<<<<<<<<
     *     cdef:
     *         Py_ssize_t i, group_size, n, lab, start
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_99generate_slices, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__generate_slices, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_195 = (PyObject*)__Pyx_PyCode_New(2, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_194, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__generate_slices, 1208, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_195)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     1209:     cdef:

     1210:         Py_ssize_t i, group_size, n, lab, start

     1211:         object slobj

     1212:         ndarray[int64_t] starts

     1213:

     1214:     n = len(labels)

      /* "lib.pyx":1214
     *         ndarray[int64_t] starts
     *
     *     n = len(labels)             # <<<<<<<<<<<<<<
     *
     *     starts = np.zeros(ngroups, dtype=np.int64)
     */
      __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_labels)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_n = __pyx_t_1;

     1215:

     1216:     starts = np.zeros(ngroups, dtype=np.int64)

      /* "lib.pyx":1216
     *     n = len(labels)
     *
     *     starts = np.zeros(ngroups, dtype=np.int64)             # <<<<<<<<<<<<<<
     *     ends = np.zeros(ngroups, dtype=np.int64)
     *
     */
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_ngroups); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_starts.rcbuffer->pybuffer);
        __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_starts.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_8 < 0)) {
          PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_starts.rcbuffer->pybuffer, (PyObject*)__pyx_v_starts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
          }
        }
        __pyx_pybuffernd_starts.diminfo[0].strides = __pyx_pybuffernd_starts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_starts.diminfo[0].shape = __pyx_pybuffernd_starts.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_7 = 0;
      __pyx_v_starts = ((PyArrayObject *)__pyx_t_6);
      __pyx_t_6 = 0;

     1217:     ends = np.zeros(ngroups, dtype=np.int64)

      /* "lib.pyx":1217
     *
     *     starts = np.zeros(ngroups, dtype=np.int64)
     *     ends = np.zeros(ngroups, dtype=np.int64)             # <<<<<<<<<<<<<<
     *
     *     start = 0
     */
      __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_2 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_ngroups); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__int64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __pyx_v_ends = __pyx_t_5;
      __pyx_t_5 = 0;

     1218:

     1219:     start = 0

      /* "lib.pyx":1219
     *     ends = np.zeros(ngroups, dtype=np.int64)
     *
     *     start = 0             # <<<<<<<<<<<<<<
     *     group_size = 0
     *     for i in range(n):
     */
      __pyx_v_start = 0;

     1220:     group_size = 0

      /* "lib.pyx":1220
     *
     *     start = 0
     *     group_size = 0             # <<<<<<<<<<<<<<
     *     for i in range(n):
     *         group_size += 1
     */
      __pyx_v_group_size = 0;

     1221:     for i in range(n):

      /* "lib.pyx":1221
     *     start = 0
     *     group_size = 0
     *     for i in range(n):             # <<<<<<<<<<<<<<
     *         group_size += 1
     *         lab = labels[i]
     */
      __pyx_t_1 = __pyx_v_n;
      for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_1; __pyx_t_12+=1) {
        __pyx_v_i = __pyx_t_12;

     1222:         group_size += 1

        /* "lib.pyx":1222
     *     group_size = 0
     *     for i in range(n):
     *         group_size += 1             # <<<<<<<<<<<<<<
     *         lab = labels[i]
     *         if i == n - 1 or lab != labels[i + 1]:
     */
        __pyx_v_group_size = (__pyx_v_group_size + 1);

     1223:         lab = labels[i]

        /* "lib.pyx":1223
     *     for i in range(n):
     *         group_size += 1
     *         lab = labels[i]             # <<<<<<<<<<<<<<
     *         if i == n - 1 or lab != labels[i + 1]:
     *             starts[lab] = start
     */
        __pyx_t_13 = __pyx_v_i;
        __pyx_t_8 = -1;
        if (__pyx_t_13 < 0) {
          __pyx_t_13 += __pyx_pybuffernd_labels.diminfo[0].shape;
          if (unlikely(__pyx_t_13 < 0)) __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_labels.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_v_lab = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_labels.diminfo[0].strides));

     1224:         if i == n - 1 or lab != labels[i + 1]:

        /* "lib.pyx":1224
     *         group_size += 1
     *         lab = labels[i]
     *         if i == n - 1 or lab != labels[i + 1]:             # <<<<<<<<<<<<<<
     *             starts[lab] = start
     *             ends[lab] = start + group_size
     */
        __pyx_t_14 = (__pyx_v_i == (__pyx_v_n - 1));
        if (!__pyx_t_14) {
          __pyx_t_15 = (__pyx_v_i + 1);
          __pyx_t_8 = -1;
          if (__pyx_t_15 < 0) {
            __pyx_t_15 += __pyx_pybuffernd_labels.diminfo[0].shape;
            if (unlikely(__pyx_t_15 < 0)) __pyx_t_8 = 0;
          } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_labels.diminfo[0].shape)) __pyx_t_8 = 0;
          if (unlikely(__pyx_t_8 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_8);
            {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_16 = (__pyx_v_lab != (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_labels.diminfo[0].strides)));
          __pyx_t_17 = __pyx_t_16;
        } else {
          __pyx_t_17 = __pyx_t_14;
        }
        if (__pyx_t_17) {

     1225:             starts[lab] = start

          /* "lib.pyx":1225
     *         lab = labels[i]
     *         if i == n - 1 or lab != labels[i + 1]:
     *             starts[lab] = start             # <<<<<<<<<<<<<<
     *             ends[lab] = start + group_size
     *             start += group_size
     */
          __pyx_t_18 = __pyx_v_lab;
          __pyx_t_8 = -1;
          if (__pyx_t_18 < 0) {
            __pyx_t_18 += __pyx_pybuffernd_starts.diminfo[0].shape;
            if (unlikely(__pyx_t_18 < 0)) __pyx_t_8 = 0;
          } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_starts.diminfo[0].shape)) __pyx_t_8 = 0;
          if (unlikely(__pyx_t_8 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_8);
            {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_starts.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_starts.diminfo[0].strides) = __pyx_v_start;

     1226:             ends[lab] = start + group_size

          /* "lib.pyx":1226
     *         if i == n - 1 or lab != labels[i + 1]:
     *             starts[lab] = start
     *             ends[lab] = start + group_size             # <<<<<<<<<<<<<<
     *             start += group_size
     *             group_size = 0
     */
          __pyx_t_5 = PyInt_FromSsize_t((__pyx_v_start + __pyx_v_group_size)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_5);
          if (__Pyx_SetItemInt(__pyx_v_ends, __pyx_v_lab, __pyx_t_5, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

     1227:             start += group_size

          /* "lib.pyx":1227
     *             starts[lab] = start
     *             ends[lab] = start + group_size
     *             start += group_size             # <<<<<<<<<<<<<<
     *             group_size = 0
     *
     */
          __pyx_v_start = (__pyx_v_start + __pyx_v_group_size);

     1228:             group_size = 0

          /* "lib.pyx":1228
     *             ends[lab] = start + group_size
     *             start += group_size
     *             group_size = 0             # <<<<<<<<<<<<<<
     *
     *     return starts, ends
     */
          __pyx_v_group_size = 0;
          goto __pyx_L5;
        }
        __pyx_L5:;
      }

     1229:

     1230:     return starts, ends

      /* "lib.pyx":1230
     *             group_size = 0
     *
     *     return starts, ends             # <<<<<<<<<<<<<<
     *
     *
     */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(((PyObject *)__pyx_v_starts));
      PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_starts));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_starts));
      __Pyx_INCREF(__pyx_v_ends);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_ends);
      __Pyx_GIVEREF(__pyx_v_ends);
      __pyx_r = ((PyObject *)__pyx_t_5);
      __pyx_t_5 = 0;
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_starts.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.generate_slices", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_starts.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF((PyObject *)__pyx_v_starts);
      __Pyx_XDECREF(__pyx_v_ends);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_3lib_101indices_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyMethodDef __pyx_mdef_3lib_101indices_fast = {__Pyx_NAMESTR("indices_fast"), (PyCFunction)__pyx_pw_3lib_101indices_fast, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pw_3lib_101indices_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_index = 0;
      PyArrayObject *__pyx_v_labels = 0;
      PyObject *__pyx_v_keys = 0;
      PyObject *__pyx_v_sorted_labels = 0;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("indices_fast (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__index,&__pyx_n_s__labels,&__pyx_n_s__keys,&__pyx_n_s__sorted_labels,0};
        PyObject* values[4] = {0,0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            case  1:
            if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__labels)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("indices_fast", 1, 4, 4, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
            case  2:
            if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__keys)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("indices_fast", 1, 4, 4, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
            case  3:
            if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sorted_labels)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("indices_fast", 1, 4, 4, 3); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "indices_fast") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
          values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
          values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        }
        __pyx_v_index = values[0];
        __pyx_v_labels = ((PyArrayObject *)values[1]);
        __pyx_v_keys = ((PyObject*)values[2]);
        __pyx_v_sorted_labels = ((PyObject*)values[3]);
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("indices_fast", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_L3_error:;
      __Pyx_AddTraceback("lib.indices_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_labels), __pyx_ptype_5numpy_ndarray, 1, "labels", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_keys), (&PyList_Type), 1, "keys", 1))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sorted_labels), (&PyList_Type), 1, "sorted_labels", 1))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_pf_3lib_100indices_fast(__pyx_self, __pyx_v_index, __pyx_v_labels, __pyx_v_keys, __pyx_v_sorted_labels);
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     1231:

     1232:

     1233: def indices_fast(object index, ndarray[int64_t] labels, list keys,

    /* "lib.pyx":1233
     *
     *
     * def indices_fast(object index, ndarray[int64_t] labels, list keys,             # <<<<<<<<<<<<<<
     *                  list sorted_labels):
     *     cdef:
     */

    static PyObject *__pyx_pf_3lib_100indices_fast(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_index, PyArrayObject *__pyx_v_labels, PyObject *__pyx_v_keys, PyObject *__pyx_v_sorted_labels) {
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_j;
      Py_ssize_t __pyx_v_k;
      Py_ssize_t __pyx_v_lab;
      Py_ssize_t __pyx_v_cur;
      Py_ssize_t __pyx_v_start;
      Py_ssize_t __pyx_v_n;
      PyObject *__pyx_v_result = 0;
      PyObject *__pyx_v_tup = 0;
      PyObject *__pyx_v_val = NULL;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_labels;
      __Pyx_Buffer __pyx_pybuffer_labels;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("indices_fast", 0);
      __pyx_pybuffer_labels.pybuffer.buf = NULL;
      __pyx_pybuffer_labels.refcount = 0;
      __pyx_pybuffernd_labels.data = NULL;
      __pyx_pybuffernd_labels.rcbuffer = &__pyx_pybuffer_labels;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_labels.rcbuffer->pybuffer, (PyObject*)__pyx_v_labels, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_pybuffernd_labels.diminfo[0].strides = __pyx_pybuffernd_labels.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_labels.diminfo[0].shape = __pyx_pybuffernd_labels.rcbuffer->pybuffer.shape[0];

      /* "lib.pyx":1233
     *
     *
     * def indices_fast(object index, ndarray[int64_t] labels, list keys,             # <<<<<<<<<<<<<<
     *                  list sorted_labels):
     *     cdef:
     */
      __pyx_k_tuple_196 = PyTuple_New(14); if (unlikely(!__pyx_k_tuple_196)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_k_tuple_196);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__index));
      PyTuple_SET_ITEM(__pyx_k_tuple_196, 0, ((PyObject *)__pyx_n_s__index));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__index));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__labels));
      PyTuple_SET_ITEM(__pyx_k_tuple_196, 1, ((PyObject *)__pyx_n_s__labels));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__labels));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__keys));
      PyTuple_SET_ITEM(__pyx_k_tuple_196, 2, ((PyObject *)__pyx_n_s__keys));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__keys));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__sorted_labels));
      PyTuple_SET_ITEM(__pyx_k_tuple_196, 3, ((PyObject *)__pyx_n_s__sorted_labels));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sorted_labels));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      PyTuple_SET_ITEM(__pyx_k_tuple_196, 4, ((PyObject *)__pyx_n_s__i));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
      PyTuple_SET_ITEM(__pyx_k_tuple_196, 5, ((PyObject *)__pyx_n_s__j));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
      PyTuple_SET_ITEM(__pyx_k_tuple_196, 6, ((PyObject *)__pyx_n_s__k));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__lab));
      PyTuple_SET_ITEM(__pyx_k_tuple_196, 7, ((PyObject *)__pyx_n_s__lab));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lab));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__cur));
      PyTuple_SET_ITEM(__pyx_k_tuple_196, 8, ((PyObject *)__pyx_n_s__cur));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cur));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__start));
      PyTuple_SET_ITEM(__pyx_k_tuple_196, 9, ((PyObject *)__pyx_n_s__start));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__start));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
      PyTuple_SET_ITEM(__pyx_k_tuple_196, 10, ((PyObject *)__pyx_n_s__n));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
      PyTuple_SET_ITEM(__pyx_k_tuple_196, 11, ((PyObject *)__pyx_n_s__result));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__tup));
      PyTuple_SET_ITEM(__pyx_k_tuple_196, 12, ((PyObject *)__pyx_n_s__tup));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tup));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
      PyTuple_SET_ITEM(__pyx_k_tuple_196, 13, ((PyObject *)__pyx_n_s__val));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
      __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_196));

      /* "lib.pyx":1233
     *
     *
     * def indices_fast(object index, ndarray[int64_t] labels, list keys,             # <<<<<<<<<<<<<<
     *                  list sorted_labels):
     *     cdef:
     */
      __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3lib_101indices_fast, NULL, __pyx_n_s__lib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__indices_fast, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_k_codeobj_197 = (PyObject*)__Pyx_PyCode_New(4, 0, 14, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_196, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_99, __pyx_n_s__indices_fast, 1233, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_197)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     1234:                  list sorted_labels):

     1235:     cdef:

     1236:         Py_ssize_t i, j, k, lab, cur, start, n = len(labels)

      /* "lib.pyx":1236
     *                  list sorted_labels):
     *     cdef:
     *         Py_ssize_t i, j, k, lab, cur, start, n = len(labels)             # <<<<<<<<<<<<<<
     *         dict result = {}
     *         object tup
     */
      __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_labels)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_n = __pyx_t_1;

     1237:         dict result = {}

      /* "lib.pyx":1237
     *     cdef:
     *         Py_ssize_t i, j, k, lab, cur, start, n = len(labels)
     *         dict result = {}             # <<<<<<<<<<<<<<
     *         object tup
     *
     */
      __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __pyx_v_result = __pyx_t_2;
      __pyx_t_2 = 0;

     1238:         object tup

     1239:

     1240:     k = len(keys)

      /* "lib.pyx":1240
     *         object tup
     *
     *     k = len(keys)             # <<<<<<<<<<<<<<
     *
     *     if n == 0:
     */
      if (unlikely(((PyObject *)__pyx_v_keys) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_1 = PyList_GET_SIZE(((PyObject *)__pyx_v_keys)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_k = __pyx_t_1;

     1241:

     1242:     if n == 0:

      /* "lib.pyx":1242
     *     k = len(keys)
     *
     *     if n == 0:             # <<<<<<<<<<<<<<
     *         return result
     *
     */
      __pyx_t_3 = (__pyx_v_n == 0);
      if (__pyx_t_3) {

     1243:         return result

        /* "lib.pyx":1243
     *
     *     if n == 0:
     *         return result             # <<<<<<<<<<<<<<
     *
     *     start = 0
     */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(((PyObject *)__pyx_v_result));
        __pyx_r = ((PyObject *)__pyx_v_result);
        goto __pyx_L0;
        goto __pyx_L3;
      }
      __pyx_L3:;

     1244:

     1245:     start = 0

      /* "lib.pyx":1245
     *         return result
     *
     *     start = 0             # <<<<<<<<<<<<<<
     *     cur = labels[0]
     *     for i in range(1, n):
     */
      __pyx_v_start = 0;

     1246:     cur = labels[0]

      /* "lib.pyx":1246
     *
     *     start = 0
     *     cur = labels[0]             # <<<<<<<<<<<<<<
     *     for i in range(1, n):
     *         lab = labels[i]
     */
      __pyx_t_4 = 0;
      __pyx_t_5 = -1;
      if (__pyx_t_4 < 0) {
        __pyx_t_4 += __pyx_pybuffernd_labels.diminfo[0].shape;
        if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
      } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_labels.diminfo[0].shape)) __pyx_t_5 = 0;
      if (unlikely(__pyx_t_5 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_5);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_cur = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_labels.diminfo[0].strides));

     1247:     for i in range(1, n):

      /* "lib.pyx":1247
     *     start = 0
     *     cur = labels[0]
     *     for i in range(1, n):             # <<<<<<<<<<<<<<
     *         lab = labels[i]
     *
     */
      __pyx_t_1 = __pyx_v_n;
      for (__pyx_t_6 = 1; __pyx_t_6 < __pyx_t_1; __pyx_t_6+=1) {
        __pyx_v_i = __pyx_t_6;

     1248:         lab = labels[i]

        /* "lib.pyx":1248
     *     cur = labels[0]
     *     for i in range(1, n):
     *         lab = labels[i]             # <<<<<<<<<<<<<<
     *
     *         if lab != cur:
     */
        __pyx_t_7 = __pyx_v_i;
        __pyx_t_5 = -1;
        if (__pyx_t_7 < 0) {
          __pyx_t_7 += __pyx_pybuffernd_labels.diminfo[0].shape;
          if (unlikely(__pyx_t_7 < 0)) __pyx_t_5 = 0;
        } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_labels.diminfo[0].shape)) __pyx_t_5 = 0;
        if (unlikely(__pyx_t_5 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_5);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_v_lab = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_labels.diminfo[0].strides));

     1249:

     1250:         if lab != cur:

        /* "lib.pyx":1250
     *         lab = labels[i]
     *
     *         if lab != cur:             # <<<<<<<<<<<<<<
     *             if lab != -1:
     *                 tup = PyTuple_New(k)
     */
        __pyx_t_3 = (__pyx_v_lab != __pyx_v_cur);
        if (__pyx_t_3) {

     1251:             if lab != -1:

          /* "lib.pyx":1251
     *
     *         if lab != cur:
     *             if lab != -1:             # <<<<<<<<<<<<<<
     *                 tup = PyTuple_New(k)
     *                 for j in range(k):
     */
          __pyx_t_3 = (__pyx_v_lab != -1);
          if (__pyx_t_3) {

     1252:                 tup = PyTuple_New(k)

            /* "lib.pyx":1252
     *         if lab != cur:
     *             if lab != -1:
     *                 tup = PyTuple_New(k)             # <<<<<<<<<<<<<<
     *                 for j in range(k):
     *                     val = util.get_value_at(keys[j],
     */
            __pyx_t_2 = ((PyObject *)PyTuple_New(__pyx_v_k)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_XDECREF(__pyx_v_tup);
            __pyx_v_tup = __pyx_t_2;
            __pyx_t_2 = 0;

     1253:                 for j in range(k):

            /* "lib.pyx":1253
     *             if lab != -1:
     *                 tup = PyTuple_New(k)
     *                 for j in range(k):             # <<<<<<<<<<<<<<
     *                     val = util.get_value_at(keys[j],
     *                                             sorted_labels[j][i-1])
     */
            __pyx_t_8 = __pyx_v_k;
            for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
              __pyx_v_j = __pyx_t_9;

     1254:                     val = util.get_value_at(keys[j],

              /* "lib.pyx":1254
     *                 tup = PyTuple_New(k)
     *                 for j in range(k):
     *                     val = util.get_value_at(keys[j],             # <<<<<<<<<<<<<<
     *                                             sorted_labels[j][i-1])
     *                     PyTuple_SET_ITEM(tup, j, val)
     */
              if (unlikely(((PyObject *)__pyx_v_keys) == Py_None)) {
                PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
                {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              }
              __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_keys), __pyx_v_j, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_2) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              __Pyx_GOTREF(__pyx_t_2);
              if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     1255:                                             sorted_labels[j][i-1])

              /* "lib.pyx":1255
     *                 for j in range(k):
     *                     val = util.get_value_at(keys[j],
     *                                             sorted_labels[j][i-1])             # <<<<<<<<<<<<<<
     *                     PyTuple_SET_ITEM(tup, j, val)
     *                     Py_INCREF(val)
     */
              if (unlikely(((PyObject *)__pyx_v_sorted_labels) == Py_None)) {
                PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
                {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              }
              __pyx_t_10 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_sorted_labels), __pyx_v_j, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_10) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              __Pyx_GOTREF(__pyx_t_10);
              __pyx_t_11 = (__pyx_v_i - 1);
              __pyx_t_12 = __Pyx_GetItemInt(__pyx_t_10, __pyx_t_11, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_12) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              __Pyx_GOTREF(__pyx_t_12);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              __pyx_t_10 = __pyx_f_4util_get_value_at(((PyArrayObject *)__pyx_t_2), __pyx_t_12); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
              __Pyx_XDECREF(__pyx_v_val);
              __pyx_v_val = __pyx_t_10;
              __pyx_t_10 = 0;

     1256:                     PyTuple_SET_ITEM(tup, j, val)

              /* "lib.pyx":1256
     *                     val = util.get_value_at(keys[j],
     *                                             sorted_labels[j][i-1])
     *                     PyTuple_SET_ITEM(tup, j, val)             # <<<<<<<<<<<<<<
     *                     Py_INCREF(val)
     *
     */
              PyTuple_SET_ITEM(__pyx_v_tup, __pyx_v_j, __pyx_v_val);

     1257:                     Py_INCREF(val)

              /* "lib.pyx":1257
     *                                             sorted_labels[j][i-1])
     *                     PyTuple_SET_ITEM(tup, j, val)
     *                     Py_INCREF(val)             # <<<<<<<<<<<<<<
     *
     *                 result[tup] = index[start:i]
     */
              Py_INCREF(__pyx_v_val);
            }

     1258:

     1259:                 result[tup] = index[start:i]

            /* "lib.pyx":1259
     *                     Py_INCREF(val)
     *
     *                 result[tup] = index[start:i]             # <<<<<<<<<<<<<<
     *             start = i
     *         cur = lab
     */
            __pyx_t_10 = __Pyx_PySequence_GetSlice(__pyx_v_index, __pyx_v_start, __pyx_v_i); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_10);
            if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_tup, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            goto __pyx_L7;
          }
          __pyx_L7:;

     1260:             start = i

          /* "lib.pyx":1260
     *
     *                 result[tup] = index[start:i]
     *             start = i             # <<<<<<<<<<<<<<
     *         cur = lab
     *
     */
          __pyx_v_start = __pyx_v_i;
          goto __pyx_L6;
        }
        __pyx_L6:;

     1261:         cur = lab

        /* "lib.pyx":1261
     *                 result[tup] = index[start:i]
     *             start = i
     *         cur = lab             # <<<<<<<<<<<<<<
     *
     *     tup = PyTuple_New(k)
     */
        __pyx_v_cur = __pyx_v_lab;
      }

     1262:

     1263:     tup = PyTuple_New(k)

      /* "lib.pyx":1263
     *         cur = lab
     *
     *     tup = PyTuple_New(k)             # <<<<<<<<<<<<<<
     *     for j in range(k):
     *         val = util.get_value_at(keys[j],
     */
      __pyx_t_10 = ((PyObject *)PyTuple_New(__pyx_v_k)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_XDECREF(__pyx_v_tup);
      __pyx_v_tup = __pyx_t_10;
      __pyx_t_10 = 0;

     1264:     for j in range(k):

      /* "lib.pyx":1264
     *
     *     tup = PyTuple_New(k)
     *     for j in range(k):             # <<<<<<<<<<<<<<
     *         val = util.get_value_at(keys[j],
     *                                 sorted_labels[j][n - 1])
     */
      __pyx_t_1 = __pyx_v_k;
      for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_1; __pyx_t_6+=1) {
        __pyx_v_j = __pyx_t_6;

     1265:         val = util.get_value_at(keys[j],

        /* "lib.pyx":1265
     *     tup = PyTuple_New(k)
     *     for j in range(k):
     *         val = util.get_value_at(keys[j],             # <<<<<<<<<<<<<<
     *                                 sorted_labels[j][n - 1])
     *         PyTuple_SET_ITEM(tup, j, val)
     */
        if (unlikely(((PyObject *)__pyx_v_keys) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_10 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_keys), __pyx_v_j, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_10) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_10);
        if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     1266:                                 sorted_labels[j][n - 1])

        /* "lib.pyx":1266
     *     for j in range(k):
     *         val = util.get_value_at(keys[j],
     *                                 sorted_labels[j][n - 1])             # <<<<<<<<<<<<<<
     *         PyTuple_SET_ITEM(tup, j, val)
     *         Py_INCREF(val)
     */
        if (unlikely(((PyObject *)__pyx_v_sorted_labels) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_12 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_sorted_labels), __pyx_v_j, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_12) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_8 = (__pyx_v_n - 1);
        __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_12, __pyx_t_8, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_2) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_12 = __pyx_f_4util_get_value_at(((PyArrayObject *)__pyx_t_10), __pyx_t_2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_v_val);
        __pyx_v_val = __pyx_t_12;
        __pyx_t_12 = 0;

     1267:         PyTuple_SET_ITEM(tup, j, val)

        /* "lib.pyx":1267
     *         val = util.get_value_at(keys[j],
     *                                 sorted_labels[j][n - 1])
     *         PyTuple_SET_ITEM(tup, j, val)             # <<<<<<<<<<<<<<
     *         Py_INCREF(val)
     *     result[tup] = index[start:]
     */
        PyTuple_SET_ITEM(__pyx_v_tup, __pyx_v_j, __pyx_v_val);

     1268:         Py_INCREF(val)

        /* "lib.pyx":1268
     *                                 sorted_labels[j][n - 1])
     *         PyTuple_SET_ITEM(tup, j, val)
     *         Py_INCREF(val)             # <<<<<<<<<<<<<<
     *     result[tup] = index[start:]
     *
     */
        Py_INCREF(__pyx_v_val);
      }

     1269:     result[tup] = index[start:]

      /* "lib.pyx":1269
     *         PyTuple_SET_ITEM(tup, j, val)
     *         Py_INCREF(val)
     *     result[tup] = index[start:]             # <<<<<<<<<<<<<<
     *
     *     return result
     */
      __pyx_t_12 = __Pyx_PySequence_GetSlice(__pyx_v_index, __pyx_v_start, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_12);
      if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_tup, __pyx_t_12) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

     1270:

     1271:     return result

      /* "lib.pyx":1271
     *     result[tup] = index[start:]
     *
     *     return result             # <<<<<<<<<<<<<<
     *
     * include "reduce.pyx"
     */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_result));
      __pyx_r = ((PyObject *)__pyx_v_result);
      goto __pyx_L0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_10);
      __Pyx_XDECREF(__pyx_t_12);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("lib.indices_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF(__pyx_v_result);
      __Pyx_XDECREF(__pyx_v_tup);
      __Pyx_XDECREF(__pyx_v_val);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static int __pyx_pw_3lib_7Reducer_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static int __pyx_pw_3lib_7Reducer_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_arr = 0;
      PyObject *__pyx_v_f = 0;
      PyObject *__pyx_v_axis = 0;
      PyObject *__pyx_v_dummy = 0;
      PyObject *__pyx_v_labels = 0;
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__arr,&__pyx_n_s__f,&__pyx_n_s__axis,&__pyx_n_s__dummy,&__pyx_n_s__labels,0};
        PyObject* values[5] = {0,0,0,0,0};
        values[2] = ((PyObject *)__pyx_int_1);

     1272:

     1273: include "reduce.pyx"

     1274: include "properties.pyx"

     1275: include "inference.pyx"