/* Generated by Cython 3.2.8 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "depends": [
            "extern/cryptoki.h",
            "extern/load_module.c"
        ],
        "include_dirs": [
            "pkcs11"
        ],
        "name": "pkcs11._pkcs11",
        "sources": [
            "pkcs11/_pkcs11.pyx"
        ]
    },
    "module_name": "pkcs11._pkcs11"
}
END: Cython Metadata */

#ifndef PY_SSIZE_T_CLEAN
#define PY_SSIZE_T_CLEAN
#endif /* PY_SSIZE_T_CLEAN */
/* InitLimitedAPI */
#if defined(Py_LIMITED_API)
  #if !defined(CYTHON_LIMITED_API)
  #define CYTHON_LIMITED_API 1
  #endif
#elif defined(CYTHON_LIMITED_API)
  #ifdef _MSC_VER
  #pragma message ("Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead.")
  #else
  #warning Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead.
  #endif
#endif

#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x03080000
    #error Cython requires Python 3.8+.
#else
#define __PYX_ABI_VERSION "3_2_8"
#define CYTHON_HEX_VERSION 0x030208F0
#define CYTHON_FUTURE_DIVISION 1
/* CModulePreamble */
#include <stddef.h>
#ifndef offsetof
  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#define __PYX_COMMA ,
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX
#if defined(GRAALVM_PYTHON)
  /* For very preliminary testing purposes. Most variables are set the same as PyPy.
     The existence of this section does not imply that anything works or is even tested */
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_LIMITED_API 0
  #define CYTHON_COMPILING_IN_GRAAL 1
  #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_TYPE_SPECS
  #define CYTHON_USE_TYPE_SPECS 0
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_ASSUME_SAFE_SIZE
  #define CYTHON_ASSUME_SAFE_SIZE 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_GIL
  #define CYTHON_FAST_GIL 0
  #undef CYTHON_METH_FASTCALL
  #define CYTHON_METH_FASTCALL 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #undef CYTHON_USE_MODULE_STATE
  #define CYTHON_USE_MODULE_STATE 0
  #undef CYTHON_USE_SYS_MONITORING
  #define CYTHON_USE_SYS_MONITORING 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_AM_SEND
  #define CYTHON_USE_AM_SEND 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 1
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  #endif
  #undef CYTHON_USE_FREELISTS
  #define CYTHON_USE_FREELISTS 0
  #undef CYTHON_IMMORTAL_CONSTANTS
  #define CYTHON_IMMORTAL_CONSTANTS 0
#elif defined(PYPY_VERSION)
  #define CYTHON_COMPILING_IN_PYPY 1
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_LIMITED_API 0
  #define CYTHON_COMPILING_IN_GRAAL 0
  #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 1
  #ifndef CYTHON_USE_TYPE_SPECS
    #define CYTHON_USE_TYPE_SPECS 0
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #ifndef CYTHON_ASSUME_SAFE_SIZE
    #define CYTHON_ASSUME_SAFE_SIZE 1
  #endif
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_GIL
  #define CYTHON_FAST_GIL 0
  #undef CYTHON_METH_FASTCALL
  #define CYTHON_METH_FASTCALL 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #if PY_VERSION_HEX < 0x03090000
    #undef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
    #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #endif
  #undef CYTHON_USE_MODULE_STATE
  #define CYTHON_USE_MODULE_STATE 0
  #undef CYTHON_USE_SYS_MONITORING
  #define CYTHON_USE_SYS_MONITORING 0
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE (PYPY_VERSION_NUM >= 0x07030C00)
  #endif
  #undef CYTHON_USE_AM_SEND
  #define CYTHON_USE_AM_SEND 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_NUM >= 0x07031100)
  #endif
  #undef CYTHON_USE_FREELISTS
  #define CYTHON_USE_FREELISTS 0
  #undef CYTHON_IMMORTAL_CONSTANTS
  #define CYTHON_IMMORTAL_CONSTANTS 0
#elif defined(CYTHON_LIMITED_API)
  #ifdef Py_LIMITED_API
    #undef __PYX_LIMITED_VERSION_HEX
    #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API
  #endif
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_LIMITED_API 1
  #define CYTHON_COMPILING_IN_GRAAL 0
  #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_TYPE_SPECS
  #define CYTHON_USE_TYPE_SPECS 1
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #endif
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
    #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0
  #endif
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_ASSUME_SAFE_SIZE
  #define CYTHON_ASSUME_SAFE_SIZE 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_GIL
  #define CYTHON_FAST_GIL 0
  #undef CYTHON_METH_FASTCALL
  #define CYTHON_METH_FASTCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000)
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #endif
  #ifndef CYTHON_USE_MODULE_STATE
    #define CYTHON_USE_MODULE_STATE 0
  #endif
  #undef CYTHON_USE_SYS_MONITORING
  #define CYTHON_USE_SYS_MONITORING 0
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE 0
  #endif
  #ifndef CYTHON_USE_AM_SEND
    #define CYTHON_USE_AM_SEND (__PYX_LIMITED_VERSION_HEX >= 0x030A0000)
  #endif
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  #endif
  #ifndef CYTHON_USE_FREELISTS
  #define CYTHON_USE_FREELISTS 1
  #endif
  #undef CYTHON_IMMORTAL_CONSTANTS
  #define CYTHON_IMMORTAL_CONSTANTS 0
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
  #define CYTHON_COMPILING_IN_LIMITED_API 0
  #define CYTHON_COMPILING_IN_GRAAL 0
  #ifdef Py_GIL_DISABLED
    #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 1
  #else
    #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  #endif
  #if PY_VERSION_HEX < 0x030A0000
    #undef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #elif !defined(CYTHON_USE_TYPE_SLOTS)
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #ifndef CYTHON_USE_TYPE_SPECS
    #define CYTHON_USE_TYPE_SPECS 0
  #endif
  #ifndef CYTHON_USE_PYTYPE_LOOKUP
    #define CYTHON_USE_PYTYPE_LOOKUP 1
  #endif
  #ifndef CYTHON_USE_PYLONG_INTERNALS
    #define CYTHON_USE_PYLONG_INTERNALS 1
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    #undef CYTHON_USE_PYLIST_INTERNALS
    #define CYTHON_USE_PYLIST_INTERNALS 0
  #elif !defined(CYTHON_USE_PYLIST_INTERNALS)
    #define CYTHON_USE_PYLIST_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING || PY_VERSION_HEX >= 0x030B00A2
    #undef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #elif !defined(CYTHON_USE_UNICODE_WRITER)
    #define CYTHON_USE_UNICODE_WRITER 1
  #endif
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
    #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1
  #elif !defined(CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)
    #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_ASSUME_SAFE_SIZE
    #define CYTHON_ASSUME_SAFE_SIZE 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #ifndef CYTHON_FAST_THREAD_STATE
    #define CYTHON_FAST_THREAD_STATE 1
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    #undef CYTHON_FAST_GIL
    #define CYTHON_FAST_GIL 0
  #elif !defined(CYTHON_FAST_GIL)
    #define CYTHON_FAST_GIL (PY_VERSION_HEX < 0x030C00A6)
  #endif
  #ifndef CYTHON_METH_FASTCALL
    #define CYTHON_METH_FASTCALL 1
  #endif
  #ifndef CYTHON_FAST_PYCALL
    #define CYTHON_FAST_PYCALL 1
  #endif
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #endif
  #ifndef CYTHON_USE_MODULE_STATE
    #define CYTHON_USE_MODULE_STATE 0
  #endif
  #ifndef CYTHON_USE_SYS_MONITORING
    #define CYTHON_USE_SYS_MONITORING (PY_VERSION_HEX >= 0x030d00B1)
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE 1
  #endif
  #ifndef CYTHON_USE_AM_SEND
    #define CYTHON_USE_AM_SEND 1
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    #undef CYTHON_USE_DICT_VERSIONS
    #define CYTHON_USE_DICT_VERSIONS 0
  #elif !defined(CYTHON_USE_DICT_VERSIONS)
    #define CYTHON_USE_DICT_VERSIONS  (PY_VERSION_HEX < 0x030C00A5 && !CYTHON_USE_MODULE_STATE)
  #endif
  #ifndef CYTHON_USE_EXC_INFO_STACK
    #define CYTHON_USE_EXC_INFO_STACK 1
  #endif
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
  #endif
  #ifndef CYTHON_USE_FREELISTS
    #define CYTHON_USE_FREELISTS (!CYTHON_COMPILING_IN_CPYTHON_FREETHREADING)
  #endif
  #if defined(CYTHON_IMMORTAL_CONSTANTS) && PY_VERSION_HEX < 0x030C0000
    #undef CYTHON_IMMORTAL_CONSTANTS
    #define CYTHON_IMMORTAL_CONSTANTS 0  // definitely won't work
  #elif !defined(CYTHON_IMMORTAL_CONSTANTS)
    #define CYTHON_IMMORTAL_CONSTANTS (PY_VERSION_HEX >= 0x030C0000 && !CYTHON_USE_MODULE_STATE && CYTHON_COMPILING_IN_CPYTHON_FREETHREADING)
  #endif
#endif
#ifndef CYTHON_COMPRESS_STRINGS
  #define CYTHON_COMPRESS_STRINGS 1
#endif
#ifndef CYTHON_FAST_PYCCALL
#define CYTHON_FAST_PYCCALL  CYTHON_FAST_PYCALL
#endif
#ifndef CYTHON_VECTORCALL
#if CYTHON_COMPILING_IN_LIMITED_API
#define CYTHON_VECTORCALL  (__PYX_LIMITED_VERSION_HEX >= 0x030C0000)
#else
#define CYTHON_VECTORCALL  (CYTHON_FAST_PYCCALL)
#endif
#endif
#if CYTHON_USE_PYLONG_INTERNALS
  #undef SHIFT
  #undef BASE
  #undef MASK
  #ifdef SIZEOF_VOID_P
    enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
  #endif
#endif
#ifndef __has_attribute
  #define __has_attribute(x) 0
#endif
#ifndef __has_cpp_attribute
  #define __has_cpp_attribute(x) 0
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#ifndef CYTHON_UNUSED
  #if defined(__cplusplus)
    /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17
     * but leads to warnings with -pedantic, since it is a C++17 feature */
    #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
      #if __has_cpp_attribute(maybe_unused)
        #define CYTHON_UNUSED [[maybe_unused]]
      #endif
    #endif
  #endif
#endif
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_UNUSED_VAR
#  if defined(__cplusplus)
     template<class T> void CYTHON_UNUSED_VAR( const T& ) { }
#  else
#    define CYTHON_UNUSED_VAR(x) (void)(x)
#  endif
#endif
#ifndef CYTHON_MAYBE_UNUSED_VAR
  #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x)
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_USE_CPP_STD_MOVE
  #if defined(__cplusplus) && (\
    __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600))
    #define CYTHON_USE_CPP_STD_MOVE 1
  #else
    #define CYTHON_USE_CPP_STD_MOVE 0
  #endif
#endif
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
#include <stdint.h>
typedef uintptr_t  __pyx_uintptr_t;
#ifndef CYTHON_FALLTHROUGH
  #if defined(__cplusplus)
    /* for clang __has_cpp_attribute(fallthrough) is true even before C++17
     * but leads to warnings with -pedantic, since it is a C++17 feature */
    #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
      #if __has_cpp_attribute(fallthrough)
        #define CYTHON_FALLTHROUGH [[fallthrough]]
      #endif
    #endif
    #ifndef CYTHON_FALLTHROUGH
      #if __has_cpp_attribute(clang::fallthrough)
        #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
      #elif __has_cpp_attribute(gnu::fallthrough)
        #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
      #endif
    #endif
  #endif
  #ifndef CYTHON_FALLTHROUGH
    #if __has_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
    #else
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
  #if defined(__clang__) && defined(__apple_build_version__)
    #if __apple_build_version__ < 7000000
      #undef  CYTHON_FALLTHROUGH
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
#endif
#ifndef Py_UNREACHABLE
  #define Py_UNREACHABLE()  assert(0); abort()
#endif
#ifdef __cplusplus
  template <typename T>
  struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);};
  #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL<type>::value)
#else
  #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0)
#endif
#if CYTHON_COMPILING_IN_PYPY == 1
  #define __PYX_NEED_TP_PRINT_SLOT  (PY_VERSION_HEX < 0x030A0000)
#else
  #define __PYX_NEED_TP_PRINT_SLOT  (PY_VERSION_HEX < 0x03090000)
#endif
#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer))

/* CInitCode */
#ifndef CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #elif defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif

/* PythonCompatibility */
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#define __Pyx_BUILTIN_MODULE_NAME "builtins"
#define __Pyx_DefaultClassType PyType_Type
#if CYTHON_COMPILING_IN_LIMITED_API
    #ifndef CO_OPTIMIZED
    static int CO_OPTIMIZED;
    #endif
    #ifndef CO_NEWLOCALS
    static int CO_NEWLOCALS;
    #endif
    #ifndef CO_VARARGS
    static int CO_VARARGS;
    #endif
    #ifndef CO_VARKEYWORDS
    static int CO_VARKEYWORDS;
    #endif
    #ifndef CO_ASYNC_GENERATOR
    static int CO_ASYNC_GENERATOR;
    #endif
    #ifndef CO_GENERATOR
    static int CO_GENERATOR;
    #endif
    #ifndef CO_COROUTINE
    static int CO_COROUTINE;
    #endif
#else
    #ifndef CO_COROUTINE
      #define CO_COROUTINE 0x80
    #endif
    #ifndef CO_ASYNC_GENERATOR
      #define CO_ASYNC_GENERATOR 0x200
    #endif
#endif
static int __Pyx_init_co_variables(void);
#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE)
  #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type)
#else
  #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type))
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is)
  #define __Pyx_Py_Is(x, y)  Py_Is(x, y)
#else
  #define __Pyx_Py_Is(x, y) ((x) == (y))
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone)
  #define __Pyx_Py_IsNone(ob) Py_IsNone(ob)
#else
  #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None)
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue)
  #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob)
#else
  #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True)
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse)
  #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob)
#else
  #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False)
#endif
#define __Pyx_NoneAsNull(obj)  (__Pyx_Py_IsNone(obj) ? NULL : (obj))
#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o)
#else
  #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o)
#endif
#ifndef Py_TPFLAGS_CHECKTYPES
  #define Py_TPFLAGS_CHECKTYPES 0
#endif
#ifndef Py_TPFLAGS_HAVE_INDEX
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#ifndef Py_TPFLAGS_HAVE_FINALIZE
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#ifndef Py_TPFLAGS_SEQUENCE
  #define Py_TPFLAGS_SEQUENCE 0
#endif
#ifndef Py_TPFLAGS_MAPPING
  #define Py_TPFLAGS_MAPPING 0
#endif
#ifndef Py_TPFLAGS_IMMUTABLETYPE
  #define Py_TPFLAGS_IMMUTABLETYPE (1UL << 8)
#endif
#ifndef Py_TPFLAGS_DISALLOW_INSTANTIATION
  #define Py_TPFLAGS_DISALLOW_INSTANTIATION (1UL << 7)
#endif
#ifndef METH_STACKLESS
  #define METH_STACKLESS 0
#endif
#ifndef METH_FASTCALL
  #ifndef METH_FASTCALL
     #define METH_FASTCALL 0x80
  #endif
  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
                                                          Py_ssize_t nargs, PyObject *kwnames);
#else
  #if PY_VERSION_HEX >= 0x030d00A4
  #  define __Pyx_PyCFunctionFast PyCFunctionFast
  #  define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords
  #else
  #  define __Pyx_PyCFunctionFast _PyCFunctionFast
  #  define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
  #endif
#endif
#if CYTHON_METH_FASTCALL
  #define __Pyx_METH_FASTCALL METH_FASTCALL
  #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast
  #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords
#else
  #define __Pyx_METH_FASTCALL METH_VARARGS
  #define __Pyx_PyCFunction_FastCall PyCFunction
  #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords
#endif
#if CYTHON_VECTORCALL
  #define __pyx_vectorcallfunc vectorcallfunc
  #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET  PY_VECTORCALL_ARGUMENTS_OFFSET
  #define __Pyx_PyVectorcall_NARGS(n)  PyVectorcall_NARGS((size_t)(n))
#else
  #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET  0
  #define __Pyx_PyVectorcall_NARGS(n)  ((Py_ssize_t)(n))
#endif
#if PY_VERSION_HEX >= 0x030900B1
#define __Pyx_PyCFunction_CheckExact(func)  PyCFunction_CheckExact(func)
#else
#define __Pyx_PyCFunction_CheckExact(func)  PyCFunction_Check(func)
#endif
#define __Pyx_CyOrPyCFunction_Check(func)  PyCFunction_Check(func)
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func)  (((PyCFunctionObject*)(func))->m_ml->ml_meth)
#elif !CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func)  PyCFunction_GET_FUNCTION(func)
#endif
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_CyOrPyCFunction_GET_FLAGS(func)  (((PyCFunctionObject*)(func))->m_ml->ml_flags)
static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) {
    return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self;
}
#endif
static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void (*cfunc)(void)) {
#if CYTHON_COMPILING_IN_LIMITED_API
    return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
#else
    return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
#endif
}
#define __Pyx_IsSameCFunction(func, cfunc)   __Pyx__IsSameCFunction(func, cfunc)
#if PY_VERSION_HEX < 0x03090000 || (CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000)
  #define __Pyx_PyType_FromModuleAndSpec(m, s, b)  ((void)m, PyType_FromSpecWithBases(s, b))
  typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *);
#else
  #define __Pyx_PyType_FromModuleAndSpec(m, s, b)  PyType_FromModuleAndSpec(m, s, b)
  #define __Pyx_PyCMethod  PyCMethod
#endif
#ifndef METH_METHOD
  #define METH_METHOD 0x200
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  #define PyObject_Malloc(s)   PyMem_Malloc(s)
  #define PyObject_Free(p)     PyMem_Free(p)
  #define PyObject_Realloc(p)  PyMem_Realloc(p)
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)
#elif CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) GraalPyFrame_SetLineNumber((frame), (lineno))
#elif CYTHON_COMPILING_IN_GRAAL
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) _PyFrame_SetLineNumber((frame), (lineno))
#else
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_PyThreadState_Current PyThreadState_Get()
#elif !CYTHON_FAST_THREAD_STATE
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#elif PY_VERSION_HEX >= 0x030d00A1
  #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked()
#else
  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
#endif
#if CYTHON_USE_MODULE_STATE
static CYTHON_INLINE void *__Pyx__PyModule_GetState(PyObject *op)
{
    void *result;
    result = PyModule_GetState(op);
    if (!result)
        Py_FatalError("Couldn't find the module state");
    return result;
}
#define __Pyx_PyModule_GetState(o) (__pyx_mstatetype *)__Pyx__PyModule_GetState(o)
#else
#define __Pyx_PyModule_GetState(op) ((void)op,__pyx_mstate_global)
#endif
#define __Pyx_PyObject_GetSlot(obj, name, func_ctype)  __Pyx_PyType_GetSlot(Py_TYPE((PyObject *) obj), name, func_ctype)
#define __Pyx_PyObject_TryGetSlot(obj, name, func_ctype) __Pyx_PyType_TryGetSlot(Py_TYPE(obj), name, func_ctype)
#define __Pyx_PyObject_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(Py_TYPE(obj), sub, name, func_ctype)
#define __Pyx_PyObject_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSubSlot(Py_TYPE(obj), sub, name, func_ctype)
#if CYTHON_USE_TYPE_SLOTS
  #define __Pyx_PyType_GetSlot(type, name, func_ctype)  ((type)->name)
  #define __Pyx_PyType_TryGetSlot(type, name, func_ctype) __Pyx_PyType_GetSlot(type, name, func_ctype)
  #define __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) (((type)->sub) ? ((type)->sub->name) : NULL)
  #define __Pyx_PyType_TryGetSubSlot(type, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype)
#else
  #define __Pyx_PyType_GetSlot(type, name, func_ctype)  ((func_ctype) PyType_GetSlot((type), Py_##name))
  #define __Pyx_PyType_TryGetSlot(type, name, func_ctype)\
    ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000 ||\
     (PyType_GetFlags(type) & Py_TPFLAGS_HEAPTYPE) || __Pyx_get_runtime_version() >= 0x030A0000) ?\
     __Pyx_PyType_GetSlot(type, name, func_ctype) : NULL)
  #define __Pyx_PyType_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSlot(obj, name, func_ctype)
  #define __Pyx_PyType_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSlot(obj, name, func_ctype)
#endif
#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
#define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
#else
#define __Pyx_PyDict_NewPresized(n)  PyDict_New()
#endif
#define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
#define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_UNICODE_INTERNALS
#define __Pyx_PyDict_GetItemStrWithError(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) {
    PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name);
    if (res == NULL) PyErr_Clear();
    return res;
}
#elif !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000
#define __Pyx_PyDict_GetItemStrWithError  PyDict_GetItemWithError
#define __Pyx_PyDict_GetItemStr           PyDict_GetItem
#else
static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) {
#if CYTHON_COMPILING_IN_PYPY
    return PyDict_GetItem(dict, name);
#else
    PyDictEntry *ep;
    PyDictObject *mp = (PyDictObject*) dict;
    long hash = ((PyStringObject *) name)->ob_shash;
    assert(hash != -1);
    ep = (mp->ma_lookup)(mp, name, hash);
    if (ep == NULL) {
        return NULL;
    }
    return ep->me_value;
#endif
}
#define __Pyx_PyDict_GetItemStr           PyDict_GetItem
#endif
#if CYTHON_USE_TYPE_SLOTS
  #define __Pyx_PyType_GetFlags(tp)   (((PyTypeObject *)tp)->tp_flags)
  #define __Pyx_PyType_HasFeature(type, feature)  ((__Pyx_PyType_GetFlags(type) & (feature)) != 0)
#else
  #define __Pyx_PyType_GetFlags(tp)   (PyType_GetFlags((PyTypeObject *)tp))
  #define __Pyx_PyType_HasFeature(type, feature)  PyType_HasFeature(type, feature)
#endif
#define __Pyx_PyObject_GetIterNextFunc(iterator)  __Pyx_PyObject_GetSlot(iterator, tp_iternext, iternextfunc)
#if CYTHON_USE_TYPE_SPECS
#define __Pyx_PyHeapTypeObject_GC_Del(obj)  {\
    PyTypeObject *type = Py_TYPE((PyObject*)obj);\
    assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\
    PyObject_GC_Del(obj);\
    Py_DECREF(type);\
}
#else
#define __Pyx_PyHeapTypeObject_GC_Del(obj)  PyObject_GC_Del(obj)
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i)
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((void)u, 1114111U)
  #define __Pyx_PyUnicode_KIND(u)         ((void)u, (0))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)u)
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)k, PyUnicode_ReadChar((PyObject*)(d), i))
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GetLength(u))
#else
  #if PY_VERSION_HEX >= 0x030C0000
    #define __Pyx_PyUnicode_READY(op)       (0)
  #else
    #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                                0 : _PyUnicode_Ready((PyObject *)(op)))
  #endif
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
  #define __Pyx_PyUnicode_KIND(u)         ((int)PyUnicode_KIND(u))
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, (Py_UCS4) ch)
  #if PY_VERSION_HEX >= 0x030C0000
    #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
  #else
    #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
    #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
    #else
    #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
    #endif
  #endif
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #if !defined(PyUnicode_DecodeUnicodeEscape)
    #define PyUnicode_DecodeUnicodeEscape(s, size, errors)  PyUnicode_Decode(s, size, "unicode_escape", errors)
  #endif
  #if !defined(PyUnicode_Contains)
    #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
  #endif
  #if !defined(PyByteArray_Check)
    #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
  #endif
  #if !defined(PyObject_Format)
    #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
  #endif
#endif
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  #define __Pyx_PySequence_ListKeepNew(obj)\
    (likely(PyList_CheckExact(obj) && PyUnstable_Object_IsUniquelyReferenced(obj)) ? __Pyx_NewRef(obj) : PySequence_List(obj))
#elif CYTHON_COMPILING_IN_CPYTHON
  #define __Pyx_PySequence_ListKeepNew(obj)\
    (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj))
#else
  #define __Pyx_PySequence_ListKeepNew(obj)  PySequence_List(obj)
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        __Pyx_IS_TYPE(obj, &PySet_Type)
#endif
#if PY_VERSION_HEX >= 0x030900A4
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
#else
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
#endif
enum __Pyx_ReferenceSharing {
  __Pyx_ReferenceSharing_DefinitelyUnique, // We created it so we know it's unshared - no need to check
  __Pyx_ReferenceSharing_OwnStrongReference,
  __Pyx_ReferenceSharing_FunctionArgument,
  __Pyx_ReferenceSharing_SharedReference, // Never trust it to be unshared because it's a global or similar
};
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && PY_VERSION_HEX >= 0x030E0000
#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing)\
    (sharing == __Pyx_ReferenceSharing_DefinitelyUnique ? 1 :\
      (sharing == __Pyx_ReferenceSharing_FunctionArgument ? PyUnstable_Object_IsUniqueReferencedTemporary(o) :\
      (sharing == __Pyx_ReferenceSharing_OwnStrongReference ? PyUnstable_Object_IsUniquelyReferenced(o) : 0)))
#elif (CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) || CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)sharing), Py_REFCNT(o) == 1)
#else
#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)o), ((void)sharing), 0)
#endif
#if CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
    #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i)
  #elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS
    #define __Pyx_PyList_GetItemRef(o, i) (likely((i) >= 0) ? PySequence_GetItem(o, i) : (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
  #else
    #define __Pyx_PyList_GetItemRef(o, i) PySequence_ITEM(o, i)
  #endif
#elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS
  #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
    #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i)
  #else
    #define __Pyx_PyList_GetItemRef(o, i) __Pyx_XNewRef(PyList_GetItem(o, i))
  #endif
#else
  #define __Pyx_PyList_GetItemRef(o, i) __Pyx_NewRef(PyList_GET_ITEM(o, i))
#endif
#if CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !CYTHON_COMPILING_IN_LIMITED_API && CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) (__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared) ?\
    __Pyx_NewRef(PyList_GET_ITEM(o, i)) : __Pyx_PyList_GetItemRef(o, i))
#else
  #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) __Pyx_PyList_GetItemRef(o, i)
#endif
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
#define __Pyx_PyDict_GetItemRef(dict, key, result) PyDict_GetItemRef(dict, key, result)
#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) {
  *result = PyObject_GetItem(dict, key);
  if (*result == NULL) {
    if (PyErr_ExceptionMatches(PyExc_KeyError)) {
      PyErr_Clear();
      return 0;
    }
    return -1;
  }
  return 1;
}
#else
static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) {
  *result = PyDict_GetItemWithError(dict, key);
  if (*result == NULL) {
    return PyErr_Occurred() ? -1 : 0;
  }
  Py_INCREF(*result);
  return 1;
}
#endif
#if defined(CYTHON_DEBUG_VISIT_CONST) && CYTHON_DEBUG_VISIT_CONST
  #define __Pyx_VISIT_CONST(obj)  Py_VISIT(obj)
#else
  #define __Pyx_VISIT_CONST(obj)
#endif
#if CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i)
  #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
  #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0))
  #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GET_ITEM(o, i)
  #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0))
  #define __Pyx_PyList_GET_ITEM(o, i) PyList_GET_ITEM(o, i)
#else
  #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i)
  #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
  #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v)
  #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GetItem(o, i)
  #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v)
  #define __Pyx_PyList_GET_ITEM(o, i) PyList_GetItem(o, i)
#endif
#if CYTHON_ASSUME_SAFE_SIZE
  #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o)
  #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o)
  #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o)
  #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o)
  #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o)
  #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GET_LENGTH(o)
#else
  #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o)
  #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o)
  #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o)
  #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o)
  #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o)
  #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GetLength(o)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_InternFromString)
  #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
#endif
#define __Pyx_PyLong_FromHash_t PyLong_FromSsize_t
#define __Pyx_PyLong_AsHash_t   __Pyx_PyIndex_AsSsize_t
#if __PYX_LIMITED_VERSION_HEX >= 0x030A0000
    #define __Pyx_PySendResult PySendResult
#else
    typedef enum {
        PYGEN_RETURN = 0,
        PYGEN_ERROR = -1,
        PYGEN_NEXT = 1,
    } __Pyx_PySendResult;
#endif
#if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX < 0x030A00A3
  typedef __Pyx_PySendResult (*__Pyx_pyiter_sendfunc)(PyObject *iter, PyObject *value, PyObject **result);
#else
  #define __Pyx_pyiter_sendfunc sendfunc
#endif
#if !CYTHON_USE_AM_SEND
#define __PYX_HAS_PY_AM_SEND 0
#elif __PYX_LIMITED_VERSION_HEX >= 0x030A0000
#define __PYX_HAS_PY_AM_SEND 1
#else
#define __PYX_HAS_PY_AM_SEND 2  // our own backported implementation
#endif
#if __PYX_HAS_PY_AM_SEND < 2
    #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
#else
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
        __Pyx_pyiter_sendfunc am_send;
    } __Pyx_PyAsyncMethodsStruct;
    #define __Pyx_SlotTpAsAsync(s) ((PyAsyncMethods*)(s))
#endif
#if CYTHON_USE_AM_SEND && PY_VERSION_HEX < 0x030A00F0
    #define __Pyx_TPFLAGS_HAVE_AM_SEND (1UL << 21)
#else
    #define __Pyx_TPFLAGS_HAVE_AM_SEND (0)
#endif
#if PY_VERSION_HEX >= 0x03090000
#define __Pyx_PyInterpreterState_Get() PyInterpreterState_Get()
#else
#define __Pyx_PyInterpreterState_Get() PyThreadState_Get()->interp
#endif
#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030A0000
#ifdef __cplusplus
extern "C"
#endif
PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize);
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
static int __Pyx_init_co_variable(PyObject *inspect, const char* name, int *write_to) {
    int value;
    PyObject *py_value = PyObject_GetAttrString(inspect, name);
    if (!py_value) return 0;
    value = (int) PyLong_AsLong(py_value);
    Py_DECREF(py_value);
    *write_to = value;
    return value != -1 || !PyErr_Occurred();
}
static int __Pyx_init_co_variables(void) {
    PyObject *inspect;
    int result;
    inspect = PyImport_ImportModule("inspect");
    result =
#if !defined(CO_OPTIMIZED)
        __Pyx_init_co_variable(inspect, "CO_OPTIMIZED", &CO_OPTIMIZED) &&
#endif
#if !defined(CO_NEWLOCALS)
        __Pyx_init_co_variable(inspect, "CO_NEWLOCALS", &CO_NEWLOCALS) &&
#endif
#if !defined(CO_VARARGS)
        __Pyx_init_co_variable(inspect, "CO_VARARGS", &CO_VARARGS) &&
#endif
#if !defined(CO_VARKEYWORDS)
        __Pyx_init_co_variable(inspect, "CO_VARKEYWORDS", &CO_VARKEYWORDS) &&
#endif
#if !defined(CO_ASYNC_GENERATOR)
        __Pyx_init_co_variable(inspect, "CO_ASYNC_GENERATOR", &CO_ASYNC_GENERATOR) &&
#endif
#if !defined(CO_GENERATOR)
        __Pyx_init_co_variable(inspect, "CO_GENERATOR", &CO_GENERATOR) &&
#endif
#if !defined(CO_COROUTINE)
        __Pyx_init_co_variable(inspect, "CO_COROUTINE", &CO_COROUTINE) &&
#endif
        1;
    Py_DECREF(inspect);
    return result ? 0 : -1;
}
#else
static int __Pyx_init_co_variables(void) {
    return 0;  // It's a limited API-only feature
}
#endif

/* MathInitCode */
#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
  #ifndef _USE_MATH_DEFINES
    #define _USE_MATH_DEFINES
  #endif
#endif
#include <math.h>
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
#define __Pyx_truncl trunc
#else
#define __Pyx_truncl truncl
#endif

#ifndef CYTHON_CLINE_IN_TRACEBACK_RUNTIME
#define CYTHON_CLINE_IN_TRACEBACK_RUNTIME 0
#endif
#ifndef CYTHON_CLINE_IN_TRACEBACK
#define CYTHON_CLINE_IN_TRACEBACK CYTHON_CLINE_IN_TRACEBACK_RUNTIME
#endif
#if CYTHON_CLINE_IN_TRACEBACK
#define __PYX_MARK_ERR_POS(f_index, lineno)  { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; __pyx_clineno = __LINE__; (void) __pyx_clineno; }
#else
#define __PYX_MARK_ERR_POS(f_index, lineno)  { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; (void) __pyx_clineno; }
#endif
#define __PYX_ERR(f_index, lineno, Ln_error) \
    { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }

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

#define __PYX_HAVE__pkcs11___pkcs11
#define __PYX_HAVE_API__pkcs11___pkcs11
/* Early includes */
#include "../extern/cryptoki.h"
#include <string.h>
#include <stdio.h>
#include "../extern/load_module.c"
#include "pythread.h"
#include <stdlib.h>
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

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

#ifdef CYTHON_FREETHREADING_COMPATIBLE
#if CYTHON_FREETHREADING_COMPATIBLE
#define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_NOT_USED
#else
#define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_USED
#endif
#else
#define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_USED
#endif
#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_uchar_cast(c) ((unsigned char)c)
#define __Pyx_long_cast(x) ((long)x)
#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
    (sizeof(type) < sizeof(Py_ssize_t))  ||\
    (sizeof(type) > sizeof(Py_ssize_t) &&\
          likely(v < (type)PY_SSIZE_T_MAX ||\
                 v == (type)PY_SSIZE_T_MAX)  &&\
          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
                                v == (type)PY_SSIZE_T_MIN)))  ||\
    (sizeof(type) == sizeof(Py_ssize_t) &&\
          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
                               v == (type)PY_SSIZE_T_MAX)))  )
static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
    return (size_t) i < (size_t) limit;
}
#if defined (__cplusplus) && __cplusplus >= 201103L
    #include <cstdlib>
    #define __Pyx_sst_abs(value) std::abs(value)
#elif SIZEOF_INT >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) abs(value)
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) labs(value)
#elif defined (_MSC_VER)
    #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define __Pyx_sst_abs(value) llabs(value)
#elif defined (__GNUC__)
    #define __Pyx_sst_abs(value) __builtin_llabs(value)
#else
    #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
#endif
static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s);
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*);
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if CYTHON_ASSUME_SAFE_MACROS
    #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyByteArray_AsString(s) PyByteArray_AS_STRING(s)
#else
    #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AsString(s))
    #define __Pyx_PyByteArray_AsString(s) PyByteArray_AsString(s)
#endif
#define __Pyx_PyObject_AsWritableString(s)    ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s)    ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
#define __Pyx_PyUnicode_FromOrdinal(o)       PyUnicode_FromOrdinal((int)o)
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
static CYTHON_INLINE PyObject *__Pyx_NewRef(PyObject *obj) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_NewRef)
    return Py_NewRef(obj);
#else
    Py_INCREF(obj);
    return obj;
#endif
}
static CYTHON_INLINE PyObject *__Pyx_XNewRef(PyObject *obj) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_XNewRef)
    return Py_XNewRef(obj);
#else
    Py_XINCREF(obj);
    return obj;
#endif
}
static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b);
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x);
#define __Pyx_PySequence_Tuple(obj)\
    (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t);
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
#if CYTHON_ASSUME_SAFE_MACROS
#define __Pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AS_DOUBLE(x)
#else
#define __Pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AsDouble(x)
#endif
#define __Pyx_PyFloat_AsFloat(x) ((float) __Pyx_PyFloat_AsDouble(x))
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
#if CYTHON_USE_PYLONG_INTERNALS
  #if PY_VERSION_HEX >= 0x030C00A7
  #ifndef _PyLong_SIGN_MASK
    #define _PyLong_SIGN_MASK 3
  #endif
  #ifndef _PyLong_NON_SIZE_BITS
    #define _PyLong_NON_SIZE_BITS 3
  #endif
  #define __Pyx_PyLong_Sign(x)  (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK)
  #define __Pyx_PyLong_IsNeg(x)  ((__Pyx_PyLong_Sign(x) & 2) != 0)
  #define __Pyx_PyLong_IsNonNeg(x)  (!__Pyx_PyLong_IsNeg(x))
  #define __Pyx_PyLong_IsZero(x)  (__Pyx_PyLong_Sign(x) & 1)
  #define __Pyx_PyLong_IsPos(x)  (__Pyx_PyLong_Sign(x) == 0)
  #define __Pyx_PyLong_CompactValueUnsigned(x)  (__Pyx_PyLong_Digits(x)[0])
  #define __Pyx_PyLong_DigitCount(x)  ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS))
  #define __Pyx_PyLong_SignedDigitCount(x)\
        ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x))
  #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue)
    #define __Pyx_PyLong_IsCompact(x)     PyUnstable_Long_IsCompact((PyLongObject*) x)
    #define __Pyx_PyLong_CompactValue(x)  PyUnstable_Long_CompactValue((PyLongObject*) x)
  #else
    #define __Pyx_PyLong_IsCompact(x)     (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS))
    #define __Pyx_PyLong_CompactValue(x)  ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0])
  #endif
  typedef Py_ssize_t  __Pyx_compact_pylong;
  typedef size_t  __Pyx_compact_upylong;
  #else
  #define __Pyx_PyLong_IsNeg(x)  (Py_SIZE(x) < 0)
  #define __Pyx_PyLong_IsNonNeg(x)  (Py_SIZE(x) >= 0)
  #define __Pyx_PyLong_IsZero(x)  (Py_SIZE(x) == 0)
  #define __Pyx_PyLong_IsPos(x)  (Py_SIZE(x) > 0)
  #define __Pyx_PyLong_CompactValueUnsigned(x)  ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0])
  #define __Pyx_PyLong_DigitCount(x)  __Pyx_sst_abs(Py_SIZE(x))
  #define __Pyx_PyLong_SignedDigitCount(x)  Py_SIZE(x)
  #define __Pyx_PyLong_IsCompact(x)  (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1)
  #define __Pyx_PyLong_CompactValue(x)\
        ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0]))
  typedef sdigit  __Pyx_compact_pylong;
  typedef digit  __Pyx_compact_upylong;
  #endif
  #if PY_VERSION_HEX >= 0x030C00A5
  #define __Pyx_PyLong_Digits(x)  (((PyLongObject*)x)->long_value.ob_digit)
  #else
  #define __Pyx_PyLong_Digits(x)  (((PyLongObject*)x)->ob_digit)
  #endif
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
  #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#elif __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeASCII(c_str, size, NULL)
#else
  #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#endif


/* Test for GCC > 2.95 */
#if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  #define likely(x)   __builtin_expect(!!(x), 1)
  #define unlikely(x) __builtin_expect(!!(x), 0)
#else /* !__GNUC__ or GCC < 2.95 */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */
/* PretendToInitialize */
#ifdef __cplusplus
#if __cplusplus > 201103L
#include <type_traits>
#endif
template <typename T>
static void __Pyx_pretend_to_initialize(T* ptr) {
#if __cplusplus > 201103L
    if ((std::is_trivially_default_constructible<T>::value))
#endif
        *ptr = T();
    (void)ptr;
}
#else
static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
#endif


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

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

static const char* const __pyx_f[] = {
  "pkcs11/_pkcs11.pyx",
  "carray.from_py",
  "pkcs11/_pkcs11.pxd",
  "cpython/type.pxd",
};
/* #### Code section: utility_code_proto_before_types ### */
/* Atomics.proto (used by UnpackUnboundCMethod) */
#include <pythread.h>
#ifndef CYTHON_ATOMICS
    #define CYTHON_ATOMICS 1
#endif
#define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS
#define __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#define __pyx_atomic_int_type int
#define __pyx_nonatomic_int_type int
#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\
                        (__STDC_VERSION__ >= 201112L) &&\
                        !defined(__STDC_NO_ATOMICS__))
    #include <stdatomic.h>
#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\
                    (__cplusplus >= 201103L) ||\
                    (defined(_MSC_VER) && _MSC_VER >= 1700)))
    #include <atomic>
#endif
#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\
                        (__STDC_VERSION__ >= 201112L) &&\
                        !defined(__STDC_NO_ATOMICS__) &&\
                       ATOMIC_INT_LOCK_FREE == 2)
    #undef __pyx_atomic_int_type
    #define __pyx_atomic_int_type atomic_int
    #define __pyx_atomic_ptr_type atomic_uintptr_t
    #define __pyx_nonatomic_ptr_type uintptr_t
    #define __pyx_atomic_incr_relaxed(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed)
    #define __pyx_atomic_incr_acq_rel(value) atomic_fetch_add_explicit(value, 1, memory_order_acq_rel)
    #define __pyx_atomic_decr_acq_rel(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel)
    #define __pyx_atomic_sub(value, arg) atomic_fetch_sub(value, arg)
    #define __pyx_atomic_int_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired)
    #define __pyx_atomic_load(value) atomic_load(value)
    #define __pyx_atomic_store(value, new_value) atomic_store(value, new_value)
    #define __pyx_atomic_pointer_load_relaxed(value) atomic_load_explicit(value, memory_order_relaxed)
    #define __pyx_atomic_pointer_load_acquire(value) atomic_load_explicit(value, memory_order_acquire)
    #define __pyx_atomic_pointer_exchange(value, new_value) atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value)
    #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired)
    #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER)
        #pragma message ("Using standard C atomics")
    #elif defined(__PYX_DEBUG_ATOMICS)
        #warning "Using standard C atomics"
    #endif
#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\
                    (__cplusplus >= 201103L) ||\
\
                    (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\
                    ATOMIC_INT_LOCK_FREE == 2)
    #undef __pyx_atomic_int_type
    #define __pyx_atomic_int_type std::atomic_int
    #define __pyx_atomic_ptr_type std::atomic_uintptr_t
    #define __pyx_nonatomic_ptr_type uintptr_t
    #define __pyx_atomic_incr_relaxed(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed)
    #define __pyx_atomic_incr_acq_rel(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_acq_rel)
    #define __pyx_atomic_decr_acq_rel(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel)
    #define __pyx_atomic_sub(value, arg) std::atomic_fetch_sub(value, arg)
    #define __pyx_atomic_int_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired)
    #define __pyx_atomic_load(value) std::atomic_load(value)
    #define __pyx_atomic_store(value, new_value) std::atomic_store(value, new_value)
    #define __pyx_atomic_pointer_load_relaxed(value) std::atomic_load_explicit(value, std::memory_order_relaxed)
    #define __pyx_atomic_pointer_load_acquire(value) std::atomic_load_explicit(value, std::memory_order_acquire)
    #define __pyx_atomic_pointer_exchange(value, new_value) std::atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value)
    #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired)
    #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER)
        #pragma message ("Using standard C++ atomics")
    #elif defined(__PYX_DEBUG_ATOMICS)
        #warning "Using standard C++ atomics"
    #endif
#elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\
                    (__GNUC_MINOR__ > 1 ||\
                    (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2))))
    #define __pyx_atomic_ptr_type void*
    #define __pyx_nonatomic_ptr_type void*
    #define __pyx_atomic_incr_relaxed(value) __sync_fetch_and_add(value, 1)
    #define __pyx_atomic_incr_acq_rel(value) __sync_fetch_and_add(value, 1)
    #define __pyx_atomic_decr_acq_rel(value) __sync_fetch_and_sub(value, 1)
    #define __pyx_atomic_sub(value, arg) __sync_fetch_and_sub(value, arg)
    static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) {
        __pyx_nonatomic_int_type old = __sync_val_compare_and_swap(value, *expected, desired);
        int result = old == *expected;
        *expected = old;
        return result;
    }
    #define __pyx_atomic_load(value) __sync_fetch_and_add(value, 0)
    #define __pyx_atomic_store(value, new_value) __sync_lock_test_and_set(value, new_value)
    #define __pyx_atomic_pointer_load_relaxed(value) __sync_fetch_and_add(value, 0)
    #define __pyx_atomic_pointer_load_acquire(value) __sync_fetch_and_add(value, 0)
    #define __pyx_atomic_pointer_exchange(value, new_value) __sync_lock_test_and_set(value, (__pyx_atomic_ptr_type)new_value)
    static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) {
        __pyx_nonatomic_ptr_type old = __sync_val_compare_and_swap(value, *expected, desired);
        int result = old == *expected;
        *expected = old;
        return result;
    }
    #ifdef __PYX_DEBUG_ATOMICS
        #warning "Using GNU atomics"
    #endif
#elif CYTHON_ATOMICS && defined(_MSC_VER)
    #include <intrin.h>
    #undef __pyx_atomic_int_type
    #define __pyx_atomic_int_type long
    #define __pyx_atomic_ptr_type void*
    #undef __pyx_nonatomic_int_type
    #define __pyx_nonatomic_int_type long
    #define __pyx_nonatomic_ptr_type void*
    #pragma intrinsic (_InterlockedExchangeAdd, _InterlockedExchange, _InterlockedCompareExchange, _InterlockedCompareExchangePointer, _InterlockedExchangePointer)
    #define __pyx_atomic_incr_relaxed(value) _InterlockedExchangeAdd(value, 1)
    #define __pyx_atomic_incr_acq_rel(value) _InterlockedExchangeAdd(value, 1)
    #define __pyx_atomic_decr_acq_rel(value) _InterlockedExchangeAdd(value, -1)
    #define __pyx_atomic_sub(value, arg) _InterlockedExchangeAdd(value, -arg)
    static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) {
        __pyx_nonatomic_int_type old = _InterlockedCompareExchange(value, desired, *expected);
        int result = old == *expected;
        *expected = old;
        return result;
    }
    #define __pyx_atomic_load(value) _InterlockedExchangeAdd(value, 0)
    #define __pyx_atomic_store(value, new_value) _InterlockedExchange(value, new_value)
    #define __pyx_atomic_pointer_load_relaxed(value) *(void * volatile *)value
    #define __pyx_atomic_pointer_load_acquire(value) _InterlockedCompareExchangePointer(value, 0, 0)
    #define __pyx_atomic_pointer_exchange(value, new_value) _InterlockedExchangePointer(value, (__pyx_atomic_ptr_type)new_value)
    static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) {
        __pyx_atomic_ptr_type old = _InterlockedCompareExchangePointer(value, desired, *expected);
        int result = old == *expected;
        *expected = old;
        return result;
    }
    #ifdef __PYX_DEBUG_ATOMICS
        #pragma message ("Using MSVC atomics")
    #endif
#else
    #undef CYTHON_ATOMICS
    #define CYTHON_ATOMICS 0
    #ifdef __PYX_DEBUG_ATOMICS
        #warning "Not using atomics"
    #endif
#endif

/* CriticalSectionsDefinition.proto (used by CriticalSections) */
#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#define __Pyx_PyCriticalSection void*
#define __Pyx_PyCriticalSection2 void*
#define __Pyx_PyCriticalSection_End(cs)
#define __Pyx_PyCriticalSection2_End(cs)
#else
#define __Pyx_PyCriticalSection PyCriticalSection
#define __Pyx_PyCriticalSection2 PyCriticalSection2
#define __Pyx_PyCriticalSection_End PyCriticalSection_End
#define __Pyx_PyCriticalSection2_End PyCriticalSection2_End
#endif

/* CriticalSections.proto (used by ParseKeywordsImpl) */
#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#define __Pyx_PyCriticalSection_Begin(cs, arg) (void)(cs)
#define __Pyx_PyCriticalSection2_Begin(cs, arg1, arg2) (void)(cs)
#else
#define __Pyx_PyCriticalSection_Begin PyCriticalSection_Begin
#define __Pyx_PyCriticalSection2_Begin PyCriticalSection2_Begin
#endif
#if PY_VERSION_HEX < 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_BEGIN_CRITICAL_SECTION(o) {
#define __Pyx_END_CRITICAL_SECTION() }
#else
#define __Pyx_BEGIN_CRITICAL_SECTION Py_BEGIN_CRITICAL_SECTION
#define __Pyx_END_CRITICAL_SECTION Py_END_CRITICAL_SECTION
#endif

/* ForceInitThreads.proto */
#ifndef __PYX_FORCE_INIT_THREADS
  #define __PYX_FORCE_INIT_THREADS 0
#endif

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

/* IncludeStructmemberH.proto (used by FixUpExtensionType) */
#include <structmember.h>

/* BufferFormatStructs.proto */
struct __Pyx_StructField_;
#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
typedef struct {
  const char* name;
  const struct __Pyx_StructField_* fields;
  size_t size;
  size_t arraysize[8];
  int ndim;
  char typegroup;
  char is_unsigned;
  int flags;
} __Pyx_TypeInfo;
typedef struct __Pyx_StructField_ {
  const __Pyx_TypeInfo* type;
  const char* name;
  size_t offset;
} __Pyx_StructField;
typedef struct {
  const __Pyx_StructField* field;
  size_t parent_offset;
} __Pyx_BufFmt_StackElem;
typedef struct {
  __Pyx_StructField root;
  __Pyx_BufFmt_StackElem* head;
  size_t fmt_offset;
  size_t new_count, enc_count;
  size_t struct_alignment;
  int is_complex;
  char enc_type;
  char new_packmode;
  char enc_packmode;
  char is_valid_array;
} __Pyx_BufFmt_Context;

/* MemviewSliceStruct.proto */
struct __pyx_memoryview_obj;
typedef struct {
  struct __pyx_memoryview_obj *memview;
  char *data;
  Py_ssize_t shape[8];
  Py_ssize_t strides[8];
  Py_ssize_t suboffsets[8];
} __Pyx_memviewslice;
#define __Pyx_MemoryView_Len(m)  (m.shape[0])
#define __Pyx_MEMVIEW_DIRECT   1
#define __Pyx_MEMVIEW_PTR      2
#define __Pyx_MEMVIEW_FULL     4
#define __Pyx_MEMVIEW_CONTIG   8
#define __Pyx_MEMVIEW_STRIDED  16
#define __Pyx_MEMVIEW_FOLLOW   32
#define __Pyx_IS_C_CONTIG 1
#define __Pyx_IS_F_CONTIG 2
#define __Pyx_MEMSLICE_INIT  { 0, 0, { 0 }, { 0 }, { 0 } }
#if CYTHON_ATOMICS
    #define __pyx_add_acquisition_count(memview)\
             __pyx_atomic_incr_relaxed(__pyx_get_slice_count_pointer(memview))
    #define __pyx_sub_acquisition_count(memview)\
            __pyx_atomic_decr_acq_rel(__pyx_get_slice_count_pointer(memview))
#else
    #define __pyx_add_acquisition_count(memview)\
            __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
    #define __pyx_sub_acquisition_count(memview)\
            __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
#endif

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

/*--- Type declarations ---*/
struct __pyx_obj_6pkcs11_7_pkcs11_HasFuncList;
struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList;
struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam;
struct __pyx_obj_6pkcs11_7_pkcs11_Slot;
struct __pyx_obj_6pkcs11_7_pkcs11_Token;
struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext;
struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput;
struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter;
struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation;
struct __pyx_obj_6pkcs11_7_pkcs11_Session;
struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper;
struct __pyx_obj_6pkcs11_7_pkcs11_KeyOperation;
struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation;
struct __pyx_obj_6pkcs11_7_pkcs11_SignOrVerifyOperation;
struct __pyx_obj_6pkcs11_7_pkcs11_DataSignOperation;
struct __pyx_obj_6pkcs11_7_pkcs11_DataVerifyOperation;
struct __pyx_obj_6pkcs11_7_pkcs11_lib;
struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter;
struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects;
struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks;
struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator;
struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator;
struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens;
struct __pyx_array_obj;
struct __pyx_MemviewEnum_obj;
struct __pyx_memoryview_obj;
struct __pyx_memoryviewslice_obj;

/* "pkcs11/_pkcs11.pxd":605
 * # The only external API call that must be defined in a PKCS#11 library
 * # All other APIs are taken from the CK_FUNCTION_LIST table
 * ctypedef CK_RV (*C_GetFunctionList_ptr) (CK_FUNCTION_LIST **) nogil             # <<<<<<<<<<<<<<
 * 
 * ctypedef CK_RV (*KeyOperationInit) (
*/
typedef CK_RV (*__pyx_t_6pkcs11_7_pkcs11_C_GetFunctionList_ptr)(struct CK_FUNCTION_LIST **);

/* "pkcs11/_pkcs11.pxd":607
 * ctypedef CK_RV (*C_GetFunctionList_ptr) (CK_FUNCTION_LIST **) nogil
 * 
 * ctypedef CK_RV (*KeyOperationInit) (             # <<<<<<<<<<<<<<
 *         CK_SESSION_HANDLE session,
 *         CK_MECHANISM *mechanism,
*/
typedef CK_RV (*__pyx_t_6pkcs11_7_pkcs11_KeyOperationInit)(CK_SESSION_HANDLE, CK_MECHANISM *, CK_OBJECT_HANDLE);

/* "pkcs11/_pkcs11.pxd":612
 *         CK_OBJECT_HANDLE key
 * ) nogil
 * ctypedef CK_RV (*OperationUpdateWithResult) (             # <<<<<<<<<<<<<<
 *         CK_SESSION_HANDLE session,
 *         CK_BYTE *part_in,
*/
typedef CK_RV (*__pyx_t_6pkcs11_7_pkcs11_OperationUpdateWithResult)(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG, CK_BYTE *, CK_ULONG *);

/* "pkcs11/_pkcs11.pxd":619
 *         CK_ULONG *part_out_len
 * ) nogil
 * ctypedef CK_RV (*OperationUpdate) (             # <<<<<<<<<<<<<<
 *         CK_SESSION_HANDLE session,
 *         CK_BYTE *part_in,
*/
typedef CK_RV (*__pyx_t_6pkcs11_7_pkcs11_OperationUpdate)(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG);

/* "pkcs11/_pkcs11.pxd":624
 *         CK_ULONG part_in_len
 * ) nogil
 * ctypedef CK_RV (*OperationWithResult) (             # <<<<<<<<<<<<<<
 *         CK_SESSION_HANDLE session,
 *         CK_BYTE *part_out,
*/
typedef CK_RV (*__pyx_t_6pkcs11_7_pkcs11_OperationWithResult)(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG *);

/* "pkcs11/_pkcs11.pyx":36
 * cdef class lib(HasFuncList)
 * 
 * cdef class HasFuncList:             # <<<<<<<<<<<<<<
 *     cdef CK_FUNCTION_LIST *funclist
 * 
*/
struct __pyx_obj_6pkcs11_7_pkcs11_HasFuncList {
  PyObject_HEAD
  struct CK_FUNCTION_LIST *funclist;
};


/* "pkcs11/_pkcs11.pyx":50
 * 
 * 
 * cdef class AttributeList:             # <<<<<<<<<<<<<<
 *     """
 *     A list of CK_ATTRIBUTE objects.
*/
struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList {
  PyObject_HEAD
  struct __pyx_vtabstruct_6pkcs11_7_pkcs11_AttributeList *__pyx_vtab;
  CK_ATTRIBUTE *data;
  CK_ULONG count;
};


/* "pkcs11/_pkcs11.pyx":136
 * 
 * 
 * cdef class MechanismWithParam:             # <<<<<<<<<<<<<<
 *     """
 *     Python wrapper for a Mechanism with its parameter
*/
struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam {
  PyObject_HEAD
  CK_MECHANISM *data;
  void *param;
  PyObject *_python_param;
};


/* "pkcs11/_pkcs11.pyx":319
 * 
 * 
 * cdef class Slot(HasFuncList, types.Slot):             # <<<<<<<<<<<<<<
 *     """Extend Slot with implementation."""
 * 
*/
struct __pyx_obj_6pkcs11_7_pkcs11_Slot {
  struct __pyx_obj_6pkcs11_7_pkcs11_HasFuncList __pyx_base;
  struct __pyx_vtabstruct_6pkcs11_7_pkcs11_Slot *__pyx_vtab;
  CK_SLOT_ID slot_id;
  PyObject *slot_description;
  PyObject *manufacturer_id;
  CK_FLAGS slot_flags;
  CK_VERSION _hw_version;
  CK_VERSION _fw_version;
  CK_VERSION _cryptoki_version;
};


/* "pkcs11/_pkcs11.pyx":433
 * 
 * 
 * cdef class Token(HasFuncList, types.Token):             # <<<<<<<<<<<<<<
 *     """Extend Token with implementation."""
 * 
*/
struct __pyx_obj_6pkcs11_7_pkcs11_Token {
  struct __pyx_obj_6pkcs11_7_pkcs11_HasFuncList __pyx_base;
  struct __pyx_vtabstruct_6pkcs11_7_pkcs11_Token *__pyx_vtab;
  struct __pyx_obj_6pkcs11_7_pkcs11_Slot *slot;
  PyObject *label;
  PyObject *serial;
  PyObject *manufacturer_id;
  PyObject *model;
  CK_FLAGS token_flags;
  CK_VERSION _hw_version;
  CK_VERSION _fw_version;
};


/* "pkcs11/_pkcs11.pyx":560
 * 
 * 
 * cdef class OperationContext:             # <<<<<<<<<<<<<<
 *     cdef Session session
 *     cdef bint active
*/
struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext {
  PyObject_HEAD
  struct __pyx_vtabstruct_6pkcs11_7_pkcs11_OperationContext *__pyx_vtab;
  struct __pyx_obj_6pkcs11_7_pkcs11_Session *session;
  int active;
};


/* "pkcs11/_pkcs11.pyx":605
 * 
 * 
 * cdef class OperationWithBinaryOutput(OperationContext):             # <<<<<<<<<<<<<<
 * 
 *     cdef MechanismWithParam mech
*/
struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput {
  struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext __pyx_base;
  struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *mech;
  CK_ULONG buffer_size;
  CK_ULONG buffer_data_length;
  __Pyx_memviewslice output_buf;
};


/* "pkcs11/_pkcs11.pyx":717
 * 
 * 
 * cdef class SearchIter(OperationContext):             # <<<<<<<<<<<<<<
 *     """Iterate a search for objects on a session."""
 * 
*/
struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter {
  struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext __pyx_base;
  struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_template;
  CK_ULONG batch_size;
};


/* "pkcs11/_pkcs11.pyx":778
 * 
 * 
 * cdef class DigestOperation(OperationWithBinaryOutput):             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
*/
struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation {
  struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput __pyx_base;
};


/* "pkcs11/_pkcs11.pyx":850
 * 
 * 
 * cdef class Session(HasFuncList, types.Session):             # <<<<<<<<<<<<<<
 *     """Extend Session with implementation."""
 * 
*/
struct __pyx_obj_6pkcs11_7_pkcs11_Session {
  struct __pyx_obj_6pkcs11_7_pkcs11_HasFuncList __pyx_base;
  struct __pyx_vtabstruct_6pkcs11_7_pkcs11_Session *__pyx_vtab;
  CK_SESSION_HANDLE handle;
  struct __pyx_obj_6pkcs11_7_pkcs11_Token *token;
  int rw;
  CK_USER_TYPE _user_type;
  PyObject *operation_lock;
  PyObject *attribute_mapper;
  unsigned int cancel_strategy;
};


/* "pkcs11/_pkcs11.pyx":1197
 *         assertRV(retval)
 * 
 * cdef class ObjectHandleWrapper(HasFuncList):             # <<<<<<<<<<<<<<
 *     """
 *     Class implementing generic operations on PKCS#11 objects.
*/
struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper {
  struct __pyx_obj_6pkcs11_7_pkcs11_HasFuncList __pyx_base;
  struct __pyx_vtabstruct_6pkcs11_7_pkcs11_ObjectHandleWrapper *__pyx_vtab;
  struct __pyx_obj_6pkcs11_7_pkcs11_Session *session;
  CK_OBJECT_HANDLE handle;
};


/* "pkcs11/_pkcs11.pyx":1490
 * 
 * 
 * cdef class KeyOperation(OperationWithBinaryOutput):             # <<<<<<<<<<<<<<
 *     cdef CK_OBJECT_HANDLE key
 *     cdef KeyOperationInit op_init
*/
struct __pyx_obj_6pkcs11_7_pkcs11_KeyOperation {
  struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput __pyx_base;
  CK_OBJECT_HANDLE key;
  __pyx_t_6pkcs11_7_pkcs11_KeyOperationInit op_init;
};


/* "pkcs11/_pkcs11.pyx":1541
 * 
 * 
 * cdef class DataCryptOperation(KeyOperation):             # <<<<<<<<<<<<<<
 * 
 *     cdef OperationUpdateWithResult op_update
*/
struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation {
  struct __pyx_obj_6pkcs11_7_pkcs11_KeyOperation __pyx_base;
  __pyx_t_6pkcs11_7_pkcs11_OperationUpdateWithResult op_update;
  __pyx_t_6pkcs11_7_pkcs11_OperationWithResult op_final;
  __pyx_t_6pkcs11_7_pkcs11_OperationUpdateWithResult op_full;
};


/* "pkcs11/_pkcs11.pyx":1671
 * 
 * 
 * cdef class SignOrVerifyOperation(KeyOperation):             # <<<<<<<<<<<<<<
 *     cdef OperationUpdate op_update
 * 
*/
struct __pyx_obj_6pkcs11_7_pkcs11_SignOrVerifyOperation {
  struct __pyx_obj_6pkcs11_7_pkcs11_KeyOperation __pyx_base;
  __pyx_t_6pkcs11_7_pkcs11_OperationUpdate op_update;
};


/* "pkcs11/_pkcs11.pyx":1687
 * 
 * 
 * cdef class DataSignOperation(SignOrVerifyOperation):             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
*/
struct __pyx_obj_6pkcs11_7_pkcs11_DataSignOperation {
  struct __pyx_obj_6pkcs11_7_pkcs11_SignOrVerifyOperation __pyx_base;
};


/* "pkcs11/_pkcs11.pyx":1747
 * 
 * 
 * cdef class DataVerifyOperation(SignOrVerifyOperation):             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
*/
struct __pyx_obj_6pkcs11_7_pkcs11_DataVerifyOperation {
  struct __pyx_obj_6pkcs11_7_pkcs11_SignOrVerifyOperation __pyx_base;
};


/* "pkcs11/_pkcs11.pyx":34
 * 
 * 
 * cdef class lib(HasFuncList)             # <<<<<<<<<<<<<<
 * 
 * cdef class HasFuncList:
*/
struct __pyx_obj_6pkcs11_7_pkcs11_lib {
  struct __pyx_obj_6pkcs11_7_pkcs11_HasFuncList __pyx_base;
  struct __pyx_vtabstruct_6pkcs11_7_pkcs11_lib *__pyx_vtab;
  PyObject *so;
  PyObject *manufacturer_id;
  PyObject *library_description;
  int initialized;
  CK_VERSION _cryptoki_version;
  CK_VERSION _library_version;
  P11_HANDLE *_p11_handle;
};


/* "pkcs11/_pkcs11.pyx":733
 *         return self
 * 
 *     def _batch_iter(self, results, count):             # <<<<<<<<<<<<<<
 *         for ix in range(count):
 *             yield make_object(self.session, results[ix])
*/
struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter {
  PyObject_HEAD
  PyObject *__pyx_v_count;
  PyObject *__pyx_v_ix;
  PyObject *__pyx_v_results;
  struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter *__pyx_v_self;
  PyObject *__pyx_t_0;
  PyObject *(*__pyx_t_1)(PyObject *);
};


/* "pkcs11/_pkcs11.pyx":915
 *         assertRV(retval)
 * 
 *     def get_objects(self, attrs=None, batch_size=10):             # <<<<<<<<<<<<<<
 *         with SearchIter(self, attrs or {}, batch_size) as op:
 *             for batch in op:
*/
struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects {
  PyObject_HEAD
  PyObject *__pyx_v_attrs;
  PyObject *__pyx_v_batch;
  PyObject *__pyx_v_batch_size;
  PyObject *__pyx_v_op;
  struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self;
  PyObject *__pyx_t_0;
  PyObject *__pyx_t_1;
  PyObject *__pyx_t_2;
  PyObject *__pyx_t_3;
  PyObject *__pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
};


/* "pkcs11/_pkcs11.pyx":1588
 *         self.execute_resizing_output(self.op_final)
 * 
 *     def update_chunks(self, chunks):             # <<<<<<<<<<<<<<
 *         cdef CK_BYTE *data_ptr
 *         cdef CK_ULONG data_len
*/
struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks {
  PyObject_HEAD
  PyObject *__pyx_v_chunk;
  PyObject *__pyx_v_chunks;
  CK_ULONG __pyx_v_data_len;
  CK_BYTE *__pyx_v_data_ptr;
  struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *__pyx_v_self;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "pkcs11/_pkcs11.pyx":1621
 * 
 * 
 *     def _encrypt_generator(self, data,             # <<<<<<<<<<<<<<
 *                            mechanism=None, mechanism_param=None,
 *                            buffer_size=8192):
*/
struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator {
  PyObject_HEAD
  PyObject *__pyx_v_buffer_size;
  PyObject *__pyx_v_data;
  PyObject *__pyx_v_mechanism;
  PyObject *__pyx_v_mechanism_param;
  struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *__pyx_v_op;
  PyObject *__pyx_v_self;
  PyObject *__pyx_t_0;
  PyObject *__pyx_t_1;
  PyObject *__pyx_t_2;
  PyObject *__pyx_t_3;
};


/* "pkcs11/_pkcs11.pyx":1655
 * 
 * 
 *     def _decrypt_generator(self, data,             # <<<<<<<<<<<<<<
 *                            mechanism=None, mechanism_param=None, pin=None,
 *                            buffer_size=8192):
*/
struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator {
  PyObject_HEAD
  PyObject *__pyx_v_buffer_size;
  PyObject *__pyx_v_data;
  PyObject *__pyx_v_mechanism;
  PyObject *__pyx_v_mechanism_param;
  struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *__pyx_v_op;
  PyObject *__pyx_v_pin;
  PyObject *__pyx_v_self;
  struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session;
  PyObject *__pyx_t_0;
  PyObject *__pyx_t_1;
  PyObject *__pyx_t_2;
  PyObject *__pyx_t_3;
};


/* "pkcs11/_pkcs11.pyx":2127
 * 
 * 
 *     def get_tokens(self,             # <<<<<<<<<<<<<<
 *                    token_label=None,
 *                    token_serial=None,
*/
struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens {
  PyObject_HEAD
  PyObject *__pyx_v_mechanisms;
  struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self;
  PyObject *__pyx_v_slot;
  PyObject *__pyx_v_slot_flags;
  PyObject *__pyx_v_token;
  PyObject *__pyx_v_token_flags;
  PyObject *__pyx_v_token_label;
  PyObject *__pyx_v_token_mechanisms;
  PyObject *__pyx_v_token_serial;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
  PyObject *__pyx_t_3;
  PyObject *__pyx_t_4;
  PyObject *__pyx_t_5;
};


/* "View.MemoryView":118
 * 
 * 
 * @cython.collection_type("sequence")             # <<<<<<<<<<<<<<
 * @cname("__pyx_array")
 * cdef class array:
*/
struct __pyx_array_obj {
  PyObject_HEAD
  struct __pyx_vtabstruct_array *__pyx_vtab;
  char *data;
  Py_ssize_t len;
  char *format;
  int ndim;
  Py_ssize_t *_shape;
  Py_ssize_t *_strides;
  Py_ssize_t itemsize;
  PyObject *mode;
  PyObject *_format;
  void (*callback_free_data)(void *);
  int free_data;
  int dtype_is_object;
};


/* "View.MemoryView":307
 * 
 * 
 * @cname('__pyx_MemviewEnum')             # <<<<<<<<<<<<<<
 * cdef class Enum(object):
 *     cdef object name
*/
struct __pyx_MemviewEnum_obj {
  PyObject_HEAD
  PyObject *name;
};


/* "View.MemoryView":342
 * 
 * 
 * @cname('__pyx_memoryview')             # <<<<<<<<<<<<<<
 * cdef class memoryview:
 * 
*/
struct __pyx_memoryview_obj {
  PyObject_HEAD
  struct __pyx_vtabstruct_memoryview *__pyx_vtab;
  PyObject *obj;
  PyObject *_size;
  void *_unused;
  PyThread_type_lock lock;
  __pyx_atomic_int_type acquisition_count;
  Py_buffer view;
  int flags;
  int dtype_is_object;
  __Pyx_TypeInfo const *typeinfo;
};


/* "View.MemoryView":856
 * 
 * 
 * @cython.collection_type("sequence")             # <<<<<<<<<<<<<<
 * @cname('__pyx_memoryviewslice')
 * cdef class _memoryviewslice(memoryview):
*/
struct __pyx_memoryviewslice_obj {
  struct __pyx_memoryview_obj __pyx_base;
  __Pyx_memviewslice from_slice;
  PyObject *from_object;
  PyObject *(*to_object_func)(char *);
  int (*to_dtype_func)(char *, PyObject *);
};



/* "View.MemoryView":118
 * 
 * 
 * @cython.collection_type("sequence")             # <<<<<<<<<<<<<<
 * @cname("__pyx_array")
 * cdef class array:
*/

struct __pyx_vtabstruct_array {
  PyObject *(*get_memview)(struct __pyx_array_obj *);
};
static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;


/* "pkcs11/_pkcs11.pyx":1969
 * 
 * 
 * cdef class lib(HasFuncList):             # <<<<<<<<<<<<<<
 *     """
 *     Main entry point.
*/

struct __pyx_vtabstruct_6pkcs11_7_pkcs11_lib {
  PyObject *(*_load_pkcs11_lib)(struct __pyx_obj_6pkcs11_7_pkcs11_lib *, PyObject *);
  PyObject *(*initialize)(struct __pyx_obj_6pkcs11_7_pkcs11_lib *, int __pyx_skip_dispatch);
  CK_RV (*_finalize)(struct __pyx_obj_6pkcs11_7_pkcs11_lib *);
};
static struct __pyx_vtabstruct_6pkcs11_7_pkcs11_lib *__pyx_vtabptr_6pkcs11_7_pkcs11_lib;


/* "pkcs11/_pkcs11.pyx":50
 * 
 * 
 * cdef class AttributeList:             # <<<<<<<<<<<<<<
 *     """
 *     A list of CK_ATTRIBUTE objects.
*/

struct __pyx_vtabstruct_6pkcs11_7_pkcs11_AttributeList {
  struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *(*from_owned_pointer)(CK_ATTRIBUTE *, CK_ULONG);
  struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *(*from_template)(PyObject *, PyObject *);
  PyObject *(*at_index)(struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *, CK_ULONG, PyObject *);
};
static struct __pyx_vtabstruct_6pkcs11_7_pkcs11_AttributeList *__pyx_vtabptr_6pkcs11_7_pkcs11_AttributeList;


/* "pkcs11/_pkcs11.pyx":319
 * 
 * 
 * cdef class Slot(HasFuncList, types.Slot):             # <<<<<<<<<<<<<<
 *     """Extend Slot with implementation."""
 * 
*/

struct __pyx_vtabstruct_6pkcs11_7_pkcs11_Slot {
  struct __pyx_obj_6pkcs11_7_pkcs11_Slot *(*make)(struct CK_FUNCTION_LIST *, CK_SLOT_ID, CK_SLOT_INFO, CK_VERSION);
};
static struct __pyx_vtabstruct_6pkcs11_7_pkcs11_Slot *__pyx_vtabptr_6pkcs11_7_pkcs11_Slot;


/* "pkcs11/_pkcs11.pyx":433
 * 
 * 
 * cdef class Token(HasFuncList, types.Token):             # <<<<<<<<<<<<<<
 *     """Extend Token with implementation."""
 * 
*/

struct __pyx_vtabstruct_6pkcs11_7_pkcs11_Token {
  struct __pyx_obj_6pkcs11_7_pkcs11_Token *(*make)(struct __pyx_obj_6pkcs11_7_pkcs11_Slot *, CK_TOKEN_INFO);
};
static struct __pyx_vtabstruct_6pkcs11_7_pkcs11_Token *__pyx_vtabptr_6pkcs11_7_pkcs11_Token;


/* "pkcs11/_pkcs11.pyx":560
 * 
 * 
 * cdef class OperationContext:             # <<<<<<<<<<<<<<
 *     cdef Session session
 *     cdef bint active
*/

struct __pyx_vtabstruct_6pkcs11_7_pkcs11_OperationContext {
  PyObject *(*_handle_final_retval)(struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *, CK_RV);
  PyObject *(*_operation_aware_assert)(struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *, CK_RV);
};
static struct __pyx_vtabstruct_6pkcs11_7_pkcs11_OperationContext *__pyx_vtabptr_6pkcs11_7_pkcs11_OperationContext;


/* "pkcs11/_pkcs11.pyx":605
 * 
 * 
 * cdef class OperationWithBinaryOutput(OperationContext):             # <<<<<<<<<<<<<<
 * 
 *     cdef MechanismWithParam mech
*/

struct __pyx_vtabstruct_6pkcs11_7_pkcs11_OperationWithBinaryOutput {
  struct __pyx_vtabstruct_6pkcs11_7_pkcs11_OperationContext __pyx_base;
  struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *(*_setup)(PyTypeObject *, struct __pyx_obj_6pkcs11_7_pkcs11_Session *, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *, CK_ULONG);
  PyObject *(*resize_buffer)(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *, CK_ULONG);
  PyObject *(*current_output)(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *);
  CK_RV (*update_resizing_output)(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *, __pyx_t_6pkcs11_7_pkcs11_OperationUpdateWithResult, CK_BYTE *, CK_ULONG);
  CK_RV (*execute_resizing_output)(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *, __pyx_t_6pkcs11_7_pkcs11_OperationWithResult);
  PyObject *(*process_fully)(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *, __pyx_t_6pkcs11_7_pkcs11_OperationUpdateWithResult, CK_BYTE *, CK_ULONG);
  PyObject *(*update_with_result)(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *, __pyx_t_6pkcs11_7_pkcs11_OperationUpdateWithResult, CK_BYTE *, CK_ULONG);
  PyObject *(*update_no_output)(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *, __pyx_t_6pkcs11_7_pkcs11_OperationUpdate, CK_BYTE *, CK_ULONG);
  PyObject *(*finish_with_output)(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *, __pyx_t_6pkcs11_7_pkcs11_OperationWithResult);
};
static struct __pyx_vtabstruct_6pkcs11_7_pkcs11_OperationWithBinaryOutput *__pyx_vtabptr_6pkcs11_7_pkcs11_OperationWithBinaryOutput;
static CYTHON_INLINE PyObject *__pyx_f_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_current_output(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *);


/* "pkcs11/_pkcs11.pyx":717
 * 
 * 
 * cdef class SearchIter(OperationContext):             # <<<<<<<<<<<<<<
 *     """Iterate a search for objects on a session."""
 * 
*/

struct __pyx_vtabstruct_6pkcs11_7_pkcs11_SearchIter {
  struct __pyx_vtabstruct_6pkcs11_7_pkcs11_OperationContext __pyx_base;
};
static struct __pyx_vtabstruct_6pkcs11_7_pkcs11_SearchIter *__pyx_vtabptr_6pkcs11_7_pkcs11_SearchIter;


/* "pkcs11/_pkcs11.pyx":778
 * 
 * 
 * cdef class DigestOperation(OperationWithBinaryOutput):             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
*/

struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DigestOperation {
  struct __pyx_vtabstruct_6pkcs11_7_pkcs11_OperationWithBinaryOutput __pyx_base;
  struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *(*setup)(struct __pyx_obj_6pkcs11_7_pkcs11_Session *, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *, CK_ULONG);
  PyObject *(*digest_process_fully)(struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *, CK_BYTE *, CK_ULONG);
  void (*update_digest)(struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *, CK_BYTE *, CK_ULONG);
  void (*update_digest_with_key)(struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *, CK_OBJECT_HANDLE);
  PyObject *(*finish)(struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *);
};
static struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DigestOperation *__pyx_vtabptr_6pkcs11_7_pkcs11_DigestOperation;


/* "pkcs11/_pkcs11.pyx":850
 * 
 * 
 * cdef class Session(HasFuncList, types.Session):             # <<<<<<<<<<<<<<
 *     """Extend Session with implementation."""
 * 
*/

struct __pyx_vtabstruct_6pkcs11_7_pkcs11_Session {
  struct __pyx_obj_6pkcs11_7_pkcs11_Session *(*make)(struct __pyx_obj_6pkcs11_7_pkcs11_Token *, CK_SESSION_HANDLE, int, CK_USER_TYPE, PyObject *, unsigned int);
  struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *(*make_attribute_list)(struct __pyx_obj_6pkcs11_7_pkcs11_Session *, PyObject *);
  PyObject *(*generate_key_from_attrs)(struct __pyx_obj_6pkcs11_7_pkcs11_Session *, struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *);
  PyObject *(*generate_keypair_from_attrs)(struct __pyx_obj_6pkcs11_7_pkcs11_Session *, struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *, struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *);
};
static struct __pyx_vtabstruct_6pkcs11_7_pkcs11_Session *__pyx_vtabptr_6pkcs11_7_pkcs11_Session;


/* "pkcs11/_pkcs11.pyx":1197
 *         assertRV(retval)
 * 
 * cdef class ObjectHandleWrapper(HasFuncList):             # <<<<<<<<<<<<<<
 *     """
 *     Class implementing generic operations on PKCS#11 objects.
*/

struct __pyx_vtabstruct_6pkcs11_7_pkcs11_ObjectHandleWrapper {
  struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *(*wrap)(struct __pyx_obj_6pkcs11_7_pkcs11_Session *, CK_OBJECT_HANDLE);
  struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *(*get_attribute_list)(struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *, CK_ATTRIBUTE_TYPE *, CK_ULONG);
};
static struct __pyx_vtabstruct_6pkcs11_7_pkcs11_ObjectHandleWrapper *__pyx_vtabptr_6pkcs11_7_pkcs11_ObjectHandleWrapper;


/* "pkcs11/_pkcs11.pyx":1490
 * 
 * 
 * cdef class KeyOperation(OperationWithBinaryOutput):             # <<<<<<<<<<<<<<
 *     cdef CK_OBJECT_HANDLE key
 *     cdef KeyOperationInit op_init
*/

struct __pyx_vtabstruct_6pkcs11_7_pkcs11_KeyOperation {
  struct __pyx_vtabstruct_6pkcs11_7_pkcs11_OperationWithBinaryOutput __pyx_base;
  struct __pyx_obj_6pkcs11_7_pkcs11_KeyOperation *(*_common_key_setup)(PyTypeObject *, struct __pyx_obj_6pkcs11_7_pkcs11_Session *, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *, CK_OBJECT_HANDLE, CK_ULONG);
};
static struct __pyx_vtabstruct_6pkcs11_7_pkcs11_KeyOperation *__pyx_vtabptr_6pkcs11_7_pkcs11_KeyOperation;


/* "pkcs11/_pkcs11.pyx":1541
 * 
 * 
 * cdef class DataCryptOperation(KeyOperation):             # <<<<<<<<<<<<<<
 * 
 *     cdef OperationUpdateWithResult op_update
*/

struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DataCryptOperation {
  struct __pyx_vtabstruct_6pkcs11_7_pkcs11_KeyOperation __pyx_base;
  struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *(*setup_encrypt)(struct __pyx_obj_6pkcs11_7_pkcs11_Session *, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *, CK_OBJECT_HANDLE, CK_ULONG);
  struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *(*setup_decrypt)(struct __pyx_obj_6pkcs11_7_pkcs11_Session *, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *, CK_OBJECT_HANDLE, CK_ULONG);
  PyObject *(*crypt_process_fully)(struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *, CK_BYTE *, CK_ULONG);
  PyObject *(*finish)(struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *);
};
static struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DataCryptOperation *__pyx_vtabptr_6pkcs11_7_pkcs11_DataCryptOperation;


/* "pkcs11/_pkcs11.pyx":1671
 * 
 * 
 * cdef class SignOrVerifyOperation(KeyOperation):             # <<<<<<<<<<<<<<
 *     cdef OperationUpdate op_update
 * 
*/

struct __pyx_vtabstruct_6pkcs11_7_pkcs11_SignOrVerifyOperation {
  struct __pyx_vtabstruct_6pkcs11_7_pkcs11_KeyOperation __pyx_base;
};
static struct __pyx_vtabstruct_6pkcs11_7_pkcs11_SignOrVerifyOperation *__pyx_vtabptr_6pkcs11_7_pkcs11_SignOrVerifyOperation;


/* "pkcs11/_pkcs11.pyx":1687
 * 
 * 
 * cdef class DataSignOperation(SignOrVerifyOperation):             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
*/

struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DataSignOperation {
  struct __pyx_vtabstruct_6pkcs11_7_pkcs11_SignOrVerifyOperation __pyx_base;
  struct __pyx_obj_6pkcs11_7_pkcs11_DataSignOperation *(*setup)(struct __pyx_obj_6pkcs11_7_pkcs11_Session *, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *, CK_OBJECT_HANDLE, CK_ULONG);
  PyObject *(*sign_process_fully)(struct __pyx_obj_6pkcs11_7_pkcs11_DataSignOperation *, CK_BYTE *, CK_ULONG);
  PyObject *(*finish)(struct __pyx_obj_6pkcs11_7_pkcs11_DataSignOperation *);
};
static struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DataSignOperation *__pyx_vtabptr_6pkcs11_7_pkcs11_DataSignOperation;


/* "pkcs11/_pkcs11.pyx":1747
 * 
 * 
 * cdef class DataVerifyOperation(SignOrVerifyOperation):             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
*/

struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DataVerifyOperation {
  struct __pyx_vtabstruct_6pkcs11_7_pkcs11_SignOrVerifyOperation __pyx_base;
  struct __pyx_obj_6pkcs11_7_pkcs11_DataVerifyOperation *(*setup)(struct __pyx_obj_6pkcs11_7_pkcs11_Session *, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *, CK_OBJECT_HANDLE);
  PyObject *(*verify_process_fully)(struct __pyx_obj_6pkcs11_7_pkcs11_DataVerifyOperation *, CK_BYTE *, CK_ULONG, CK_BYTE *, CK_ULONG);
  PyObject *(*finish)(struct __pyx_obj_6pkcs11_7_pkcs11_DataVerifyOperation *, CK_BYTE *, CK_ULONG);
};
static struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DataVerifyOperation *__pyx_vtabptr_6pkcs11_7_pkcs11_DataVerifyOperation;


/* "View.MemoryView":342
 * 
 * 
 * @cname('__pyx_memoryview')             # <<<<<<<<<<<<<<
 * cdef class memoryview:
 * 
*/

struct __pyx_vtabstruct_memoryview {
  char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *);
  PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *);
  PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
  PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *);
  PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
  PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *);
  PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *);
  PyObject *(*_get_base)(struct __pyx_memoryview_obj *);
};
static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;


/* "View.MemoryView":856
 * 
 * 
 * @cython.collection_type("sequence")             # <<<<<<<<<<<<<<
 * @cname('__pyx_memoryviewslice')
 * cdef class _memoryviewslice(memoryview):
*/

struct __pyx_vtabstruct__memoryviewslice {
  struct __pyx_vtabstruct_memoryview __pyx_base;
};
static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
/* #### Code section: utility_code_proto ### */

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

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

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

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

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

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

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

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

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

/* PyTypeError_Check.proto */
#define __Pyx_PyExc_TypeError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_TypeError)

/* PyOverflowError_Check.proto */
#define __Pyx_PyExc_OverflowError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_OverflowError)

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

/* PyIndexError_Check.proto */
#define __Pyx_PyExc_IndexError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_IndexError)

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

/* IncludeStringH.proto (used by BytesEquals) */
#include <string.h>

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

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

/* fastcall.proto */
#if CYTHON_AVOID_BORROWED_REFS
    #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_PySequence_ITEM(args, i)
#elif CYTHON_ASSUME_SAFE_MACROS
    #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_NewRef(__Pyx_PyTuple_GET_ITEM(args, i))
#else
    #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_XNewRef(PyTuple_GetItem(args, i))
#endif
#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds)
#define __Pyx_KwValues_VARARGS(args, nargs) NULL
#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s)
#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw)
#if CYTHON_METH_FASTCALL
    #define __Pyx_ArgRef_FASTCALL(args, i) __Pyx_NewRef(args[i])
    #define __Pyx_NumKwargs_FASTCALL(kwds) __Pyx_PyTuple_GET_SIZE(kwds)
    #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs))
    static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
    CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues);
  #else
    #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw)
  #endif
#else
    #define __Pyx_ArgRef_FASTCALL __Pyx_ArgRef_VARARGS
    #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS
    #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS
    #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS
    #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS
#endif
#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop)
#if CYTHON_METH_FASTCALL || (CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(args + start, stop - start)
#else
#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop)
#endif

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

/* CallCFunction.proto (used by CallUnboundCMethod0) */
#define __Pyx_CallCFunction(cfunc, self, args)\
    ((PyCFunction)(void(*)(void))(cfunc)->func)(self, args)
#define __Pyx_CallCFunctionWithKeywords(cfunc, self, args, kwargs)\
    ((PyCFunctionWithKeywords)(void(*)(void))(cfunc)->func)(self, args, kwargs)
#define __Pyx_CallCFunctionFast(cfunc, self, args, nargs)\
    ((__Pyx_PyCFunctionFast)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs)
#define __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, nargs, kwnames)\
    ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs, kwnames)

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

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

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

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

/* UnpackUnboundCMethod.proto (used by CallUnboundCMethod0) */
typedef struct {
    PyObject *type;
    PyObject **method_name;
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && CYTHON_ATOMICS
    __pyx_atomic_int_type initialized;
#endif
    PyCFunction func;
    PyObject *method;
    int flag;
} __Pyx_CachedCFunction;
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
static CYTHON_INLINE int __Pyx_CachedCFunction_GetAndSetInitializing(__Pyx_CachedCFunction *cfunc) {
#if !CYTHON_ATOMICS
    return 1;
#else
    __pyx_nonatomic_int_type expected = 0;
    if (__pyx_atomic_int_cmp_exchange(&cfunc->initialized, &expected, 1)) {
        return 0;
    }
    return expected;
#endif
}
static CYTHON_INLINE void __Pyx_CachedCFunction_SetFinishedInitializing(__Pyx_CachedCFunction *cfunc) {
#if CYTHON_ATOMICS
    __pyx_atomic_store(&cfunc->initialized, 2);
#endif
}
#else
#define __Pyx_CachedCFunction_GetAndSetInitializing(cfunc) 2
#define __Pyx_CachedCFunction_SetFinishedInitializing(cfunc)
#endif

/* CallUnboundCMethod0.proto */
CYTHON_UNUSED
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
#else
#define __Pyx_CallUnboundCMethod0(cfunc, self)  __Pyx__CallUnboundCMethod0(cfunc, self)
#endif

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

/* OwnedDictNext.proto (used by ParseKeywordsImpl) */
#if CYTHON_AVOID_BORROWED_REFS
static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue);
#else
CYTHON_INLINE
static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue);
#endif

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

/* ParseKeywordsImpl.export */
static int __Pyx_ParseKeywordsTuple(
    PyObject *kwds,
    PyObject * const *kwvalues,
    PyObject ** const argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs
);
static int __Pyx_ParseKeywordDictToDict(
    PyObject *kwds,
    PyObject ** const argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name
);
static int __Pyx_ParseKeywordDict(
    PyObject *kwds,
    PyObject ** const argnames[],
    PyObject *values[],
    Py_ssize_t num_pos_args,
    Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs
);

/* CallUnboundCMethod2.proto */
CYTHON_UNUSED
static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2);
#else
#define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2)  __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2)
#endif

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

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

/* ArgTypeTestFunc.export */
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);

/* ArgTypeTest.proto */
#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
    ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\
        __Pyx__ArgTypeTest(obj, type, name, exact))

/* PyValueError_Check.proto */
#define __Pyx_PyExc_ValueError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_ValueError)

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

/* PyObjectFastCallMethod.proto */
#if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000
#define __Pyx_PyObject_FastCallMethod(name, args, nargsf) PyObject_VectorcallMethod(name, args, nargsf, NULL)
#else
static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf);
#endif

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

/* PyMemoryError_Check.proto */
#define __Pyx_PyExc_MemoryError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_MemoryError)

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

/* COrdinalToPyUnicode.proto (used by CIntToPyUnicode) */
static CYTHON_INLINE int __Pyx_CheckUnicodeValue(int value);
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromOrdinal_Padded(int value, Py_ssize_t width, char padding_char);

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

/* IncludeStdlibH.proto (used by CIntToPyUnicode) */
#include <stdlib.h>

/* CIntToPyUnicode.proto */
#define __Pyx_PyUnicode_From_int(value, width, padding_char, format_char) (\
    ((format_char) == ('c')) ?\
        __Pyx_uchar___Pyx_PyUnicode_From_int(value, width, padding_char) :\
        __Pyx____Pyx_PyUnicode_From_int(value, width, padding_char, format_char)\
    )
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char);
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char);

/* CIntToPyUnicode.proto */
#define __Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char, format_char) (\
    ((format_char) == ('c')) ?\
        __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char) :\
        __Pyx____Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char, format_char)\
    )
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char);
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char);

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

/* PyObjectFormatSimple.proto */
#if CYTHON_COMPILING_IN_PYPY
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        PyObject_Format(s, f))
#elif CYTHON_USE_TYPE_SLOTS
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        likely(PyLong_CheckExact(s)) ? PyLong_Type.tp_repr(s) :\
        likely(PyFloat_CheckExact(s)) ? PyFloat_Type.tp_repr(s) :\
        PyObject_Format(s, f))
#else
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        PyObject_Format(s, f))
#endif

CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/
/* GetAttr.proto */
static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);

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

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

/* RejectKeywords.export */
static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds);

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

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

/* GetAttr3.proto */
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);

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

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

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

/* PyAssertionError_Check.proto */
#define __Pyx_PyExc_AssertionError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_AssertionError)

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

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

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

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

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

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

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

/* ImportImpl.export */
static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level);

/* Import.proto */
static CYTHON_INLINE PyObject *__Pyx_Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, int level);

CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
/* ListCompAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len)) {
        Py_INCREF(x);
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
        L->ob_item[len] = x;
        #else
        PyList_SET_ITEM(list, len, x);
        #endif
        __Pyx_SET_SIZE(list, len + 1);
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
#endif

/* PySequenceMultiply.proto */
#define __Pyx_PySequence_Multiply_Left(mul, seq)  __Pyx_PySequence_Multiply(seq, mul)
#if !CYTHON_USE_TYPE_SLOTS
#define  __Pyx_PySequence_Multiply PySequence_Repeat
#else
static CYTHON_INLINE PyObject* __Pyx_PySequence_Multiply(PyObject *seq, Py_ssize_t mul);
#endif

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

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

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

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

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

/* PyObjectVectorCallKwBuilder.proto */
CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n);
#if CYTHON_VECTORCALL
#if PY_VERSION_HEX >= 0x03090000
#define __Pyx_Object_Vectorcall_CallFromBuilder PyObject_Vectorcall
#else
#define __Pyx_Object_Vectorcall_CallFromBuilder _PyObject_Vectorcall
#endif
#define __Pyx_MakeVectorcallBuilderKwds(n) PyTuple_New(n)
static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n);
static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n);
#else
#define __Pyx_Object_Vectorcall_CallFromBuilder __Pyx_PyObject_FastCallDict
#define __Pyx_MakeVectorcallBuilderKwds(n) __Pyx_PyDict_NewPresized(n)
#define __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n) PyDict_SetItem(builder, key, value)
#define __Pyx_VectorcallBuilder_AddArgStr(key, value, builder, args, n) PyDict_SetItemString(builder, key, value)
#endif

/* PyNumber_Hex.proto */
#define __Pyx_PyNumber_Hex(obj) PyNumber_ToBase((obj), 16)

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

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

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

/* PyObjectGetMethod.proto (used by PyObjectCallMethod0) */
#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
#endif

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

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

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

/* UnpackTuple2.proto (used by dict_iter) */
static CYTHON_INLINE int __Pyx_unpack_tuple2(
    PyObject* tuple, PyObject** value1, PyObject** value2, int is_tuple, int has_known_size, int decref_tuple);
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
    PyObject* tuple, PyObject** value1, PyObject** value2, int decref_tuple);
static int __Pyx_unpack_tuple2_generic(
    PyObject* tuple, PyObject** value1, PyObject** value2, int has_known_size, int decref_tuple);

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

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

/* PyKeyError_Check.proto */
#define __Pyx_PyExc_KeyError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_KeyError)

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

/* BufferIndexError.proto (used by BufferIndexErrorNogil) */
static void __Pyx_RaiseBufferIndexError(int axis);

/* BufferIndexErrorNogil.proto */
static void __Pyx_RaiseBufferIndexErrorNogil(int axis);

/* PyObject_Unicode.proto */
#define __Pyx_PyObject_Unicode(obj)\
    (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Str(obj))

/* PyObjectVectorCallMethodKwBuilder.proto */
#if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000
#define __Pyx_Object_VectorcallMethod_CallFromBuilder PyObject_VectorcallMethod
#else
static PyObject *__Pyx_Object_VectorcallMethod_CallFromBuilder(PyObject *name, PyObject *const *args, size_t nargsf, PyObject *kwnames);
#endif

/* PyNotImplementedError_Check.proto */
#define __Pyx_PyExc_NotImplementedError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_NotImplementedError)

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

/* tp_new.proto */
#define __Pyx_tp_new(type_obj, args) __Pyx_tp_new_kwargs(type_obj, args, NULL)
static CYTHON_INLINE PyObject* __Pyx_tp_new_kwargs(PyObject* type_obj, PyObject* args, PyObject* kwargs);

/* SliceMemoryviewSlice.proto */
static CYTHON_INLINE int __pyx_memoryview_slice_memviewslice(
        __Pyx_memviewslice *dst,
        Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
        int dim, int new_ndim, int *suboffset_dim,
        Py_ssize_t start, Py_ssize_t stop, Py_ssize_t step,
        int have_start, int have_stop, int have_step,
        int is_slice);

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

/* PyRange_Check.proto */
#if CYTHON_COMPILING_IN_PYPY && !defined(PyRange_Check)
  #define PyRange_Check(obj)  __Pyx_TypeCheck((obj), &PyRange_Type)
#endif

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

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

/* dict_setdefault.proto (used by FetchCommonType) */
static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value);

/* LimitedApiGetTypeDict.proto (used by SetItemOnTypeDict) */
#if CYTHON_COMPILING_IN_LIMITED_API
static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp);
#endif

/* SetItemOnTypeDict.proto (used by FixUpExtensionType) */
static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v);
#define __Pyx_SetItemOnTypeDict(tp, k, v) __Pyx__SetItemOnTypeDict((PyTypeObject*)tp, k, v)

/* FixUpExtensionType.proto (used by FetchCommonType) */
static CYTHON_INLINE int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type);

/* AddModuleRef.proto (used by FetchSharedCythonModule) */
#if ((CYTHON_COMPILING_IN_CPYTHON_FREETHREADING ) ||\
     __PYX_LIMITED_VERSION_HEX < 0x030d0000)
  static PyObject *__Pyx_PyImport_AddModuleRef(const char *name);
#else
  #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
#endif

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

/* FetchCommonType.proto (used by CommonTypesMetaclass) */
static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases);

/* CommonTypesMetaclass.proto (used by CoroutineBase) */
static int __pyx_CommonTypesMetaclass_init(PyObject *module);
#define __Pyx_CommonTypesMetaclass_USED

/* CallTypeTraverse.proto (used by CoroutineBase) */
#if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000)
#define __Pyx_call_type_traverse(o, always_call, visit, arg) 0
#else
static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg);
#endif

/* IterNextPlain.proto (used by CoroutineBase) */
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator);
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void);
#endif

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

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

/* ReturnWithStopIteration.proto (used by CoroutineBase) */
static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext);

/* CoroutineBase.proto (used by Generator) */
struct __pyx_CoroutineObject;
typedef PyObject *(*__pyx_coroutine_body_t)(struct __pyx_CoroutineObject *, PyThreadState *, PyObject *);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_ExcInfoStruct  _PyErr_StackItem
#else
typedef struct {
    PyObject *exc_type;
    PyObject *exc_value;
    PyObject *exc_traceback;
} __Pyx_ExcInfoStruct;
#endif
typedef struct __pyx_CoroutineObject {
    PyObject_HEAD
    __pyx_coroutine_body_t body;
    PyObject *closure;
    __Pyx_ExcInfoStruct gi_exc_state;
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    PyObject *gi_weakreflist;
#endif
    PyObject *classobj;
    PyObject *yieldfrom;
    __Pyx_pyiter_sendfunc yieldfrom_am_send;
    PyObject *gi_name;
    PyObject *gi_qualname;
    PyObject *gi_modulename;
    PyObject *gi_code;
    PyObject *gi_frame;
#if CYTHON_USE_SYS_MONITORING && (CYTHON_PROFILE || CYTHON_TRACE)
    PyMonitoringState __pyx_pymonitoring_state[__Pyx_MonitoringEventTypes_CyGen_count];
    uint64_t __pyx_pymonitoring_version;
#endif
    int resume_label;
    char is_running;
} __pyx_CoroutineObject;
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
    PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
    PyObject *name, PyObject *qualname, PyObject *module_name);
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
            __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name);
static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self);
static int __Pyx_Coroutine_clear(PyObject *self);
static __Pyx_PySendResult __Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval);
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
static __Pyx_PySendResult __Pyx_Coroutine_Close(PyObject *self, PyObject **retval);
static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_Coroutine_SwapException(self)
#define __Pyx_Coroutine_ResetAndClearException(self)  __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state)
#else
#define __Pyx_Coroutine_SwapException(self) {\
    __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\
    __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\
    }
#define __Pyx_Coroutine_ResetAndClearException(self) {\
    __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\
    (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\
    }
#endif
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
    __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue)
#else
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue)
#endif
static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue);
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state);
static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen);
static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen);
static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen);
static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure);
#if __PYX_HAS_PY_AM_SEND == 2
static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send);
#endif
static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg);

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

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

/* PyLongBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static CYTHON_INLINE PyObject* __Pyx_PyLong_FloorDivideObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyLong_FloorDivideObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceFloorDivide(op1, op2) : PyNumber_FloorDivide(op1, op2))
#endif

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

/* PyObjectDelAttr.proto (used by PyObjectSetAttrStr) */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000
#define __Pyx_PyObject_DelAttr(o, n) PyObject_SetAttr(o, n, NULL)
#else
#define __Pyx_PyObject_DelAttr(o, n) PyObject_DelAttr(o, n)
#endif

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

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

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

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

/* PyStopIteration_Check.proto */
#define __Pyx_PyExc_StopIteration_Check(obj)  __Pyx_TypeCheck(obj, PyExc_StopIteration)

/* AllocateExtensionType.proto */
static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final);

/* DeallocKeepAlive.proto */
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#define __Pyx_DeallocKeepAliveBegin(o) do {\
        _Py_atomic_store_uintptr_relaxed(&(o)->ob_tid, _Py_ThreadId());\
        _Py_atomic_store_uint32_relaxed(&(o)->ob_ref_local, 1);\
        _Py_atomic_store_ssize_relaxed(&(o)->ob_ref_shared, 0);\
    } while (0)
#define __Pyx_DeallocKeepAliveEnd(o)\
        _Py_atomic_store_uint32_relaxed(&(o)->ob_ref_local, 0)
#else
#define __Pyx_DeallocKeepAliveBegin(o) __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1)
#define __Pyx_DeallocKeepAliveEnd(o)   __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1)
#endif

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

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

/* CheckTypeForFreelists.proto */
#if CYTHON_USE_FREELISTS
#if CYTHON_USE_TYPE_SPECS
#define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t) == (expected_tp)))
#define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS  Py_TPFLAGS_IS_ABSTRACT
#else
#define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t)->tp_basicsize == (expected_size)))
#define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS  (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)
#endif
#define __PYX_CHECK_TYPE_FOR_FREELISTS(t, expected_tp, expected_size)\
    (__PYX_CHECK_FINAL_TYPE_FOR_FREELISTS((t), (expected_tp), (expected_size)) &\
     (int) (!__Pyx_PyType_HasFeature((t), __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS)))
#endif

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

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

/* DelItemOnTypeDict.proto (used by SetupReduce) */
static int __Pyx__DelItemOnTypeDict(PyTypeObject *tp, PyObject *k);
#define __Pyx_DelItemOnTypeDict(tp, k) __Pyx__DelItemOnTypeDict((PyTypeObject*)tp, k)

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

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

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

/* MergeVTables.proto */
static int __Pyx_MergeVtables(PyTypeObject *type);

/* TypeImport.proto */
#ifndef __PYX_HAVE_RT_ImportType_proto_3_2_8
#define __PYX_HAVE_RT_ImportType_proto_3_2_8
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
#include <stdalign.h>
#endif
#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L
#define __PYX_GET_STRUCT_ALIGNMENT_3_2_8(s) alignof(s)
#else
#define __PYX_GET_STRUCT_ALIGNMENT_3_2_8(s) sizeof(void*)
#endif
enum __Pyx_ImportType_CheckSize_3_2_8 {
   __Pyx_ImportType_CheckSize_Error_3_2_8 = 0,
   __Pyx_ImportType_CheckSize_Warn_3_2_8 = 1,
   __Pyx_ImportType_CheckSize_Ignore_3_2_8 = 2
};
static PyTypeObject *__Pyx_ImportType_3_2_8(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_8 check_size);
#endif

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

/* PyMethodNew.proto (used by CythonFunctionShared) */
static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ);

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

/* CythonFunctionShared.proto (used by CythonFunction) */
#define __Pyx_CyFunction_USED
#define __Pyx_CYFUNCTION_STATICMETHOD  0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
#define __Pyx_CYFUNCTION_CCLASS        0x04
#define __Pyx_CYFUNCTION_COROUTINE     0x08
#define __Pyx_CyFunction_GetClosure(f)\
    (((__pyx_CyFunctionObject *) (f))->func_closure)
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_CyFunction_GetClassObj(f)\
      (((__pyx_CyFunctionObject *) (f))->func_classobj)
#else
  #define __Pyx_CyFunction_GetClassObj(f)\
      ((PyObject*) ((PyCMethodObject *) (f))->mm_class)
#endif
#define __Pyx_CyFunction_SetClassObj(f, classobj)\
    __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj))
#define __Pyx_CyFunction_Defaults(type, f)\
    ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
    ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject_HEAD
    PyObject *func;
#elif PY_VERSION_HEX < 0x030900B1
    PyCFunctionObject func;
#else
    PyCMethodObject func;
#endif
#if CYTHON_COMPILING_IN_LIMITED_API && CYTHON_METH_FASTCALL
    __pyx_vectorcallfunc func_vectorcall;
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *func_weakreflist;
#endif
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    PyObject *func_dict;
#endif
    PyObject *func_name;
    PyObject *func_qualname;
    PyObject *func_doc;
    PyObject *func_globals;
    PyObject *func_code;
    PyObject *func_closure;
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
    PyObject *func_classobj;
#endif
    PyObject *defaults;
    int flags;
    PyObject *defaults_tuple;
    PyObject *defaults_kwdict;
    PyObject *(*defaults_getter)(PyObject *);
    PyObject *func_annotations;
    PyObject *func_is_coroutine;
} __pyx_CyFunctionObject;
#undef __Pyx_CyOrPyCFunction_Check
#define __Pyx_CyFunction_Check(obj)  __Pyx_TypeCheck(obj, __pyx_mstate_global->__pyx_CyFunctionType)
#define __Pyx_CyOrPyCFunction_Check(obj)  __Pyx_TypeCheck2(obj, __pyx_mstate_global->__pyx_CyFunctionType, &PyCFunction_Type)
#define __Pyx_CyFunction_CheckExact(obj)  __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_CyFunctionType)
static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void));
#undef __Pyx_IsSameCFunction
#define __Pyx_IsSameCFunction(func, cfunc)   __Pyx__IsSameCyOrCFunction(func, cfunc)
static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *closure,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);
static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj);
static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func,
                                                         PyTypeObject *defaults_type);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
                                                            PyObject *tuple);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
                                                             PyObject *dict);
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
                                                              PyObject *dict);
static int __pyx_CyFunction_init(PyObject *module);
#if CYTHON_METH_FASTCALL
static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
#if CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall)
#else
#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall)
#endif
#endif

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

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

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

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

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

/* CLineInTraceback.proto (used by AddTraceback) */
#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
#else
#define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
#endif

/* CodeObjectCache.proto (used by AddTraceback) */
#if CYTHON_COMPILING_IN_LIMITED_API
typedef PyObject __Pyx_CachedCodeObjectType;
#else
typedef PyCodeObject __Pyx_CachedCodeObjectType;
#endif
typedef struct {
    __Pyx_CachedCodeObjectType* code_object;
    int code_line;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
    int count;
    int max_count;
    __Pyx_CodeObjectCacheEntry* entries;
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    __pyx_atomic_int_type accessor_count;
  #endif
};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object);

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

/* BufferStructDeclare.proto */
typedef struct {
  Py_ssize_t shape, strides, suboffsets;
} __Pyx_Buf_DimInfo;
typedef struct {
  size_t refcount;
  Py_buffer pybuffer;
} __Pyx_Buffer;
typedef struct {
  __Pyx_Buffer *rcbuffer;
  char *data;
  __Pyx_Buf_DimInfo diminfo[8];
} __Pyx_LocalBuf_ND;

/* MemviewRefcount.proto */
static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
    __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock);
static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
    __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock);
#define __pyx_get_slice_count_pointer(memview) (&memview->acquisition_count)
#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
#define __PYX_XCLEAR_MEMVIEW(slice, have_gil) __Pyx_XCLEAR_MEMVIEW(slice, have_gil, __LINE__)
static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int);
static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *, int, int);

/* MemviewSliceIsContig.proto */
static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim);

/* OverlappingSlices.proto */
static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
                                __Pyx_memviewslice *slice2,
                                int ndim, size_t itemsize);

/* MemviewSliceInit.proto */
static int __Pyx_init_memviewslice(
                struct __pyx_memoryview_obj *memview,
                int ndim,
                __Pyx_memviewslice *memviewslice,
                int memview_is_new_reference);

static PyObject* __pyx_convert__to_py_CK_VERSION(CK_VERSION s);
/* IsLittleEndian.proto (used by BufferFormatCheck) */
static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);

/* BufferFormatCheck.proto (used by MemviewSliceValidateAndInit) */
static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
                              __Pyx_BufFmt_StackElem* stack,
                              const __Pyx_TypeInfo* type);

/* TypeInfoCompare.proto (used by MemviewSliceValidateAndInit) */
static int __pyx_typeinfo_cmp(const __Pyx_TypeInfo *a, const __Pyx_TypeInfo *b);

/* MemviewSliceValidateAndInit.export */
static int __Pyx_ValidateAndInit_memviewslice(
                int *axes_specs,
                int c_or_f_flag,
                int buf_flags,
                int ndim,
                const __Pyx_TypeInfo *dtype,
                __Pyx_BufFmt_StackElem stack[],
                __Pyx_memviewslice *memviewslice,
                PyObject *original_obj);

/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn_CK_MECHANISM_TYPE(PyObject *, int writable_flag);

/* MemviewDtypeToObject.proto */
static CYTHON_INLINE PyObject *__pyx_memview_get_nn_CK_MECHANISM_TYPE(const char *itemp);
static CYTHON_INLINE int __pyx_memview_set_nn_CK_MECHANISM_TYPE(char *itemp, PyObject *obj);

static PyObject* __pyx_convert__to_py_CK_MECHANISM_INFO(CK_MECHANISM_INFO s);
/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn_CK_BYTE(PyObject *, int writable_flag);

/* MemviewDtypeToObject.proto */
static CYTHON_INLINE PyObject *__pyx_memview_get_nn_CK_BYTE(const char *itemp);
static CYTHON_INLINE int __pyx_memview_set_nn_CK_BYTE(char *itemp, PyObject *obj);

/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn_CK_OBJECT_HANDLE(PyObject *, int writable_flag);

/* MemviewDtypeToObject.proto */
static CYTHON_INLINE PyObject *__pyx_memview_get_nn_CK_OBJECT_HANDLE(const char *itemp);
static CYTHON_INLINE int __pyx_memview_set_nn_CK_OBJECT_HANDLE(char *itemp, PyObject *obj);

/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn_CK_CHAR(PyObject *, int writable_flag);

/* MemviewDtypeToObject.proto */
static CYTHON_INLINE PyObject *__pyx_memview_get_nn_CK_CHAR(const char *itemp);
static CYTHON_INLINE int __pyx_memview_set_nn_CK_CHAR(char *itemp, PyObject *obj);

/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn_CK_SLOT_ID(PyObject *, int writable_flag);

/* MemviewDtypeToObject.proto */
static CYTHON_INLINE PyObject *__pyx_memview_get_nn_CK_SLOT_ID(const char *itemp);
static CYTHON_INLINE int __pyx_memview_set_nn_CK_SLOT_ID(char *itemp, PyObject *obj);

/* MemviewSliceCopy.proto */
static __Pyx_memviewslice
__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
                                 const char *mode, int ndim,
                                 size_t sizeof_dtype, int contig_flag,
                                 int dtype_is_object);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_CK_RV(CK_RV value);

/* CIntFromPy.proto */
static CYTHON_INLINE CK_RV __Pyx_PyLong_As_CK_RV(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_CK_ULONG(CK_ULONG value);

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

/* CIntFromPy.proto */
static CYTHON_INLINE CK_ULONG __Pyx_PyLong_As_CK_ULONG(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE CK_BYTE __Pyx_PyLong_As_CK_BYTE(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_CK_BYTE(CK_BYTE value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_CK_USER_TYPE(CK_USER_TYPE value);

/* CIntFromPy.proto */
static CYTHON_INLINE CK_USER_TYPE __Pyx_PyLong_As_CK_USER_TYPE(PyObject *);

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

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_CK_CHAR(CK_CHAR value);

/* CIntFromPy.proto */
static CYTHON_INLINE CK_CHAR __Pyx_PyLong_As_CK_CHAR(PyObject *);

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

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

/* UpdateUnpickledDict.proto */
static int __Pyx_UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index);

/* CheckUnpickleChecksum.proto */
static CYTHON_INLINE int __Pyx_CheckUnpickleChecksum(long checksum, long checksum1, long checksum2, long checksum3, const char *members);

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

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

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

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

/* FormatTypeName.proto */
#if CYTHON_COMPILING_IN_LIMITED_API
typedef PyObject *__Pyx_TypeName;
#define __Pyx_FMT_TYPENAME "%U"
#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj)
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
#define __Pyx_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName
#else
static __Pyx_TypeName __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp);
#endif
#else  // !LIMITED_API
typedef const char *__Pyx_TypeName;
#define __Pyx_FMT_TYPENAME "%.200s"
#define __Pyx_PyType_GetFullyQualifiedName(tp) ((tp)->tp_name)
#define __Pyx_DECREF_TypeName(obj)
#endif

/* GetRuntimeVersion.proto */
#if __PYX_LIMITED_VERSION_HEX < 0x030b0000
static unsigned long __Pyx_cached_runtime_version = 0;
static void __Pyx_init_runtime_version(void);
#else
#define __Pyx_init_runtime_version()
#endif
static unsigned long __Pyx_get_runtime_version(void);

/* CStringEquals.proto */
static CYTHON_INLINE int __Pyx_StrEq(const char *, const char *);

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

/* DecompressString.proto */
static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo);

/* MultiPhaseInitModuleState.proto */
#if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE
static PyObject *__Pyx_State_FindModule(void*);
static int __Pyx_State_AddModule(PyObject* module, void*);
static int __Pyx_State_RemoveModule(void*);
#elif CYTHON_USE_MODULE_STATE
#define __Pyx_State_FindModule PyState_FindModule
#define __Pyx_State_AddModule PyState_AddModule
#define __Pyx_State_RemoveModule PyState_RemoveModule
#endif

/* #### Code section: module_declarations ### */
/* CythonABIVersion.proto */
#if CYTHON_COMPILING_IN_LIMITED_API
    #if CYTHON_METH_FASTCALL
        #define __PYX_FASTCALL_ABI_SUFFIX  "_fastcall"
    #else
        #define __PYX_FASTCALL_ABI_SUFFIX
    #endif
    #define __PYX_LIMITED_ABI_SUFFIX "limited" __PYX_FASTCALL_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX
#else
    #define __PYX_LIMITED_ABI_SUFFIX
#endif
#if __PYX_HAS_PY_AM_SEND == 1
    #define __PYX_AM_SEND_ABI_SUFFIX
#elif __PYX_HAS_PY_AM_SEND == 2
    #define __PYX_AM_SEND_ABI_SUFFIX "amsendbackport"
#else
    #define __PYX_AM_SEND_ABI_SUFFIX "noamsend"
#endif
#ifndef __PYX_MONITORING_ABI_SUFFIX
    #define __PYX_MONITORING_ABI_SUFFIX
#endif
#if CYTHON_USE_TP_FINALIZE
    #define __PYX_TP_FINALIZE_ABI_SUFFIX
#else
    #define __PYX_TP_FINALIZE_ABI_SUFFIX "nofinalize"
#endif
#if CYTHON_USE_FREELISTS || !defined(__Pyx_AsyncGen_USED)
    #define __PYX_FREELISTS_ABI_SUFFIX
#else
    #define __PYX_FREELISTS_ABI_SUFFIX "nofreelists"
#endif
#define CYTHON_ABI  __PYX_ABI_VERSION __PYX_LIMITED_ABI_SUFFIX __PYX_MONITORING_ABI_SUFFIX __PYX_TP_FINALIZE_ABI_SUFFIX __PYX_FREELISTS_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX
#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI
#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "."

static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/
static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/
static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/
static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/
static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value); /* proto*/
static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/
static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self); /* proto*/
static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto*/
static struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_f_6pkcs11_7_pkcs11_13AttributeList_from_owned_pointer(CK_ATTRIBUTE *__pyx_v_data, CK_ULONG __pyx_v_count); /* proto*/
static struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_f_6pkcs11_7_pkcs11_13AttributeList_from_template(PyObject *__pyx_v_template, PyObject *__pyx_v_attribute_mapper); /* proto*/
static PyObject *__pyx_f_6pkcs11_7_pkcs11_13AttributeList_at_index(struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_self, CK_ULONG __pyx_v_index, PyObject *__pyx_v_attribute_mapper); /* proto*/
static struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_f_6pkcs11_7_pkcs11_4Slot_make(struct CK_FUNCTION_LIST *__pyx_v_funclist, CK_SLOT_ID __pyx_v_slot_id, CK_SLOT_INFO __pyx_v_info, CK_VERSION __pyx_v_cryptoki_version); /* proto*/
static struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_f_6pkcs11_7_pkcs11_5Token_make(struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_slot, CK_TOKEN_INFO __pyx_v_info); /* proto*/
static PyObject *__pyx_f_6pkcs11_7_pkcs11_16OperationContext__handle_final_retval(struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *__pyx_v_self, CK_RV __pyx_v_retval); /* proto*/
static PyObject *__pyx_f_6pkcs11_7_pkcs11_16OperationContext__operation_aware_assert(struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *__pyx_v_self, CK_RV __pyx_v_retval); /* proto*/
static struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *__pyx_f_6pkcs11_7_pkcs11_25OperationWithBinaryOutput__setup(PyTypeObject *__pyx_v_cls, struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_mech, CK_ULONG __pyx_v_buffer_size); /* proto*/
static PyObject *__pyx_f_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_resize_buffer(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *__pyx_v_self, CK_ULONG __pyx_v_length); /* proto*/
static CYTHON_INLINE PyObject *__pyx_f_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_current_output(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *__pyx_v_self); /* proto*/
static CK_RV __pyx_f_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_update_resizing_output(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *__pyx_v_self, __pyx_t_6pkcs11_7_pkcs11_OperationUpdateWithResult __pyx_v_op_update, CK_BYTE *__pyx_v_data, CK_ULONG __pyx_v_data_len); /* proto*/
static CK_RV __pyx_f_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_execute_resizing_output(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *__pyx_v_self, __pyx_t_6pkcs11_7_pkcs11_OperationWithResult __pyx_v_op); /* proto*/
static PyObject *__pyx_f_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_process_fully(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *__pyx_v_self, __pyx_t_6pkcs11_7_pkcs11_OperationUpdateWithResult __pyx_v_op, CK_BYTE *__pyx_v_data, CK_ULONG __pyx_v_data_len); /* proto*/
static PyObject *__pyx_f_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_update_with_result(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *__pyx_v_self, __pyx_t_6pkcs11_7_pkcs11_OperationUpdateWithResult __pyx_v_op, CK_BYTE *__pyx_v_data, CK_ULONG __pyx_v_data_len); /* proto*/
static PyObject *__pyx_f_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_update_no_output(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *__pyx_v_self, __pyx_t_6pkcs11_7_pkcs11_OperationUpdate __pyx_v_op, CK_BYTE *__pyx_v_data, CK_ULONG __pyx_v_data_len); /* proto*/
static PyObject *__pyx_f_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_finish_with_output(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *__pyx_v_self, __pyx_t_6pkcs11_7_pkcs11_OperationWithResult __pyx_v_op_final); /* proto*/
static struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *__pyx_f_6pkcs11_7_pkcs11_15DigestOperation_setup(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_mech, CK_ULONG __pyx_v_buffer_size); /* proto*/
static PyObject *__pyx_f_6pkcs11_7_pkcs11_15DigestOperation_digest_process_fully(struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *__pyx_v_self, CK_BYTE *__pyx_v_data, CK_ULONG __pyx_v_data_len); /* proto*/
static void __pyx_f_6pkcs11_7_pkcs11_15DigestOperation_update_digest(struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *__pyx_v_self, CK_BYTE *__pyx_v_data, CK_ULONG __pyx_v_data_len); /* proto*/
static void __pyx_f_6pkcs11_7_pkcs11_15DigestOperation_update_digest_with_key(struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *__pyx_v_self, CK_OBJECT_HANDLE __pyx_v_key); /* proto*/
static PyObject *__pyx_f_6pkcs11_7_pkcs11_15DigestOperation_finish(struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *__pyx_v_self); /* proto*/
static struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_f_6pkcs11_7_pkcs11_7Session_make(struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_v_token, CK_SESSION_HANDLE __pyx_v_handle, int __pyx_v_rw, CK_USER_TYPE __pyx_v_user_type, PyObject *__pyx_v_mapper, unsigned int __pyx_v_cancel_strategy); /* proto*/
static struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_f_6pkcs11_7_pkcs11_7Session_make_attribute_list(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, PyObject *__pyx_v_template); /* proto*/
static PyObject *__pyx_f_6pkcs11_7_pkcs11_7Session_generate_key_from_attrs(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_attrs, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_mech); /* proto*/
static PyObject *__pyx_f_6pkcs11_7_pkcs11_7Session_generate_keypair_from_attrs(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_public_attrs, struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_private_attrs, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_mech); /* proto*/
static struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *__pyx_f_6pkcs11_7_pkcs11_19ObjectHandleWrapper_wrap(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session, CK_OBJECT_HANDLE __pyx_v_handle); /* proto*/
static struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_f_6pkcs11_7_pkcs11_19ObjectHandleWrapper_get_attribute_list(struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *__pyx_v_self, CK_ATTRIBUTE_TYPE *__pyx_v_keys, CK_ULONG __pyx_v_total); /* proto*/
static struct __pyx_obj_6pkcs11_7_pkcs11_KeyOperation *__pyx_f_6pkcs11_7_pkcs11_12KeyOperation__common_key_setup(PyTypeObject *__pyx_v_cls, struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_mech, CK_OBJECT_HANDLE __pyx_v_key, CK_ULONG __pyx_v_buffer_size); /* proto*/
static struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *__pyx_f_6pkcs11_7_pkcs11_18DataCryptOperation_setup_encrypt(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_mech, CK_OBJECT_HANDLE __pyx_v_key, CK_ULONG __pyx_v_buffer_size); /* proto*/
static struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *__pyx_f_6pkcs11_7_pkcs11_18DataCryptOperation_setup_decrypt(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_mech, CK_OBJECT_HANDLE __pyx_v_key, CK_ULONG __pyx_v_buffer_size); /* proto*/
static PyObject *__pyx_f_6pkcs11_7_pkcs11_18DataCryptOperation_crypt_process_fully(struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *__pyx_v_self, CK_BYTE *__pyx_v_data, CK_ULONG __pyx_v_data_len); /* proto*/
static PyObject *__pyx_f_6pkcs11_7_pkcs11_18DataCryptOperation_finish(struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *__pyx_v_self); /* proto*/
static struct __pyx_obj_6pkcs11_7_pkcs11_DataSignOperation *__pyx_f_6pkcs11_7_pkcs11_17DataSignOperation_setup(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_mech, CK_OBJECT_HANDLE __pyx_v_key, CK_ULONG __pyx_v_buffer_size); /* proto*/
static PyObject *__pyx_f_6pkcs11_7_pkcs11_17DataSignOperation_sign_process_fully(struct __pyx_obj_6pkcs11_7_pkcs11_DataSignOperation *__pyx_v_self, CK_BYTE *__pyx_v_data, CK_ULONG __pyx_v_data_len); /* proto*/
static PyObject *__pyx_f_6pkcs11_7_pkcs11_17DataSignOperation_finish(struct __pyx_obj_6pkcs11_7_pkcs11_DataSignOperation *__pyx_v_self); /* proto*/
static struct __pyx_obj_6pkcs11_7_pkcs11_DataVerifyOperation *__pyx_f_6pkcs11_7_pkcs11_19DataVerifyOperation_setup(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_mech, CK_OBJECT_HANDLE __pyx_v_key); /* proto*/
static PyObject *__pyx_f_6pkcs11_7_pkcs11_19DataVerifyOperation_verify_process_fully(struct __pyx_obj_6pkcs11_7_pkcs11_DataVerifyOperation *__pyx_v_self, CK_BYTE *__pyx_v_data, CK_ULONG __pyx_v_data_len, CK_BYTE *__pyx_v_sig, CK_ULONG __pyx_v_sig_len); /* proto*/
static PyObject *__pyx_f_6pkcs11_7_pkcs11_19DataVerifyOperation_finish(struct __pyx_obj_6pkcs11_7_pkcs11_DataVerifyOperation *__pyx_v_self, CK_BYTE *__pyx_v_sig, CK_ULONG __pyx_v_sig_len); /* proto*/
static PyObject *__pyx_f_6pkcs11_7_pkcs11_3lib__load_pkcs11_lib(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self, PyObject *__pyx_v_so); /* proto*/
static PyObject *__pyx_f_6pkcs11_7_pkcs11_3lib_initialize(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static CK_RV __pyx_f_6pkcs11_7_pkcs11_3lib__finalize(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self); /* proto*/

/* Module declarations from "cython.view" */

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

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

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

/* Module declarations from "__builtin__" */

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

/* Module declarations from "cpython" */

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

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

/* Module declarations from "pkcs11._pkcs11" */
static PyObject *__pyx_collections_abc_Sequence = 0;
static PyObject *generic = 0;
static PyObject *strided = 0;
static PyObject *indirect = 0;
static PyObject *contiguous = 0;
static PyObject *indirect_contiguous = 0;
static int __pyx_memoryview_thread_locks_used;
static PyThread_type_lock __pyx_memoryview_thread_locks[8];
static CYTHON_INLINE PyObject *__pyx_f_6pkcs11_7_pkcs11_CK_BYTE_buffer(PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_6pkcs11_7_pkcs11_CK_ULONG_buffer(PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_6pkcs11_7_pkcs11_map_rv_to_error(CK_RV); /*proto*/
static PyObject *__pyx_f_6pkcs11_7_pkcs11_assertRV(PyObject *); /*proto*/
static PyObject *__pyx_f_6pkcs11_7_pkcs11_make_object(struct __pyx_obj_6pkcs11_7_pkcs11_Session *, CK_OBJECT_HANDLE); /*proto*/
static int __Pyx_carray_from_py_CK_BYTE(PyObject *, CK_BYTE *, Py_ssize_t); /*proto*/
static int __pyx_array_allocate_buffer(struct __pyx_array_obj *); /*proto*/
static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char const *, char *); /*proto*/
static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo const *); /*proto*/
static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
static PyObject *_unellipsify(PyObject *, int); /*proto*/
static int assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/
static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/
static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/
static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/
static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/
static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/
static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/
static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/
static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/
static int __pyx_memoryview_err_dim(PyObject *, PyObject *, int); /*proto*/
static int __pyx_memoryview_err(PyObject *, PyObject *); /*proto*/
static int __pyx_memoryview_err_no_memory(void); /*proto*/
static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/
static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/
static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/
static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/
static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/
static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/
/* #### Code section: typeinfo ### */
static const __Pyx_TypeInfo __Pyx_TypeInfo_nn_CK_MECHANISM_TYPE = { "CK_MECHANISM_TYPE", NULL, sizeof(CK_MECHANISM_TYPE), { 0 }, 0, __PYX_IS_UNSIGNED(CK_MECHANISM_TYPE) ? 'U' : 'I', __PYX_IS_UNSIGNED(CK_MECHANISM_TYPE), 0 };
static const __Pyx_TypeInfo __Pyx_TypeInfo_nn_CK_BYTE = { "CK_BYTE", NULL, sizeof(CK_BYTE), { 0 }, 0, __PYX_IS_UNSIGNED(CK_BYTE) ? 'U' : 'I', __PYX_IS_UNSIGNED(CK_BYTE), 0 };
static const __Pyx_TypeInfo __Pyx_TypeInfo_nn_CK_OBJECT_HANDLE = { "CK_OBJECT_HANDLE", NULL, sizeof(CK_OBJECT_HANDLE), { 0 }, 0, __PYX_IS_UNSIGNED(CK_OBJECT_HANDLE) ? 'U' : 'I', __PYX_IS_UNSIGNED(CK_OBJECT_HANDLE), 0 };
static const __Pyx_TypeInfo __Pyx_TypeInfo_nn_CK_CHAR = { "CK_CHAR", NULL, sizeof(CK_CHAR), { 0 }, 0, __PYX_IS_UNSIGNED(CK_CHAR) ? 'U' : 'I', __PYX_IS_UNSIGNED(CK_CHAR), 0 };
static const __Pyx_TypeInfo __Pyx_TypeInfo_nn_CK_SLOT_ID = { "CK_SLOT_ID", NULL, sizeof(CK_SLOT_ID), { 0 }, 0, __PYX_IS_UNSIGNED(CK_SLOT_ID) ? 'U' : 'I', __PYX_IS_UNSIGNED(CK_SLOT_ID), 0 };
/* #### Code section: before_global_var ### */
#define __Pyx_MODULE_NAME "pkcs11._pkcs11"
extern int __pyx_module_is_main_pkcs11___pkcs11;
int __pyx_module_is_main_pkcs11___pkcs11 = 0;

/* Implementation of "pkcs11._pkcs11" */
/* #### Code section: global_var ### */
static PyObject *__pyx_builtin_property;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_map;
static PyObject *__pyx_builtin_super;
static PyObject *__pyx_builtin___import__;
static PyObject *__pyx_builtin_Ellipsis;
static PyObject *__pyx_builtin_id;
/* #### Code section: string_decls ### */
static const char __pyx_k_c[] = "c";
static const char __pyx_k_name[] = "name";
static const char __pyx_k_fortran[] = "fortran";
static const char __pyx_k_High_level_Python_PKCS_11_Wrapp[] = "\nHigh-level Python PKCS#11 Wrapper.\n\nMost class here inherit from pkcs11.types, which provides easier introspection\nfor Sphinx/Jedi/etc, as this module is not importable without having the\nlibrary loaded.\n";
static const char __pyx_k_not_enough_values_found_during_a[] = "not enough values found during array assignment, expected %zd, got %zd";
static const char __pyx_k_too_many_values_found_during_arr[] = "too many values found during array assignment, expected %zd";
/* #### Code section: decls ### */
static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */
static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */
static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object); /* proto */
static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */
static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6pkcs11_7_pkcs11_11HasFuncList___cinit__(struct __pyx_obj_6pkcs11_7_pkcs11_HasFuncList *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_11HasFuncList_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_HasFuncList *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_11HasFuncList_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_HasFuncList *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6pkcs11_7_pkcs11_13AttributeList___cinit__(struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_attrs); /* proto */
static int __pyx_pf_6pkcs11_7_pkcs11_13AttributeList_2__init__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_attrs); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_13AttributeList_4as_dict(struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_self, PyObject *__pyx_v_attribute_mapper); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_13AttributeList_6get(struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_attribute_mapper); /* proto */
static void __pyx_pf_6pkcs11_7_pkcs11_13AttributeList_8__dealloc__(struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_13AttributeList_10__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_13AttributeList_12__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6pkcs11_7_pkcs11_18MechanismWithParam___cinit__(struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args); /* proto */
static int __pyx_pf_6pkcs11_7_pkcs11_18MechanismWithParam_2__init__(struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_self, PyObject *__pyx_v_key_type, PyObject *__pyx_v_mapping, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_param); /* proto */
static void __pyx_pf_6pkcs11_7_pkcs11_18MechanismWithParam_4__dealloc__(struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_18MechanismWithParam_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_18MechanismWithParam_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6pkcs11_7_pkcs11_4Slot___init__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_4Slot_5flags___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_4Slot_16hardware_version___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_4Slot_16firmware_version___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_4Slot_16cryptoki_version___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_4Slot_2get_token(struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_4Slot_4get_mechanisms(struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_4Slot_6get_mechanism_info(struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_self, PyObject *__pyx_v_mechanism); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_4Slot_8_identity(struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_4Slot_10__str__(struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_4Slot_12__repr__(struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_4Slot_7slot_id___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_4Slot_16slot_description___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_4Slot_15manufacturer_id___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_4Slot_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_4Slot_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6pkcs11_7_pkcs11_5Token___init__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_5Token_5flags___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_5Token_16hardware_version___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_5Token_16firmware_version___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_5Token_2open(struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_v_self, PyObject *__pyx_v_rw, PyObject *__pyx_v_user_pin, PyObject *__pyx_v_so_pin, PyObject *__pyx_v_user_type, PyObject *__pyx_v_attribute_mapper, PyObject *__pyx_v_cancel_strategy); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_5Token_4__str__(struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_5Token_6_identity(struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_5Token_8__repr__(struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_5Token_4slot___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_5Token_5label___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_5Token_6serial___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_5Token_15manufacturer_id___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_5Token_5model___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_5Token_10__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_5Token_12__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6pkcs11_7_pkcs11_16OperationContext___cinit__(struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *__pyx_v_self, PyObject *__pyx_v_session, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static int __pyx_pf_6pkcs11_7_pkcs11_16OperationContext_2__init__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_session); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_16OperationContext_4__enter__(struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_16OperationContext_6__exit__(struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_val, CYTHON_UNUSED PyObject *__pyx_v_exc_tb); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_16OperationContext_8_initiate(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_16OperationContext_10_finalize(struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_silent); /* proto */
static void __pyx_pf_6pkcs11_7_pkcs11_16OperationContext_12__del__(struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_16OperationContext_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_16OperationContext_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_25OperationWithBinaryOutput___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6pkcs11_7_pkcs11_10SearchIter___init__(struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter *__pyx_v_self, PyObject *__pyx_v_session, PyObject *__pyx_v_attrs, PyObject *__pyx_v_batch_size); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_10SearchIter_2__iter__(struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_10SearchIter_4_batch_iter(struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter *__pyx_v_self, PyObject *__pyx_v_results, PyObject *__pyx_v_count); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_10SearchIter_7__next__(struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_10SearchIter_9_initiate(struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_10SearchIter_11_finalize(struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter *__pyx_v_self, PyObject *__pyx_v_silent); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_10SearchIter_13__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_10SearchIter_15__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_15DigestOperation__initiate(struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_15DigestOperation_2ingest_chunks(struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *__pyx_v_self, PyObject *__pyx_v_chunks); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_15DigestOperation_4_finalize(struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *__pyx_v_self, PyObject *__pyx_v_silent); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_15DigestOperation_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_15DigestOperation_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_merge_templates(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_default_template, PyObject *__pyx_v_user_templates); /* proto */
static int __pyx_pf_6pkcs11_7_pkcs11_7Session___init__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_2_identity(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_9user_type___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_4close(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_6get_objects(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, PyObject *__pyx_v_attrs, PyObject *__pyx_v_batch_size); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_9reaffirm_credentials(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, PyObject *__pyx_v_pin); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_11create_object(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, PyObject *__pyx_v_attrs); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_13create_domain_parameters(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, PyObject *__pyx_v_key_type, PyObject *__pyx_v_attrs, PyObject *__pyx_v_local, PyObject *__pyx_v_store); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_15generate_domain_parameters(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, PyObject *__pyx_v_key_type, PyObject *__pyx_v_param_length, PyObject *__pyx_v_store, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param, PyObject *__pyx_v_template); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_17generate_key(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, PyObject *__pyx_v_key_type, PyObject *__pyx_v_key_length, PyObject *__pyx_v_id, PyObject *__pyx_v_label, PyObject *__pyx_v_store, PyObject *__pyx_v_capabilities, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param, PyObject *__pyx_v_template); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_19_generate_keypair(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, PyObject *__pyx_v_key_type, PyObject *__pyx_v_key_length, PyObject *__pyx_v_id, PyObject *__pyx_v_label, PyObject *__pyx_v_store, PyObject *__pyx_v_capabilities, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param, PyObject *__pyx_v_public_template, PyObject *__pyx_v_private_template); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_21seed_random(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, PyObject *__pyx_v_seed); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_23generate_random(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, PyObject *__pyx_v_nbits); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_25__digest_operation(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_27_digest(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_29_digest_generator(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_31set_pin(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, PyObject *__pyx_v_old_pin, PyObject *__pyx_v_new_pin); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_33init_pin(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, PyObject *__pyx_v_pin); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_6handle___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_5token___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_2rw___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_35__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_37__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6pkcs11_7_pkcs11_19ObjectHandleWrapper___init__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_19ObjectHandleWrapper_2__getitem__(struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static int __pyx_pf_6pkcs11_7_pkcs11_19ObjectHandleWrapper_4__setitem__(struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_19ObjectHandleWrapper_6destroy(struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_19ObjectHandleWrapper_8copy(struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *__pyx_v_self, PyObject *__pyx_v_attrs); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_19ObjectHandleWrapper_10identity(struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_19ObjectHandleWrapper_7session___get__(struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_19ObjectHandleWrapper_6handle___get__(struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_19ObjectHandleWrapper_12__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_19ObjectHandleWrapper_14__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_6Object___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *__pyx_v_wrapper); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_6Object_2__getitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_6Object_4__setitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_6Object_6get_attributes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_keys); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_6Object_8session(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_6Object_10handle(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_6Object_12copy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_attrs); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_6Object_14destroy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_6Object_16_identity(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_27GenerateWithParametersMixin_generate_keypair(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_id, PyObject *__pyx_v_label, PyObject *__pyx_v_store, PyObject *__pyx_v_capabilities, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param, PyObject *__pyx_v_public_template, PyObject *__pyx_v_private_template); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_12KeyOperation_unclean_shutdown(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_KeyOperation *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_12KeyOperation_2_initiate(struct __pyx_obj_6pkcs11_7_pkcs11_KeyOperation *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_12KeyOperation_4_cancel_operation(struct __pyx_obj_6pkcs11_7_pkcs11_KeyOperation *__pyx_v_self, PyObject *__pyx_v_silent); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_12KeyOperation_6_finalize(struct __pyx_obj_6pkcs11_7_pkcs11_KeyOperation *__pyx_v_self, PyObject *__pyx_v_silent); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_12KeyOperation_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_KeyOperation *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_12KeyOperation_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_KeyOperation *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_18DataCryptOperation_unclean_shutdown(struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_18DataCryptOperation_2update_chunks(struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *__pyx_v_self, PyObject *__pyx_v_chunks); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_18DataCryptOperation_5__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_18DataCryptOperation_7__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_12EncryptMixin___encrypt_operation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param, PyObject *__pyx_v_buffer_size); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_12EncryptMixin_2_encrypt(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param, PyObject *__pyx_v_buffer_size); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_12EncryptMixin_4_encrypt_generator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param, PyObject *__pyx_v_buffer_size); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_12DecryptMixin___decrypt_operation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param, PyObject *__pyx_v_buffer_size); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_12DecryptMixin_2_decrypt(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param, PyObject *__pyx_v_pin, PyObject *__pyx_v_buffer_size); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_12DecryptMixin_4_decrypt_generator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param, PyObject *__pyx_v_pin, PyObject *__pyx_v_buffer_size); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_21SignOrVerifyOperation_ingest_chunks(struct __pyx_obj_6pkcs11_7_pkcs11_SignOrVerifyOperation *__pyx_v_self, PyObject *__pyx_v_chunks); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_21SignOrVerifyOperation_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_SignOrVerifyOperation *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_21SignOrVerifyOperation_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_SignOrVerifyOperation *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_17DataSignOperation_unclean_shutdown(struct __pyx_obj_6pkcs11_7_pkcs11_DataSignOperation *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_17DataSignOperation_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_DataSignOperation *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_17DataSignOperation_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_DataSignOperation *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_9SignMixin___sign_operation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param, PyObject *__pyx_v_buffer_size); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_9SignMixin_2_sign(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param, PyObject *__pyx_v_pin, PyObject *__pyx_v_buffer_size); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_9SignMixin_4_sign_generator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param, PyObject *__pyx_v_pin, PyObject *__pyx_v_buffer_size); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_19DataVerifyOperation_unclean_shutdown(struct __pyx_obj_6pkcs11_7_pkcs11_DataVerifyOperation *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_19DataVerifyOperation_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_DataVerifyOperation *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_19DataVerifyOperation_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_DataVerifyOperation *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_11VerifyMixin___verify_operation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_11VerifyMixin_2_verify(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_signature, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_11VerifyMixin_4_verify_generator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_signature, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_9WrapMixin_wrap_key(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_11UnwrapMixin_unwrap_key(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_object_class, PyObject *__pyx_v_key_type, PyObject *__pyx_v_key_data, PyObject *__pyx_v_id, PyObject *__pyx_v_label, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param, PyObject *__pyx_v_store, PyObject *__pyx_v_capabilities, PyObject *__pyx_v_template); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_11DeriveMixin_derive_key(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_key_type, PyObject *__pyx_v_key_length, PyObject *__pyx_v_id, PyObject *__pyx_v_label, PyObject *__pyx_v_store, PyObject *__pyx_v_capabilities, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param, PyObject *__pyx_v_template); /* proto */
static int __pyx_pf_6pkcs11_7_pkcs11_3lib___cinit__(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self, PyObject *__pyx_v_so); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_2initialize(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_4finalize(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_6reinitialize(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self); /* proto */
static int __pyx_pf_6pkcs11_7_pkcs11_3lib_8__init__(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self, PyObject *__pyx_v_so); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_15library_version___get__(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_16cryptoki_version___get__(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_10__str__(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_12__repr__(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_14get_slots(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self, PyObject *__pyx_v_token_present); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_16get_tokens(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self, PyObject *__pyx_v_token_label, PyObject *__pyx_v_token_serial, PyObject *__pyx_v_token_flags, PyObject *__pyx_v_slot_flags, PyObject *__pyx_v_mechanisms); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_19get_token(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_21wait_for_slot_event(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self, PyObject *__pyx_v_blocking); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_23unload(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self); /* proto */
static void __pyx_pf_6pkcs11_7_pkcs11_3lib_25__dealloc__(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_2so___get__(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_15manufacturer_id___get__(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_19library_description___get__(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_11initialized___get__(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_27__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_29__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11_HasFuncList(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11_lib(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11_AttributeList(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11_MechanismWithParam(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11_Slot(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11_Token(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11_OperationContext(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11_OperationWithBinaryOutput(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11_SearchIter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11_DigestOperation(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11_Session(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11_ObjectHandleWrapper(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11_KeyOperation(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11_DataCryptOperation(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11_SignOrVerifyOperation(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11_DataSignOperation(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11_DataVerifyOperation(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
/* #### Code section: late_includes ### */
/* #### Code section: module_state ### */
/* SmallCodeConfig */
#ifndef CYTHON_SMALL_CODE
#if defined(__clang__)
    #define CYTHON_SMALL_CODE
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
    #define CYTHON_SMALL_CODE __attribute__((cold))
#else
    #define CYTHON_SMALL_CODE
#endif
#endif

typedef struct {
  PyObject *__pyx_d;
  PyObject *__pyx_b;
  PyObject *__pyx_cython_runtime;
  PyObject *__pyx_empty_tuple;
  PyObject *__pyx_empty_bytes;
  PyObject *__pyx_empty_unicode;
  PyTypeObject *__pyx_ptype_7cpython_4type_type;
  PyObject *__pyx_type_6pkcs11_7_pkcs11_HasFuncList;
  PyObject *__pyx_type_6pkcs11_7_pkcs11_lib;
  PyObject *__pyx_type_6pkcs11_7_pkcs11_AttributeList;
  PyObject *__pyx_type_6pkcs11_7_pkcs11_MechanismWithParam;
  PyObject *__pyx_type_6pkcs11_7_pkcs11_Slot;
  PyObject *__pyx_type_6pkcs11_7_pkcs11_Token;
  PyObject *__pyx_type_6pkcs11_7_pkcs11_OperationContext;
  PyObject *__pyx_type_6pkcs11_7_pkcs11_OperationWithBinaryOutput;
  PyObject *__pyx_type_6pkcs11_7_pkcs11_SearchIter;
  PyObject *__pyx_type_6pkcs11_7_pkcs11_DigestOperation;
  PyObject *__pyx_type_6pkcs11_7_pkcs11_Session;
  PyObject *__pyx_type_6pkcs11_7_pkcs11_ObjectHandleWrapper;
  PyObject *__pyx_type_6pkcs11_7_pkcs11_KeyOperation;
  PyObject *__pyx_type_6pkcs11_7_pkcs11_DataCryptOperation;
  PyObject *__pyx_type_6pkcs11_7_pkcs11_SignOrVerifyOperation;
  PyObject *__pyx_type_6pkcs11_7_pkcs11_DataSignOperation;
  PyObject *__pyx_type_6pkcs11_7_pkcs11_DataVerifyOperation;
  PyObject *__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter;
  PyObject *__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects;
  PyObject *__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks;
  PyObject *__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator;
  PyObject *__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator;
  PyObject *__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens;
  PyObject *__pyx_type___pyx_array;
  PyObject *__pyx_type___pyx_MemviewEnum;
  PyObject *__pyx_type___pyx_memoryview;
  PyObject *__pyx_type___pyx_memoryviewslice;
  PyTypeObject *__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList;
  PyTypeObject *__pyx_ptype_6pkcs11_7_pkcs11_lib;
  PyTypeObject *__pyx_ptype_6pkcs11_7_pkcs11_AttributeList;
  PyTypeObject *__pyx_ptype_6pkcs11_7_pkcs11_MechanismWithParam;
  PyTypeObject *__pyx_ptype_6pkcs11_7_pkcs11_Slot;
  PyTypeObject *__pyx_ptype_6pkcs11_7_pkcs11_Token;
  PyTypeObject *__pyx_ptype_6pkcs11_7_pkcs11_OperationContext;
  PyTypeObject *__pyx_ptype_6pkcs11_7_pkcs11_OperationWithBinaryOutput;
  PyTypeObject *__pyx_ptype_6pkcs11_7_pkcs11_SearchIter;
  PyTypeObject *__pyx_ptype_6pkcs11_7_pkcs11_DigestOperation;
  PyTypeObject *__pyx_ptype_6pkcs11_7_pkcs11_Session;
  PyTypeObject *__pyx_ptype_6pkcs11_7_pkcs11_ObjectHandleWrapper;
  PyTypeObject *__pyx_ptype_6pkcs11_7_pkcs11_KeyOperation;
  PyTypeObject *__pyx_ptype_6pkcs11_7_pkcs11_DataCryptOperation;
  PyTypeObject *__pyx_ptype_6pkcs11_7_pkcs11_SignOrVerifyOperation;
  PyTypeObject *__pyx_ptype_6pkcs11_7_pkcs11_DataSignOperation;
  PyTypeObject *__pyx_ptype_6pkcs11_7_pkcs11_DataVerifyOperation;
  PyTypeObject *__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter;
  PyTypeObject *__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects;
  PyTypeObject *__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks;
  PyTypeObject *__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator;
  PyTypeObject *__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator;
  PyTypeObject *__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens;
  PyTypeObject *__pyx_array_type;
  PyTypeObject *__pyx_MemviewEnum_type;
  PyTypeObject *__pyx_memoryview_type;
  PyTypeObject *__pyx_memoryviewslice_type;
  __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items;
  __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop;
  __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values;
  __Pyx_CachedCFunction __pyx_umethod_PyBytes_Type__rstrip;
  PyObject *__pyx_k__9;
  PyObject *__pyx_slice[2];
  PyObject *__pyx_tuple[17];
  PyObject *__pyx_codeobj_tab[114];
  PyObject *__pyx_string_tab[763];
  PyObject *__pyx_number_tab[8];
/* #### Code section: module_state_contents ### */
/* CommonTypesMetaclass.module_state_decls */
PyTypeObject *__pyx_CommonTypesMetaclassType;

/* IterNextPlain.module_state_decls */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
PyObject *__Pyx_GetBuiltinNext_LimitedAPI_cache;
#endif

/* Generator.module_state_decls */
PyTypeObject *__pyx_GeneratorType;


#if CYTHON_USE_FREELISTS
struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter *__pyx_freelist_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter[8];
int __pyx_freecount_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects *__pyx_freelist_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects[8];
int __pyx_freecount_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks *__pyx_freelist_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks[8];
int __pyx_freecount_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator *__pyx_freelist_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator[8];
int __pyx_freecount_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator *__pyx_freelist_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator[8];
int __pyx_freecount_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens *__pyx_freelist_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens[8];
int __pyx_freecount_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens;
#endif
/* CachedMethodType.module_state_decls */
#if CYTHON_COMPILING_IN_LIMITED_API
PyObject *__Pyx_CachedMethodType;
#endif

/* CythonFunctionShared.module_state_decls */
PyTypeObject *__pyx_CyFunctionType;

/* CodeObjectCache.module_state_decls */
struct __Pyx_CodeObjectCache __pyx_code_cache;

/* #### Code section: module_state_end ### */
} __pyx_mstatetype;

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

#define __pyx_mstate_global (__Pyx_PyModule_GetState(__Pyx_State_FindModule(&__pyx_moduledef)))

#define __pyx_m (__Pyx_State_FindModule(&__pyx_moduledef))
#else
static __pyx_mstatetype __pyx_mstate_global_static =
#ifdef __cplusplus
    {};
#else
    {0};
#endif
static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_static;
#endif
/* #### Code section: constant_name_defines ### */
#define __pyx_kp_u_ __pyx_string_tab[0]
#define __pyx_kp_u_Buffer_view_does_not_expose_stri __pyx_string_tab[1]
#define __pyx_kp_u_Buffer_was_too_small_Should_neve __pyx_string_tab[2]
#define __pyx_kp_u_Can_only_create_a_buffer_that_is __pyx_string_tab[3]
#define __pyx_kp_u_Cannot_assign_to_read_only_memor __pyx_string_tab[4]
#define __pyx_kp_u_Cannot_create_writable_memory_vi __pyx_string_tab[5]
#define __pyx_kp_u_Cannot_index_with_type __pyx_string_tab[6]
#define __pyx_kp_u_Cannot_set_both_local_and_store __pyx_string_tab[7]
#define __pyx_kp_u_Cannot_transpose_memoryview_with __pyx_string_tab[8]
#define __pyx_kp_u_Cryptoki_Version_s_s __pyx_string_tab[9]
#define __pyx_kp_u_Dimension_d_is_not_direct __pyx_string_tab[10]
#define __pyx_kp_u_Empty_shape_tuple_for_cython_arr __pyx_string_tab[11]
#define __pyx_kp_u_Expand_DecryptMixin_with_an_impl __pyx_string_tab[12]
#define __pyx_kp_u_Expand_DeriveMixin_with_an_imple __pyx_string_tab[13]
#define __pyx_kp_u_Expand_EncryptMixin_with_an_impl __pyx_string_tab[14]
#define __pyx_kp_u_Expand_Object_with_an_implementa __pyx_string_tab[15]
#define __pyx_kp_u_Expand_SignMixin_with_an_impleme __pyx_string_tab[16]
#define __pyx_kp_u_Expand_UnwrapMixin_with_an_imple __pyx_string_tab[17]
#define __pyx_kp_u_Expand_VerifyMixin_with_an_imple __pyx_string_tab[18]
#define __pyx_kp_u_Expand_WrapMixin_with_an_impleme __pyx_string_tab[19]
#define __pyx_kp_u_Failed_to_cancel_operation __pyx_string_tab[20]
#define __pyx_kp_u_Firmware_Version_s_s __pyx_string_tab[21]
#define __pyx_kp_u_Flags_s __pyx_string_tab[22]
#define __pyx_kp_u_Hardware_Version_s_s __pyx_string_tab[23]
#define __pyx_kp_u_Indirect_dimensions_not_supporte __pyx_string_tab[24]
#define __pyx_kp_u_Initialisation_error_already_ini __pyx_string_tab[25]
#define __pyx_kp_u_Initialisation_error_not_initial __pyx_string_tab[26]
#define __pyx_kp_u_Invalid_mode_expected_c_or_fortr __pyx_string_tab[27]
#define __pyx_kp_u_Invalid_shape_in_axis __pyx_string_tab[28]
#define __pyx_kp_u_Library_Description_s __pyx_string_tab[29]
#define __pyx_kp_u_Library_Version_s_s __pyx_string_tab[30]
#define __pyx_kp_u_Library_s __pyx_string_tab[31]
#define __pyx_kp_u_ML_DSA_key_generation_requires_A __pyx_string_tab[32]
#define __pyx_kp_u_Manufacturer_ID_s __pyx_string_tab[33]
#define __pyx_kp_u_MemoryView_of __pyx_string_tab[34]
#define __pyx_kp_u_More_than_1_token_matches_s __pyx_string_tab[35]
#define __pyx_kp_u_Must_provide_key_length __pyx_string_tab[36]
#define __pyx_kp_u_No_default_capabilities_for_this __pyx_string_tab[37]
#define __pyx_kp_u_No_default_mechanism_for_this_ke __pyx_string_tab[38]
#define __pyx_kp_u_No_token_matching_s __pyx_string_tab[39]
#define __pyx_kp_u_None __pyx_string_tab[40]
#define __pyx_kp_u_Note_that_Cython_is_deliberately __pyx_string_tab[41]
#define __pyx_kp_u_OS_exception_while_loading __pyx_string_tab[42]
#define __pyx_kp_u_Out_of_bounds_on_buffer_access_a __pyx_string_tab[43]
#define __pyx_kp_u_Parallel_not_supported_Should_ne __pyx_string_tab[44]
#define __pyx_kp_u_Protected_authentication_is_not __pyx_string_tab[45]
#define __pyx_kp_u_Set_either_user_pin_or_so_pin __pyx_string_tab[46]
#define __pyx_kp_u_Slot_Description_s __pyx_string_tab[47]
#define __pyx_kp_u_Unable_to_convert_item_to_object __pyx_string_tab[48]
#define __pyx_kp_u_Unexpected_argument_to_mechanism __pyx_string_tab[49]
#define __pyx_kp_u_Unknown_exception_while_loading __pyx_string_tab[50]
#define __pyx_kp_u_Unmapped_error_code_s __pyx_string_tab[51]
#define __pyx_kp_u_User_type_invalid_Should_never_s __pyx_string_tab[52]
#define __pyx_kp_u__12 __pyx_string_tab[53]
#define __pyx_kp_u__2 __pyx_string_tab[54]
#define __pyx_kp_u__3 __pyx_string_tab[55]
#define __pyx_kp_u__4 __pyx_string_tab[56]
#define __pyx_kp_u__5 __pyx_string_tab[57]
#define __pyx_kp_u__8 __pyx_string_tab[58]
#define __pyx_kp_u_add_note __pyx_string_tab[59]
#define __pyx_kp_u_and __pyx_string_tab[60]
#define __pyx_kp_u_at_0x __pyx_string_tab[61]
#define __pyx_kp_u_collections_abc __pyx_string_tab[62]
#define __pyx_kp_u_contiguous_and_direct __pyx_string_tab[63]
#define __pyx_kp_u_contiguous_and_indirect __pyx_string_tab[64]
#define __pyx_kp_u_disable __pyx_string_tab[65]
#define __pyx_kp_u_enable __pyx_string_tab[66]
#define __pyx_kp_u_gc __pyx_string_tab[67]
#define __pyx_kp_u_got __pyx_string_tab[68]
#define __pyx_kp_u_got_differing_extents_in_dimensi __pyx_string_tab[69]
#define __pyx_kp_u_isenabled __pyx_string_tab[70]
#define __pyx_kp_u_itemsize_0_for_cython_array __pyx_string_tab[71]
#define __pyx_kp_u_key_length_is_the_length_in_bit __pyx_string_tab[72]
#define __pyx_kp_u_key_must_be_a_Key __pyx_string_tab[73]
#define __pyx_kp_u_key_type_must_be_KeyType __pyx_string_tab[74]
#define __pyx_kp_u_klass_label_label_serial_serial __pyx_string_tab[75]
#define __pyx_kp_u_klass_slotID_slot_id_flags_flag __pyx_string_tab[76]
#define __pyx_kp_u_mechanism_must_be_a_Mechanism __pyx_string_tab[77]
#define __pyx_kp_u_no_default___reduce___due_to_non __pyx_string_tab[78]
#define __pyx_kp_u_object __pyx_string_tab[79]
#define __pyx_kp_u_object_class_must_be_ObjectClas __pyx_string_tab[80]
#define __pyx_kp_u_param_length_is_the_length_in_b __pyx_string_tab[81]
#define __pyx_kp_u_pkcs11__pkcs11_pyx __pyx_string_tab[82]
#define __pyx_kp_u_pkcs11_lib_so __pyx_string_tab[83]
#define __pyx_kp_u_strided_and_direct __pyx_string_tab[84]
#define __pyx_kp_u_strided_and_direct_or_indirect __pyx_string_tab[85]
#define __pyx_kp_u_strided_and_indirect __pyx_string_tab[86]
#define __pyx_kp_u_tree_fragment __pyx_string_tab[87]
#define __pyx_kp_u_unable_to_allocate_array_data __pyx_string_tab[88]
#define __pyx_kp_u_unable_to_allocate_shape_and_str __pyx_string_tab[89]
#define __pyx_kp_u_utf_8 __pyx_string_tab[90]
#define __pyx_n_u_AES_CBC_ENCRYPT_DATA __pyx_string_tab[91]
#define __pyx_n_u_AES_CTR __pyx_string_tab[92]
#define __pyx_n_u_AES_ECB_ENCRYPT_DATA __pyx_string_tab[93]
#define __pyx_n_u_AES_GCM __pyx_string_tab[94]
#define __pyx_n_u_ASCII __pyx_string_tab[95]
#define __pyx_n_u_AnotherUserAlreadyLoggedIn __pyx_string_tab[96]
#define __pyx_n_u_ArgumentsBad __pyx_string_tab[97]
#define __pyx_n_u_Attribute __pyx_string_tab[98]
#define __pyx_n_u_AttributeList __pyx_string_tab[99]
#define __pyx_n_u_AttributeList___reduce_cython __pyx_string_tab[100]
#define __pyx_n_u_AttributeList___setstate_cython __pyx_string_tab[101]
#define __pyx_n_u_AttributeList_as_dict __pyx_string_tab[102]
#define __pyx_n_u_AttributeList_get __pyx_string_tab[103]
#define __pyx_n_u_AttributeMapper __pyx_string_tab[104]
#define __pyx_n_u_AttributeReadOnly __pyx_string_tab[105]
#define __pyx_n_u_AttributeSensitive __pyx_string_tab[106]
#define __pyx_n_u_AttributeTypeInvalid __pyx_string_tab[107]
#define __pyx_n_u_AttributeValueInvalid __pyx_string_tab[108]
#define __pyx_n_u_B __pyx_string_tab[109]
#define __pyx_n_u_BASE __pyx_string_tab[110]
#define __pyx_n_u_CANCEL_WITH_INIT __pyx_string_tab[111]
#define __pyx_n_u_CERTIFICATE __pyx_string_tab[112]
#define __pyx_n_u_CK_MECHANISM_TYPE_to_enum __pyx_string_tab[113]
#define __pyx_n_u_CK_UTF8CHAR_to_str __pyx_string_tab[114]
#define __pyx_n_u_CK_VERSION_to_tuple __pyx_string_tab[115]
#define __pyx_n_u_CLASS __pyx_string_tab[116]
#define __pyx_n_u_CLASS_MAP __pyx_string_tab[117]
#define __pyx_n_u_CTRParams __pyx_string_tab[118]
#define __pyx_n_u_CancelStrategy __pyx_string_tab[119]
#define __pyx_n_u_Certificate __pyx_string_tab[120]
#define __pyx_n_u_DECRYPT __pyx_string_tab[121]
#define __pyx_n_u_DEFAULT __pyx_string_tab[122]
#define __pyx_n_u_DEFAULT_DERIVE_MECHANISMS __pyx_string_tab[123]
#define __pyx_n_u_DEFAULT_ENCRYPT_MECHANISMS __pyx_string_tab[124]
#define __pyx_n_u_DEFAULT_GENERATE_MECHANISMS __pyx_string_tab[125]
#define __pyx_n_u_DEFAULT_KEY_CAPABILITIES __pyx_string_tab[126]
#define __pyx_n_u_DEFAULT_MECHANISM_PARAMS __pyx_string_tab[127]
#define __pyx_n_u_DEFAULT_PARAM_GENERATE_MECHANISM __pyx_string_tab[128]
#define __pyx_n_u_DEFAULT_SIGN_MECHANISMS __pyx_string_tab[129]
#define __pyx_n_u_DEFAULT_WRAP_MECHANISMS __pyx_string_tab[130]
#define __pyx_n_u_DERIVE __pyx_string_tab[131]
#define __pyx_n_u_DES2 __pyx_string_tab[132]
#define __pyx_n_u_DES3 __pyx_string_tab[133]
#define __pyx_n_u_DOMAIN_PARAMETERS __pyx_string_tab[134]
#define __pyx_n_u_DataCryptOperation __pyx_string_tab[135]
#define __pyx_n_u_DataCryptOperation___reduce_cyth __pyx_string_tab[136]
#define __pyx_n_u_DataCryptOperation___setstate_cy __pyx_string_tab[137]
#define __pyx_n_u_DataCryptOperation_unclean_shutd __pyx_string_tab[138]
#define __pyx_n_u_DataCryptOperation_update_chunks __pyx_string_tab[139]
#define __pyx_n_u_DataInvalid __pyx_string_tab[140]
#define __pyx_n_u_DataLenRange __pyx_string_tab[141]
#define __pyx_n_u_DataSignOperation __pyx_string_tab[142]
#define __pyx_n_u_DataSignOperation___reduce_cytho __pyx_string_tab[143]
#define __pyx_n_u_DataSignOperation___setstate_cyt __pyx_string_tab[144]
#define __pyx_n_u_DataSignOperation_unclean_shutdo __pyx_string_tab[145]
#define __pyx_n_u_DataVerifyOperation __pyx_string_tab[146]
#define __pyx_n_u_DataVerifyOperation___reduce_cyt __pyx_string_tab[147]
#define __pyx_n_u_DataVerifyOperation___setstate_c __pyx_string_tab[148]
#define __pyx_n_u_DataVerifyOperation_unclean_shut __pyx_string_tab[149]
#define __pyx_n_u_DecryptMixin __pyx_string_tab[150]
#define __pyx_n_u_DecryptMixin___decrypt_operation __pyx_string_tab[151]
#define __pyx_n_u_DecryptMixin__decrypt __pyx_string_tab[152]
#define __pyx_n_u_DecryptMixin__decrypt_generator __pyx_string_tab[153]
#define __pyx_n_u_DecryptMixin__decrypt_operation __pyx_string_tab[154]
#define __pyx_n_u_DeriveMixin __pyx_string_tab[155]
#define __pyx_n_u_DeriveMixin_derive_key __pyx_string_tab[156]
#define __pyx_n_u_DeviceError __pyx_string_tab[157]
#define __pyx_n_u_DeviceMemory __pyx_string_tab[158]
#define __pyx_n_u_DeviceRemoved __pyx_string_tab[159]
#define __pyx_n_u_DigestOperation __pyx_string_tab[160]
#define __pyx_n_u_DigestOperation___reduce_cython __pyx_string_tab[161]
#define __pyx_n_u_DigestOperation___setstate_cytho __pyx_string_tab[162]
#define __pyx_n_u_DigestOperation__finalize __pyx_string_tab[163]
#define __pyx_n_u_DigestOperation__initiate __pyx_string_tab[164]
#define __pyx_n_u_DigestOperation_ingest_chunks __pyx_string_tab[165]
#define __pyx_n_u_DomainParameters __pyx_string_tab[166]
#define __pyx_n_u_DomainParamsInvalid __pyx_string_tab[167]
#define __pyx_n_u_ECDH1_COFACTOR_DERIVE __pyx_string_tab[168]
#define __pyx_n_u_ECDH1_DERIVE __pyx_string_tab[169]
#define __pyx_n_u_EC_PARAMS __pyx_string_tab[170]
#define __pyx_n_u_EDDSA __pyx_string_tab[171]
#define __pyx_n_u_ENCRYPT __pyx_string_tab[172]
#define __pyx_n_u_Ellipsis __pyx_string_tab[173]
#define __pyx_n_u_EncryptMixin __pyx_string_tab[174]
#define __pyx_n_u_EncryptMixin___encrypt_operation __pyx_string_tab[175]
#define __pyx_n_u_EncryptMixin__encrypt __pyx_string_tab[176]
#define __pyx_n_u_EncryptMixin__encrypt_generator __pyx_string_tab[177]
#define __pyx_n_u_EncryptMixin__encrypt_operation __pyx_string_tab[178]
#define __pyx_n_u_EncryptedDataInvalid __pyx_string_tab[179]
#define __pyx_n_u_EncryptedDataLenRange __pyx_string_tab[180]
#define __pyx_n_u_ExceededMaxIterations __pyx_string_tab[181]
#define __pyx_n_u_FunctionCancelled __pyx_string_tab[182]
#define __pyx_n_u_FunctionFailed __pyx_string_tab[183]
#define __pyx_n_u_FunctionNotSupported __pyx_string_tab[184]
#define __pyx_n_u_FunctionRejected __pyx_string_tab[185]
#define __pyx_n_u_GCMParams __pyx_string_tab[186]
#define __pyx_n_u_GOST28147 __pyx_string_tab[187]
#define __pyx_n_u_GeneralError __pyx_string_tab[188]
#define __pyx_n_u_GenerateWithParametersMixin __pyx_string_tab[189]
#define __pyx_n_u_GenerateWithParametersMixin_gene __pyx_string_tab[190]
#define __pyx_n_u_HasFuncList __pyx_string_tab[191]
#define __pyx_n_u_HasFuncList___reduce_cython __pyx_string_tab[192]
#define __pyx_n_u_HasFuncList___setstate_cython __pyx_string_tab[193]
#define __pyx_n_u_HostMemory __pyx_string_tab[194]
#define __pyx_n_u_KEY_TYPE __pyx_string_tab[195]
#define __pyx_n_u_Key __pyx_string_tab[196]
#define __pyx_n_u_KeyHandleInvalid __pyx_string_tab[197]
#define __pyx_n_u_KeyIndigestible __pyx_string_tab[198]
#define __pyx_n_u_KeyNeeded __pyx_string_tab[199]
#define __pyx_n_u_KeyNotNeeded __pyx_string_tab[200]
#define __pyx_n_u_KeyNotWrappable __pyx_string_tab[201]
#define __pyx_n_u_KeyOperation __pyx_string_tab[202]
#define __pyx_n_u_KeyOperation___reduce_cython __pyx_string_tab[203]
#define __pyx_n_u_KeyOperation___setstate_cython __pyx_string_tab[204]
#define __pyx_n_u_KeyOperation__cancel_operation __pyx_string_tab[205]
#define __pyx_n_u_KeyOperation__finalize __pyx_string_tab[206]
#define __pyx_n_u_KeyOperation__initiate __pyx_string_tab[207]
#define __pyx_n_u_KeyOperation_unclean_shutdown __pyx_string_tab[208]
#define __pyx_n_u_KeySizeRange __pyx_string_tab[209]
#define __pyx_n_u_KeyType __pyx_string_tab[210]
#define __pyx_n_u_KeyTypeInconsistent __pyx_string_tab[211]
#define __pyx_n_u_KeyUnextractable __pyx_string_tab[212]
#define __pyx_n_u_L __pyx_string_tab[213]
#define __pyx_n_u_LocalDomainParameters __pyx_string_tab[214]
#define __pyx_n_u_ML_DSA __pyx_string_tab[215]
#define __pyx_n_u_MODULUS_BITS __pyx_string_tab[216]
#define __pyx_n_u_Mechanism __pyx_string_tab[217]
#define __pyx_n_u_MechanismInfo __pyx_string_tab[218]
#define __pyx_n_u_MechanismInvalid __pyx_string_tab[219]
#define __pyx_n_u_MechanismParamInvalid __pyx_string_tab[220]
#define __pyx_n_u_MechanismWithParam __pyx_string_tab[221]
#define __pyx_n_u_MechanismWithParam___reduce_cyth __pyx_string_tab[222]
#define __pyx_n_u_MechanismWithParam___setstate_cy __pyx_string_tab[223]
#define __pyx_n_u_MultipleTokensReturned __pyx_string_tab[224]
#define __pyx_n_u_NoEvent __pyx_string_tab[225]
#define __pyx_n_u_NoSuchToken __pyx_string_tab[226]
#define __pyx_n_u_Object __pyx_string_tab[227]
#define __pyx_n_u_ObjectClass __pyx_string_tab[228]
#define __pyx_n_u_ObjectHandleInvalid __pyx_string_tab[229]
#define __pyx_n_u_ObjectHandleWrapper __pyx_string_tab[230]
#define __pyx_n_u_ObjectHandleWrapper___reduce_cyt __pyx_string_tab[231]
#define __pyx_n_u_ObjectHandleWrapper___setstate_c __pyx_string_tab[232]
#define __pyx_n_u_ObjectHandleWrapper_copy __pyx_string_tab[233]
#define __pyx_n_u_ObjectHandleWrapper_destroy __pyx_string_tab[234]
#define __pyx_n_u_ObjectHandleWrapper_identity __pyx_string_tab[235]
#define __pyx_n_u_Object___getitem __pyx_string_tab[236]
#define __pyx_n_u_Object___init __pyx_string_tab[237]
#define __pyx_n_u_Object___setitem __pyx_string_tab[238]
#define __pyx_n_u_Object__identity __pyx_string_tab[239]
#define __pyx_n_u_Object_copy __pyx_string_tab[240]
#define __pyx_n_u_Object_destroy __pyx_string_tab[241]
#define __pyx_n_u_Object_get_attributes __pyx_string_tab[242]
#define __pyx_n_u_Object_handle __pyx_string_tab[243]
#define __pyx_n_u_Object_session __pyx_string_tab[244]
#define __pyx_n_u_OperationActive __pyx_string_tab[245]
#define __pyx_n_u_OperationContext __pyx_string_tab[246]
#define __pyx_n_u_OperationContext___enter __pyx_string_tab[247]
#define __pyx_n_u_OperationContext___exit __pyx_string_tab[248]
#define __pyx_n_u_OperationContext___reduce_cython __pyx_string_tab[249]
#define __pyx_n_u_OperationContext___setstate_cyth __pyx_string_tab[250]
#define __pyx_n_u_OperationContext__finalize __pyx_string_tab[251]
#define __pyx_n_u_OperationContext__initiate __pyx_string_tab[252]
#define __pyx_n_u_OperationNotInitialized __pyx_string_tab[253]
#define __pyx_n_u_OperationWithBinaryOutput __pyx_string_tab[254]
#define __pyx_n_u_OperationWithBinaryOutput___redu __pyx_string_tab[255]
#define __pyx_n_u_OperationWithBinaryOutput___sets __pyx_string_tab[256]
#define __pyx_n_u_PARAMETER_SET __pyx_string_tab[257]
#define __pyx_n_u_PKCS11Error __pyx_string_tab[258]
#define __pyx_n_u_PRIME __pyx_string_tab[259]
#define __pyx_n_u_PRIME_BITS __pyx_string_tab[260]
#define __pyx_n_u_PRIVATE_KEY __pyx_string_tab[261]
#define __pyx_n_u_PROTECTED_AUTH __pyx_string_tab[262]
#define __pyx_n_u_PROTECTED_AUTHENTICATION_PATH __pyx_string_tab[263]
#define __pyx_n_u_PUBLIC_EXPONENT __pyx_string_tab[264]
#define __pyx_n_u_PUBLIC_KEY __pyx_string_tab[265]
#define __pyx_n_u_PinExpired __pyx_string_tab[266]
#define __pyx_n_u_PinIncorrect __pyx_string_tab[267]
#define __pyx_n_u_PinInvalid __pyx_string_tab[268]
#define __pyx_n_u_PinLenRange __pyx_string_tab[269]
#define __pyx_n_u_PinLocked __pyx_string_tab[270]
#define __pyx_n_u_PinTooWeak __pyx_string_tab[271]
#define __pyx_n_u_PrivateKey __pyx_string_tab[272]
#define __pyx_n_u_PublicKey __pyx_string_tab[273]
#define __pyx_n_u_PublicKeyInvalid __pyx_string_tab[274]
#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[275]
#define __pyx_n_u_RLock __pyx_string_tab[276]
#define __pyx_n_u_RSA __pyx_string_tab[277]
#define __pyx_n_u_RSA_PKCS_OAEP __pyx_string_tab[278]
#define __pyx_n_u_RSA_PKCS_PSS __pyx_string_tab[279]
#define __pyx_n_u_RandomNoRNG __pyx_string_tab[280]
#define __pyx_n_u_RandomSeedNotSupported __pyx_string_tab[281]
#define __pyx_n_u_SECRET_KEY __pyx_string_tab[282]
#define __pyx_n_u_SEED __pyx_string_tab[283]
#define __pyx_n_u_SHA1_RSA_PKCS_PSS __pyx_string_tab[284]
#define __pyx_n_u_SHA224_RSA_PKCS_PSS __pyx_string_tab[285]
#define __pyx_n_u_SHA256_RSA_PKCS_PSS __pyx_string_tab[286]
#define __pyx_n_u_SHA384_RSA_PKCS_PSS __pyx_string_tab[287]
#define __pyx_n_u_SHA512_RSA_PKCS_PSS __pyx_string_tab[288]
#define __pyx_n_u_SIGN __pyx_string_tab[289]
#define __pyx_n_u_SUBPRIME __pyx_string_tab[290]
#define __pyx_n_u_SearchIter __pyx_string_tab[291]
#define __pyx_n_u_SearchIter___reduce_cython __pyx_string_tab[292]
#define __pyx_n_u_SearchIter___setstate_cython __pyx_string_tab[293]
#define __pyx_n_u_SearchIter__batch_iter __pyx_string_tab[294]
#define __pyx_n_u_SearchIter__finalize __pyx_string_tab[295]
#define __pyx_n_u_SearchIter__initiate __pyx_string_tab[296]
#define __pyx_n_u_SecretKey __pyx_string_tab[297]
#define __pyx_n_u_Sequence __pyx_string_tab[298]
#define __pyx_n_u_Session __pyx_string_tab[299]
#define __pyx_n_u_SessionClosed __pyx_string_tab[300]
#define __pyx_n_u_SessionCount __pyx_string_tab[301]
#define __pyx_n_u_SessionExists __pyx_string_tab[302]
#define __pyx_n_u_SessionHandleInvalid __pyx_string_tab[303]
#define __pyx_n_u_SessionReadOnly __pyx_string_tab[304]
#define __pyx_n_u_SessionReadOnlyExists __pyx_string_tab[305]
#define __pyx_n_u_SessionReadWriteSOExists __pyx_string_tab[306]
#define __pyx_n_u_Session___digest_operation __pyx_string_tab[307]
#define __pyx_n_u_Session___reduce_cython __pyx_string_tab[308]
#define __pyx_n_u_Session___setstate_cython __pyx_string_tab[309]
#define __pyx_n_u_Session__digest __pyx_string_tab[310]
#define __pyx_n_u_Session__digest_generator __pyx_string_tab[311]
#define __pyx_n_u_Session__digest_operation __pyx_string_tab[312]
#define __pyx_n_u_Session__generate_keypair __pyx_string_tab[313]
#define __pyx_n_u_Session__identity __pyx_string_tab[314]
#define __pyx_n_u_Session_close __pyx_string_tab[315]
#define __pyx_n_u_Session_create_domain_parameters __pyx_string_tab[316]
#define __pyx_n_u_Session_create_object __pyx_string_tab[317]
#define __pyx_n_u_Session_generate_domain_paramete __pyx_string_tab[318]
#define __pyx_n_u_Session_generate_key __pyx_string_tab[319]
#define __pyx_n_u_Session_generate_random __pyx_string_tab[320]
#define __pyx_n_u_Session_get_objects __pyx_string_tab[321]
#define __pyx_n_u_Session_init_pin __pyx_string_tab[322]
#define __pyx_n_u_Session_reaffirm_credentials __pyx_string_tab[323]
#define __pyx_n_u_Session_seed_random __pyx_string_tab[324]
#define __pyx_n_u_Session_set_pin __pyx_string_tab[325]
#define __pyx_n_u_SignMixin __pyx_string_tab[326]
#define __pyx_n_u_SignMixin___sign_operation __pyx_string_tab[327]
#define __pyx_n_u_SignMixin__sign __pyx_string_tab[328]
#define __pyx_n_u_SignMixin__sign_generator __pyx_string_tab[329]
#define __pyx_n_u_SignMixin__sign_operation __pyx_string_tab[330]
#define __pyx_n_u_SignOrVerifyOperation __pyx_string_tab[331]
#define __pyx_n_u_SignOrVerifyOperation___reduce_c __pyx_string_tab[332]
#define __pyx_n_u_SignOrVerifyOperation___setstate __pyx_string_tab[333]
#define __pyx_n_u_SignOrVerifyOperation_ingest_chu __pyx_string_tab[334]
#define __pyx_n_u_SignatureInvalid __pyx_string_tab[335]
#define __pyx_n_u_SignatureLenRange __pyx_string_tab[336]
#define __pyx_n_u_Slot __pyx_string_tab[337]
#define __pyx_n_u_SlotFlag __pyx_string_tab[338]
#define __pyx_n_u_SlotIDInvalid __pyx_string_tab[339]
#define __pyx_n_u_Slot___reduce_cython __pyx_string_tab[340]
#define __pyx_n_u_Slot___setstate_cython __pyx_string_tab[341]
#define __pyx_n_u_Slot__identity __pyx_string_tab[342]
#define __pyx_n_u_Slot_get_mechanism_info __pyx_string_tab[343]
#define __pyx_n_u_Slot_get_mechanisms __pyx_string_tab[344]
#define __pyx_n_u_Slot_get_token __pyx_string_tab[345]
#define __pyx_n_u_StoredDomainParameters __pyx_string_tab[346]
#define __pyx_n_u_TOKEN __pyx_string_tab[347]
#define __pyx_n_u_TemplateIncomplete __pyx_string_tab[348]
#define __pyx_n_u_TemplateInconsistent __pyx_string_tab[349]
#define __pyx_n_u_Token __pyx_string_tab[350]
#define __pyx_n_u_TokenFlag __pyx_string_tab[351]
#define __pyx_n_u_TokenNotPresent __pyx_string_tab[352]
#define __pyx_n_u_TokenNotRecognised __pyx_string_tab[353]
#define __pyx_n_u_TokenWriteProtected __pyx_string_tab[354]
#define __pyx_n_u_Token___reduce_cython __pyx_string_tab[355]
#define __pyx_n_u_Token___setstate_cython __pyx_string_tab[356]
#define __pyx_n_u_Token__identity __pyx_string_tab[357]
#define __pyx_n_u_Token_open __pyx_string_tab[358]
#define __pyx_n_u_UNWRAP __pyx_string_tab[359]
#define __pyx_n_u_UnwrapMixin __pyx_string_tab[360]
#define __pyx_n_u_UnwrapMixin_unwrap_key __pyx_string_tab[361]
#define __pyx_n_u_UnwrappingKeyHandleInvalid __pyx_string_tab[362]
#define __pyx_n_u_UnwrappingKeySizeRange __pyx_string_tab[363]
#define __pyx_n_u_UnwrappingKeyTypeInconsistent __pyx_string_tab[364]
#define __pyx_n_u_UserAlreadyLoggedIn __pyx_string_tab[365]
#define __pyx_n_u_UserNotLoggedIn __pyx_string_tab[366]
#define __pyx_n_u_UserPinNotInitialized __pyx_string_tab[367]
#define __pyx_n_u_UserTooManyTypes __pyx_string_tab[368]
#define __pyx_n_u_UserType __pyx_string_tab[369]
#define __pyx_n_u_VALUE_LEN __pyx_string_tab[370]
#define __pyx_n_u_VERIFY __pyx_string_tab[371]
#define __pyx_n_u_VerifyMixin __pyx_string_tab[372]
#define __pyx_n_u_VerifyMixin___verify_operation __pyx_string_tab[373]
#define __pyx_n_u_VerifyMixin__verify __pyx_string_tab[374]
#define __pyx_n_u_VerifyMixin__verify_generator __pyx_string_tab[375]
#define __pyx_n_u_VerifyMixin__verify_operation __pyx_string_tab[376]
#define __pyx_n_u_View_MemoryView __pyx_string_tab[377]
#define __pyx_n_u_WRAP __pyx_string_tab[378]
#define __pyx_n_u_WrapMixin __pyx_string_tab[379]
#define __pyx_n_u_WrapMixin_wrap_key __pyx_string_tab[380]
#define __pyx_n_u_WrappedKeyInvalid __pyx_string_tab[381]
#define __pyx_n_u_WrappedKeyLenRange __pyx_string_tab[382]
#define __pyx_n_u_WrappingKeyHandleInvalid __pyx_string_tab[383]
#define __pyx_n_u_WrappingKeySizeRange __pyx_string_tab[384]
#define __pyx_n_u_WrappingKeyTypeInconsistent __pyx_string_tab[385]
#define __pyx_n_u__11 __pyx_string_tab[386]
#define __pyx_n_u_aad __pyx_string_tab[387]
#define __pyx_n_u_abc __pyx_string_tab[388]
#define __pyx_n_u_acquire __pyx_string_tab[389]
#define __pyx_n_u_allocate_buffer __pyx_string_tab[390]
#define __pyx_n_u_annotate __pyx_string_tab[391]
#define __pyx_n_u_as_dict __pyx_string_tab[392]
#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[393]
#define __pyx_n_u_attr __pyx_string_tab[394]
#define __pyx_n_u_attr_count __pyx_string_tab[395]
#define __pyx_n_u_attr_data __pyx_string_tab[396]
#define __pyx_n_u_attribute_mapper __pyx_string_tab[397]
#define __pyx_n_u_attrs __pyx_string_tab[398]
#define __pyx_n_u_base __pyx_string_tab[399]
#define __pyx_n_u_batch __pyx_string_tab[400]
#define __pyx_n_u_batch_iter __pyx_string_tab[401]
#define __pyx_n_u_batch_size __pyx_string_tab[402]
#define __pyx_n_u_blocking __pyx_string_tab[403]
#define __pyx_n_u_buffer_size __pyx_string_tab[404]
#define __pyx_n_u_c __pyx_string_tab[405]
#define __pyx_n_u_c_user_type __pyx_string_tab[406]
#define __pyx_n_u_cancel_operation __pyx_string_tab[407]
#define __pyx_n_u_cancel_strategy __pyx_string_tab[408]
#define __pyx_n_u_capabilities __pyx_string_tab[409]
#define __pyx_n_u_chunk __pyx_string_tab[410]
#define __pyx_n_u_chunks __pyx_string_tab[411]
#define __pyx_n_u_class __pyx_string_tab[412]
#define __pyx_n_u_class_getitem __pyx_string_tab[413]
#define __pyx_n_u_cline_in_traceback __pyx_string_tab[414]
#define __pyx_n_u_close __pyx_string_tab[415]
#define __pyx_n_u_copy __pyx_string_tab[416]
#define __pyx_n_u_count __pyx_string_tab[417]
#define __pyx_n_u_create_domain_parameters __pyx_string_tab[418]
#define __pyx_n_u_create_object __pyx_string_tab[419]
#define __pyx_n_u_cryptoki_version __pyx_string_tab[420]
#define __pyx_n_u_data __pyx_string_tab[421]
#define __pyx_n_u_data_len __pyx_string_tab[422]
#define __pyx_n_u_data_ptr __pyx_string_tab[423]
#define __pyx_n_u_decrypt __pyx_string_tab[424]
#define __pyx_n_u_decrypt_generator __pyx_string_tab[425]
#define __pyx_n_u_decrypt_operation __pyx_string_tab[426]
#define __pyx_n_u_default_template __pyx_string_tab[427]
#define __pyx_n_u_derive_key __pyx_string_tab[428]
#define __pyx_n_u_destroy __pyx_string_tab[429]
#define __pyx_n_u_dict __pyx_string_tab[430]
#define __pyx_n_u_digest __pyx_string_tab[431]
#define __pyx_n_u_digest_generator __pyx_string_tab[432]
#define __pyx_n_u_digest_operation __pyx_string_tab[433]
#define __pyx_n_u_doc __pyx_string_tab[434]
#define __pyx_n_u_dtype_is_object __pyx_string_tab[435]
#define __pyx_n_u_dummy __pyx_string_tab[436]
#define __pyx_n_u_encode __pyx_string_tab[437]
#define __pyx_n_u_encrypt __pyx_string_tab[438]
#define __pyx_n_u_encrypt_generator __pyx_string_tab[439]
#define __pyx_n_u_encrypt_operation __pyx_string_tab[440]
#define __pyx_n_u_enter __pyx_string_tab[441]
#define __pyx_n_u_enumerate __pyx_string_tab[442]
#define __pyx_n_u_error __pyx_string_tab[443]
#define __pyx_n_u_exc_tb __pyx_string_tab[444]
#define __pyx_n_u_exc_type __pyx_string_tab[445]
#define __pyx_n_u_exc_val __pyx_string_tab[446]
#define __pyx_n_u_exit __pyx_string_tab[447]
#define __pyx_n_u_final_user_type __pyx_string_tab[448]
#define __pyx_n_u_finalize __pyx_string_tab[449]
#define __pyx_n_u_finalize_2 __pyx_string_tab[450]
#define __pyx_n_u_firmware_version __pyx_string_tab[451]
#define __pyx_n_u_flag __pyx_string_tab[452]
#define __pyx_n_u_flags __pyx_string_tab[453]
#define __pyx_n_u_format __pyx_string_tab[454]
#define __pyx_n_u_fortran __pyx_string_tab[455]
#define __pyx_n_u_func __pyx_string_tab[456]
#define __pyx_n_u_generate_domain_parameters __pyx_string_tab[457]
#define __pyx_n_u_generate_key __pyx_string_tab[458]
#define __pyx_n_u_generate_keypair __pyx_string_tab[459]
#define __pyx_n_u_generate_keypair_2 __pyx_string_tab[460]
#define __pyx_n_u_generate_random __pyx_string_tab[461]
#define __pyx_n_u_generic_key_template __pyx_string_tab[462]
#define __pyx_n_u_get __pyx_string_tab[463]
#define __pyx_n_u_get_attributes __pyx_string_tab[464]
#define __pyx_n_u_get_mechanism_info __pyx_string_tab[465]
#define __pyx_n_u_get_mechanisms __pyx_string_tab[466]
#define __pyx_n_u_get_objects __pyx_string_tab[467]
#define __pyx_n_u_get_slots __pyx_string_tab[468]
#define __pyx_n_u_get_token __pyx_string_tab[469]
#define __pyx_n_u_get_tokens __pyx_string_tab[470]
#define __pyx_n_u_getitem __pyx_string_tab[471]
#define __pyx_n_u_getstate __pyx_string_tab[472]
#define __pyx_n_u_handle __pyx_string_tab[473]
#define __pyx_n_u_hardware_version __pyx_string_tab[474]
#define __pyx_n_u_id __pyx_string_tab[475]
#define __pyx_n_u_id_2 __pyx_string_tab[476]
#define __pyx_n_u_identity __pyx_string_tab[477]
#define __pyx_n_u_identity_2 __pyx_string_tab[478]
#define __pyx_n_u_import __pyx_string_tab[479]
#define __pyx_n_u_index __pyx_string_tab[480]
#define __pyx_n_u_info __pyx_string_tab[481]
#define __pyx_n_u_ingest_chunks __pyx_string_tab[482]
#define __pyx_n_u_init __pyx_string_tab[483]
#define __pyx_n_u_init_pin __pyx_string_tab[484]
#define __pyx_n_u_initialize __pyx_string_tab[485]
#define __pyx_n_u_initiate __pyx_string_tab[486]
#define __pyx_n_u_is_coroutine __pyx_string_tab[487]
#define __pyx_n_u_item __pyx_string_tab[488]
#define __pyx_n_u_items __pyx_string_tab[489]
#define __pyx_n_u_itemsize __pyx_string_tab[490]
#define __pyx_n_u_iterator __pyx_string_tab[491]
#define __pyx_n_u_ix __pyx_string_tab[492]
#define __pyx_n_u_key __pyx_string_tab[493]
#define __pyx_n_u_key_data __pyx_string_tab[494]
#define __pyx_n_u_key_length __pyx_string_tab[495]
#define __pyx_n_u_key_ptr __pyx_string_tab[496]
#define __pyx_n_u_key_to_wrap __pyx_string_tab[497]
#define __pyx_n_u_key_type __pyx_string_tab[498]
#define __pyx_n_u_keys __pyx_string_tab[499]
#define __pyx_n_u_klass __pyx_string_tab[500]
#define __pyx_n_u_kwargs __pyx_string_tab[501]
#define __pyx_n_u_label __pyx_string_tab[502]
#define __pyx_n_u_length __pyx_string_tab[503]
#define __pyx_n_u_lib __pyx_string_tab[504]
#define __pyx_n_u_lib___reduce_cython __pyx_string_tab[505]
#define __pyx_n_u_lib___setstate_cython __pyx_string_tab[506]
#define __pyx_n_u_lib_finalize __pyx_string_tab[507]
#define __pyx_n_u_lib_get_slots __pyx_string_tab[508]
#define __pyx_n_u_lib_get_token __pyx_string_tab[509]
#define __pyx_n_u_lib_get_tokens __pyx_string_tab[510]
#define __pyx_n_u_lib_initialize __pyx_string_tab[511]
#define __pyx_n_u_lib_reinitialize __pyx_string_tab[512]
#define __pyx_n_u_lib_unload __pyx_string_tab[513]
#define __pyx_n_u_lib_wait_for_slot_event __pyx_string_tab[514]
#define __pyx_n_u_library_version __pyx_string_tab[515]
#define __pyx_n_u_local __pyx_string_tab[516]
#define __pyx_n_u_main __pyx_string_tab[517]
#define __pyx_n_u_major __pyx_string_tab[518]
#define __pyx_n_u_manufacturerID __pyx_string_tab[519]
#define __pyx_n_u_map __pyx_string_tab[520]
#define __pyx_n_u_mapping __pyx_string_tab[521]
#define __pyx_n_u_mech __pyx_string_tab[522]
#define __pyx_n_u_mech_data __pyx_string_tab[523]
#define __pyx_n_u_mech_type __pyx_string_tab[524]
#define __pyx_n_u_mechanism __pyx_string_tab[525]
#define __pyx_n_u_mechanism_param __pyx_string_tab[526]
#define __pyx_n_u_mechanisms __pyx_string_tab[527]
#define __pyx_n_u_memview __pyx_string_tab[528]
#define __pyx_n_u_merge_templates __pyx_string_tab[529]
#define __pyx_n_u_metaclass __pyx_string_tab[530]
#define __pyx_n_u_minor __pyx_string_tab[531]
#define __pyx_n_u_mode __pyx_string_tab[532]
#define __pyx_n_u_module __pyx_string_tab[533]
#define __pyx_n_u_mro_entries __pyx_string_tab[534]
#define __pyx_n_u_name __pyx_string_tab[535]
#define __pyx_n_u_name_2 __pyx_string_tab[536]
#define __pyx_n_u_nbits __pyx_string_tab[537]
#define __pyx_n_u_ndim __pyx_string_tab[538]
#define __pyx_n_u_new __pyx_string_tab[539]
#define __pyx_n_u_new_2 __pyx_string_tab[540]
#define __pyx_n_u_new_obj __pyx_string_tab[541]
#define __pyx_n_u_new_pin __pyx_string_tab[542]
#define __pyx_n_u_new_pin_data __pyx_string_tab[543]
#define __pyx_n_u_new_pin_length __pyx_string_tab[544]
#define __pyx_n_u_next __pyx_string_tab[545]
#define __pyx_n_u_nonce __pyx_string_tab[546]
#define __pyx_n_u_obj __pyx_string_tab[547]
#define __pyx_n_u_object_class __pyx_string_tab[548]
#define __pyx_n_u_old_pin __pyx_string_tab[549]
#define __pyx_n_u_old_pin_data __pyx_string_tab[550]
#define __pyx_n_u_old_pin_length __pyx_string_tab[551]
#define __pyx_n_u_op __pyx_string_tab[552]
#define __pyx_n_u_open __pyx_string_tab[553]
#define __pyx_n_u_pack __pyx_string_tab[554]
#define __pyx_n_u_pack_attribute __pyx_string_tab[555]
#define __pyx_n_u_param __pyx_string_tab[556]
#define __pyx_n_u_param_length __pyx_string_tab[557]
#define __pyx_n_u_pin __pyx_string_tab[558]
#define __pyx_n_u_pin_data __pyx_string_tab[559]
#define __pyx_n_u_pin_length __pyx_string_tab[560]
#define __pyx_n_u_pin_new __pyx_string_tab[561]
#define __pyx_n_u_pin_old __pyx_string_tab[562]
#define __pyx_n_u_pkcs11 __pyx_string_tab[563]
#define __pyx_n_u_pkcs11__pkcs11 __pyx_string_tab[564]
#define __pyx_n_u_pkcs11_attributes __pyx_string_tab[565]
#define __pyx_n_u_pkcs11_constants __pyx_string_tab[566]
#define __pyx_n_u_pkcs11_defaults __pyx_string_tab[567]
#define __pyx_n_u_pkcs11_exceptions __pyx_string_tab[568]
#define __pyx_n_u_pkcs11_mechanisms __pyx_string_tab[569]
#define __pyx_n_u_pkcs11_types __pyx_string_tab[570]
#define __pyx_n_u_pop __pyx_string_tab[571]
#define __pyx_n_u_prepare __pyx_string_tab[572]
#define __pyx_n_u_present __pyx_string_tab[573]
#define __pyx_n_u_private_attrs __pyx_string_tab[574]
#define __pyx_n_u_private_key_template __pyx_string_tab[575]
#define __pyx_n_u_private_template __pyx_string_tab[576]
#define __pyx_n_u_private_template_2 __pyx_string_tab[577]
#define __pyx_n_u_property __pyx_string_tab[578]
#define __pyx_n_u_public_attrs __pyx_string_tab[579]
#define __pyx_n_u_public_key_template __pyx_string_tab[580]
#define __pyx_n_u_public_template __pyx_string_tab[581]
#define __pyx_n_u_public_template_2 __pyx_string_tab[582]
#define __pyx_n_u_pyx_checksum __pyx_string_tab[583]
#define __pyx_n_u_pyx_state __pyx_string_tab[584]
#define __pyx_n_u_pyx_type __pyx_string_tab[585]
#define __pyx_n_u_pyx_unpickle_Enum __pyx_string_tab[586]
#define __pyx_n_u_pyx_vtable __pyx_string_tab[587]
#define __pyx_n_u_qualname __pyx_string_tab[588]
#define __pyx_n_u_random __pyx_string_tab[589]
#define __pyx_n_u_reaffirm_credentials __pyx_string_tab[590]
#define __pyx_n_u_reduce __pyx_string_tab[591]
#define __pyx_n_u_reduce_cython __pyx_string_tab[592]
#define __pyx_n_u_reduce_ex __pyx_string_tab[593]
#define __pyx_n_u_register __pyx_string_tab[594]
#define __pyx_n_u_reinitialize __pyx_string_tab[595]
#define __pyx_n_u_release __pyx_string_tab[596]
#define __pyx_n_u_result __pyx_string_tab[597]
#define __pyx_n_u_results __pyx_string_tab[598]
#define __pyx_n_u_retval __pyx_string_tab[599]
#define __pyx_n_u_rstrip __pyx_string_tab[600]
#define __pyx_n_u_rw __pyx_string_tab[601]
#define __pyx_n_u_secret_key_template __pyx_string_tab[602]
#define __pyx_n_u_seed __pyx_string_tab[603]
#define __pyx_n_u_seed_data __pyx_string_tab[604]
#define __pyx_n_u_seed_len __pyx_string_tab[605]
#define __pyx_n_u_seed_random __pyx_string_tab[606]
#define __pyx_n_u_self __pyx_string_tab[607]
#define __pyx_n_u_send __pyx_string_tab[608]
#define __pyx_n_u_serial __pyx_string_tab[609]
#define __pyx_n_u_session __pyx_string_tab[610]
#define __pyx_n_u_set_name __pyx_string_tab[611]
#define __pyx_n_u_set_pin __pyx_string_tab[612]
#define __pyx_n_u_setdefault __pyx_string_tab[613]
#define __pyx_n_u_setitem __pyx_string_tab[614]
#define __pyx_n_u_setstate __pyx_string_tab[615]
#define __pyx_n_u_setstate_cython __pyx_string_tab[616]
#define __pyx_n_u_shape __pyx_string_tab[617]
#define __pyx_n_u_sig_len __pyx_string_tab[618]
#define __pyx_n_u_sig_ptr __pyx_string_tab[619]
#define __pyx_n_u_sign __pyx_string_tab[620]
#define __pyx_n_u_sign_generator __pyx_string_tab[621]
#define __pyx_n_u_sign_operation __pyx_string_tab[622]
#define __pyx_n_u_signature __pyx_string_tab[623]
#define __pyx_n_u_silent __pyx_string_tab[624]
#define __pyx_n_u_size __pyx_string_tab[625]
#define __pyx_n_u_slot __pyx_string_tab[626]
#define __pyx_n_u_slotDescription __pyx_string_tab[627]
#define __pyx_n_u_slot_flags __pyx_string_tab[628]
#define __pyx_n_u_slot_id __pyx_string_tab[629]
#define __pyx_n_u_slot_list __pyx_string_tab[630]
#define __pyx_n_u_slots __pyx_string_tab[631]
#define __pyx_n_u_so __pyx_string_tab[632]
#define __pyx_n_u_so_pin __pyx_string_tab[633]
#define __pyx_n_u_src_key __pyx_string_tab[634]
#define __pyx_n_u_start __pyx_string_tab[635]
#define __pyx_n_u_step __pyx_string_tab[636]
#define __pyx_n_u_stop __pyx_string_tab[637]
#define __pyx_n_u_store __pyx_string_tab[638]
#define __pyx_n_u_struct __pyx_string_tab[639]
#define __pyx_n_u_super __pyx_string_tab[640]
#define __pyx_n_u_tag_bits __pyx_string_tab[641]
#define __pyx_n_u_template __pyx_string_tab[642]
#define __pyx_n_u_template_2 __pyx_string_tab[643]
#define __pyx_n_u_test __pyx_string_tab[644]
#define __pyx_n_u_threading __pyx_string_tab[645]
#define __pyx_n_u_throw __pyx_string_tab[646]
#define __pyx_n_u_token __pyx_string_tab[647]
#define __pyx_n_u_token_flags __pyx_string_tab[648]
#define __pyx_n_u_token_label __pyx_string_tab[649]
#define __pyx_n_u_token_mechanisms __pyx_string_tab[650]
#define __pyx_n_u_token_present __pyx_string_tab[651]
#define __pyx_n_u_token_serial __pyx_string_tab[652]
#define __pyx_n_u_total __pyx_string_tab[653]
#define __pyx_n_u_types __pyx_string_tab[654]
#define __pyx_n_u_ulMaxKeySize __pyx_string_tab[655]
#define __pyx_n_u_ulMinKeySize __pyx_string_tab[656]
#define __pyx_n_u_unclean_shutdown __pyx_string_tab[657]
#define __pyx_n_u_unload __pyx_string_tab[658]
#define __pyx_n_u_unpack __pyx_string_tab[659]
#define __pyx_n_u_unpack_attributes __pyx_string_tab[660]
#define __pyx_n_u_unwrap_key __pyx_string_tab[661]
#define __pyx_n_u_unwrapping_key __pyx_string_tab[662]
#define __pyx_n_u_update __pyx_string_tab[663]
#define __pyx_n_u_update_chunks __pyx_string_tab[664]
#define __pyx_n_u_user_pin __pyx_string_tab[665]
#define __pyx_n_u_user_template __pyx_string_tab[666]
#define __pyx_n_u_user_templates __pyx_string_tab[667]
#define __pyx_n_u_user_type __pyx_string_tab[668]
#define __pyx_n_u_value __pyx_string_tab[669]
#define __pyx_n_u_values __pyx_string_tab[670]
#define __pyx_n_u_verify __pyx_string_tab[671]
#define __pyx_n_u_verify_generator __pyx_string_tab[672]
#define __pyx_n_u_verify_operation __pyx_string_tab[673]
#define __pyx_n_u_wait_for_slot_event __pyx_string_tab[674]
#define __pyx_n_u_wrap_key __pyx_string_tab[675]
#define __pyx_n_u_wrapped_key_len __pyx_string_tab[676]
#define __pyx_n_u_wrapped_key_ptr __pyx_string_tab[677]
#define __pyx_n_u_wrapper __pyx_string_tab[678]
#define __pyx_n_u_wrapping_key __pyx_string_tab[679]
#define __pyx_n_u_x __pyx_string_tab[680]
#define __pyx_kp_b__10 __pyx_string_tab[681]
#define __pyx_kp_b__6 __pyx_string_tab[682]
#define __pyx_kp_b__7 __pyx_string_tab[683]
#define __pyx_kp_b_iso88591_00Fa_9_Q_nAQ_2WA __pyx_string_tab[684]
#define __pyx_kp_b_iso88591_0_A_q_5Q_4z_A_aq_gU_d_A_aq_1_7q __pyx_string_tab[685]
#define __pyx_kp_b_iso88591_1 __pyx_string_tab[686]
#define __pyx_kp_b_iso88591_1_Q_4q_A_T_5QfAYa_T_1_b_uA__BgU __pyx_string_tab[687]
#define __pyx_kp_b_iso88591_5Q_4A_A_4z_A_aq_gU_d_A_aq_1_7q __pyx_string_tab[688]
#define __pyx_kp_b_iso88591_A __pyx_string_tab[689]
#define __pyx_kp_b_iso88591_A_1 __pyx_string_tab[690]
#define __pyx_kp_b_iso88591_A_2 __pyx_string_tab[691]
#define __pyx_kp_b_iso88591_A_3aq_d_Qk_nAQ_2WAYa __pyx_string_tab[692]
#define __pyx_kp_b_iso88591_A_4A_6_Q_aq_AQ_Qiz_A_Qi_A_Qiz_1 __pyx_string_tab[693]
#define __pyx_kp_b_iso88591_A_4Ja_t1_Cq_D_9_EVVW_t7_AQ_2_q __pyx_string_tab[694]
#define __pyx_kp_b_iso88591_A_4_1A_t1_xq_81_T_QRRS_6 __pyx_string_tab[695]
#define __pyx_kp_b_iso88591_A_4_Q_D_Q_5Rq_r_1 __pyx_string_tab[696]
#define __pyx_kp_b_iso88591_A_4q_c_4q_1_A_QfTVVW_1_D_y_1F_a __pyx_string_tab[697]
#define __pyx_kp_b_iso88591_A_4x_31A_HA_D_xq_81_T_q_P_q __pyx_string_tab[698]
#define __pyx_kp_b_iso88591_A_4x_XQd_6_Q_wc_5T_Q_k __pyx_string_tab[699]
#define __pyx_kp_b_iso88591_A_4z_A_1 __pyx_string_tab[700]
#define __pyx_kp_b_iso88591_A_4z_E_T_Q_Ym1A_AQ_q __pyx_string_tab[701]
#define __pyx_kp_b_iso88591_A_4z_uA_aq_k1J_UV_t1_t1_T_Cq_WIZ __pyx_string_tab[702]
#define __pyx_kp_b_iso88591_A_A __pyx_string_tab[703]
#define __pyx_kp_b_iso88591_A_AT __pyx_string_tab[704]
#define __pyx_kp_b_iso88591_A_A_1_4z_A_aq_4z_a_aq_1_7q_l_1_k __pyx_string_tab[705]
#define __pyx_kp_b_iso88591_A_A_1_4z_aq_4z_A_aq_1_7q_l_1_k1J __pyx_string_tab[706]
#define __pyx_kp_b_iso88591_A_A_4_3a_Yiq_AQ_T __pyx_string_tab[707]
#define __pyx_kp_b_iso88591_A_A_Cq_T_q_1 __pyx_string_tab[708]
#define __pyx_kp_b_iso88591_A_A_vS_T_31HAV1D_uAQ __pyx_string_tab[709]
#define __pyx_kp_b_iso88591_A_Cq_3aq_d_Qk_1Jj __pyx_string_tab[710]
#define __pyx_kp_b_iso88591_A_Cq_4_a_2_Q __pyx_string_tab[711]
#define __pyx_kp_b_iso88591_A_HAWA __pyx_string_tab[712]
#define __pyx_kp_b_iso88591_A_HA_D_T_81 __pyx_string_tab[713]
#define __pyx_kp_b_iso88591_A_HA_t9A_4y_T_AX_PQ __pyx_string_tab[714]
#define __pyx_kp_b_iso88591_A_HHA __pyx_string_tab[715]
#define __pyx_kp_b_iso88591_A_HO81_Ja_Ja_q __pyx_string_tab[716]
#define __pyx_kp_b_iso88591_A_IQ_t1_z_a_e1_1A_1_c_N_Q __pyx_string_tab[717]
#define __pyx_kp_b_iso88591_A_IU_4q_1D_Qa_4y_IQgQ_q __pyx_string_tab[718]
#define __pyx_kp_b_iso88591_A_Ja_L_4_Cq_Qd_q __pyx_string_tab[719]
#define __pyx_kp_b_iso88591_A_Jawa __pyx_string_tab[720]
#define __pyx_kp_b_iso88591_A_T_4q __pyx_string_tab[721]
#define __pyx_kp_b_iso88591_A_T_hit5_t1_AQ __pyx_string_tab[722]
#define __pyx_kp_b_iso88591_A_T_q_HITQVVW_AQ __pyx_string_tab[723]
#define __pyx_kp_b_iso88591_A_Zq __pyx_string_tab[724]
#define __pyx_kp_b_iso88591_A_a __pyx_string_tab[725]
#define __pyx_kp_b_iso88591_A_a_1_T_5Qi_1_uN_6_a __pyx_string_tab[726]
#define __pyx_kp_b_iso88591_A_a_2 __pyx_string_tab[727]
#define __pyx_kp_b_iso88591_A_a_Q_IU_4q_t5_vS_t9AWA_haq __pyx_string_tab[728]
#define __pyx_kp_b_iso88591_A_a_T_1A_E __pyx_string_tab[729]
#define __pyx_kp_b_iso88591_A_a_T_5QivQa_6_A_a_0_q_T_5Qiq_4q __pyx_string_tab[730]
#define __pyx_kp_b_iso88591_A_a_q_t1_1_7q_A_l_1_k1NkYZ_7_33G __pyx_string_tab[731]
#define __pyx_kp_b_iso88591_A_c_1_1A_A_T_4y_Q __pyx_string_tab[732]
#define __pyx_kp_b_iso88591_A_e1_a_1_Q_9G5_G7_aq_c_z_Cq_gQ_z __pyx_string_tab[733]
#define __pyx_kp_b_iso88591_A_he1A_4xz __pyx_string_tab[734]
#define __pyx_kp_b_iso88591_A_j_t1_D_9_EVVW_t7_AQ_nAQ_2WA __pyx_string_tab[735]
#define __pyx_kp_b_iso88591_A_k1J_UV_ZvT __pyx_string_tab[736]
#define __pyx_kp_b_iso88591_A_k1J_UV_at_V4y __pyx_string_tab[737]
#define __pyx_kp_b_iso88591_A_k1M_XY_q_JfD_QR __pyx_string_tab[738]
#define __pyx_kp_b_iso88591_A_q_fAV6 __pyx_string_tab[739]
#define __pyx_kp_b_iso88591_A_t1_AWIQ __pyx_string_tab[740]
#define __pyx_kp_b_iso88591_A_t1_IQ_t1_q_Qa_l_A __pyx_string_tab[741]
#define __pyx_kp_b_iso88591_A_t1_Q_9N_7_1G1 __pyx_string_tab[742]
#define __pyx_kp_b_iso88591_A_t1_c_1_S_T_AXZq __pyx_string_tab[743]
#define __pyx_kp_b_iso88591_A_t1_q_q_AQ_AQ_T_1HNBRR_a __pyx_string_tab[744]
#define __pyx_kp_b_iso88591_A_t81 __pyx_string_tab[745]
#define __pyx_kp_b_iso88591_A_t81A __pyx_string_tab[746]
#define __pyx_kp_b_iso88591_A_t_d __pyx_string_tab[747]
#define __pyx_kp_b_iso88591_A_uKt1 __pyx_string_tab[748]
#define __pyx_kp_b_iso88591_A_v_HIQ __pyx_string_tab[749]
#define __pyx_kp_b_iso88591_A_wk_XT __pyx_string_tab[750]
#define __pyx_kp_b_iso88591_C1_Cq_T_QkIZZ_2 __pyx_string_tab[751]
#define __pyx_kp_b_iso88591_C_Q_t1_Cq_T_QkIZZ_t7_AQ_2 __pyx_string_tab[752]
#define __pyx_kp_b_iso88591_Gq_C1_4z_A_aq_4z_aq_a_q_X_XQ_A __pyx_string_tab[753]
#define __pyx_kp_b_iso88591_Kq __pyx_string_tab[754]
#define __pyx_kp_b_iso88591_Q __pyx_string_tab[755]
#define __pyx_kp_b_iso88591_a_T_6_A_1_q_T_9AT_Kq_YnAYaq_AQ __pyx_string_tab[756]
#define __pyx_kp_b_iso88591_q_4q_1_Rz __pyx_string_tab[757]
#define __pyx_kp_b_iso88591_q_4q_xq __pyx_string_tab[758]
#define __pyx_kp_b_iso88591_q_HA_4q_XY_A_t1 __pyx_string_tab[759]
#define __pyx_kp_b_iso88591_q_t1_4q_Rz __pyx_string_tab[760]
#define __pyx_kp_b_iso88591_uA_G1A_1_Q_E_6 __pyx_string_tab[761]
#define __pyx_n_b_O __pyx_string_tab[762]
#define __pyx_int_0 __pyx_number_tab[0]
#define __pyx_int_neg_1 __pyx_number_tab[1]
#define __pyx_int_1 __pyx_number_tab[2]
#define __pyx_int_8 __pyx_number_tab[3]
#define __pyx_int_10 __pyx_number_tab[4]
#define __pyx_int_16 __pyx_number_tab[5]
#define __pyx_int_8192 __pyx_number_tab[6]
#define __pyx_int_136983863 __pyx_number_tab[7]
/* #### Code section: module_state_clear ### */
#if CYTHON_USE_MODULE_STATE
static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) {
  __pyx_mstatetype *clear_module_state = __Pyx_PyModule_GetState(m);
  if (!clear_module_state) return 0;
  Py_CLEAR(clear_module_state->__pyx_d);
  Py_CLEAR(clear_module_state->__pyx_b);
  Py_CLEAR(clear_module_state->__pyx_cython_runtime);
  Py_CLEAR(clear_module_state->__pyx_empty_tuple);
  Py_CLEAR(clear_module_state->__pyx_empty_bytes);
  Py_CLEAR(clear_module_state->__pyx_empty_unicode);
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __Pyx_State_RemoveModule(NULL);
  #endif
  Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type);
  Py_CLEAR(clear_module_state->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList);
  Py_CLEAR(clear_module_state->__pyx_type_6pkcs11_7_pkcs11_HasFuncList);
  Py_CLEAR(clear_module_state->__pyx_ptype_6pkcs11_7_pkcs11_lib);
  Py_CLEAR(clear_module_state->__pyx_type_6pkcs11_7_pkcs11_lib);
  Py_CLEAR(clear_module_state->__pyx_ptype_6pkcs11_7_pkcs11_AttributeList);
  Py_CLEAR(clear_module_state->__pyx_type_6pkcs11_7_pkcs11_AttributeList);
  Py_CLEAR(clear_module_state->__pyx_ptype_6pkcs11_7_pkcs11_MechanismWithParam);
  Py_CLEAR(clear_module_state->__pyx_type_6pkcs11_7_pkcs11_MechanismWithParam);
  Py_CLEAR(clear_module_state->__pyx_ptype_6pkcs11_7_pkcs11_Slot);
  Py_CLEAR(clear_module_state->__pyx_type_6pkcs11_7_pkcs11_Slot);
  Py_CLEAR(clear_module_state->__pyx_ptype_6pkcs11_7_pkcs11_Token);
  Py_CLEAR(clear_module_state->__pyx_type_6pkcs11_7_pkcs11_Token);
  Py_CLEAR(clear_module_state->__pyx_ptype_6pkcs11_7_pkcs11_OperationContext);
  Py_CLEAR(clear_module_state->__pyx_type_6pkcs11_7_pkcs11_OperationContext);
  Py_CLEAR(clear_module_state->__pyx_ptype_6pkcs11_7_pkcs11_OperationWithBinaryOutput);
  Py_CLEAR(clear_module_state->__pyx_type_6pkcs11_7_pkcs11_OperationWithBinaryOutput);
  Py_CLEAR(clear_module_state->__pyx_ptype_6pkcs11_7_pkcs11_SearchIter);
  Py_CLEAR(clear_module_state->__pyx_type_6pkcs11_7_pkcs11_SearchIter);
  Py_CLEAR(clear_module_state->__pyx_ptype_6pkcs11_7_pkcs11_DigestOperation);
  Py_CLEAR(clear_module_state->__pyx_type_6pkcs11_7_pkcs11_DigestOperation);
  Py_CLEAR(clear_module_state->__pyx_ptype_6pkcs11_7_pkcs11_Session);
  Py_CLEAR(clear_module_state->__pyx_type_6pkcs11_7_pkcs11_Session);
  Py_CLEAR(clear_module_state->__pyx_ptype_6pkcs11_7_pkcs11_ObjectHandleWrapper);
  Py_CLEAR(clear_module_state->__pyx_type_6pkcs11_7_pkcs11_ObjectHandleWrapper);
  Py_CLEAR(clear_module_state->__pyx_ptype_6pkcs11_7_pkcs11_KeyOperation);
  Py_CLEAR(clear_module_state->__pyx_type_6pkcs11_7_pkcs11_KeyOperation);
  Py_CLEAR(clear_module_state->__pyx_ptype_6pkcs11_7_pkcs11_DataCryptOperation);
  Py_CLEAR(clear_module_state->__pyx_type_6pkcs11_7_pkcs11_DataCryptOperation);
  Py_CLEAR(clear_module_state->__pyx_ptype_6pkcs11_7_pkcs11_SignOrVerifyOperation);
  Py_CLEAR(clear_module_state->__pyx_type_6pkcs11_7_pkcs11_SignOrVerifyOperation);
  Py_CLEAR(clear_module_state->__pyx_ptype_6pkcs11_7_pkcs11_DataSignOperation);
  Py_CLEAR(clear_module_state->__pyx_type_6pkcs11_7_pkcs11_DataSignOperation);
  Py_CLEAR(clear_module_state->__pyx_ptype_6pkcs11_7_pkcs11_DataVerifyOperation);
  Py_CLEAR(clear_module_state->__pyx_type_6pkcs11_7_pkcs11_DataVerifyOperation);
  Py_CLEAR(clear_module_state->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter);
  Py_CLEAR(clear_module_state->__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter);
  Py_CLEAR(clear_module_state->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects);
  Py_CLEAR(clear_module_state->__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects);
  Py_CLEAR(clear_module_state->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks);
  Py_CLEAR(clear_module_state->__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks);
  Py_CLEAR(clear_module_state->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator);
  Py_CLEAR(clear_module_state->__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator);
  Py_CLEAR(clear_module_state->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator);
  Py_CLEAR(clear_module_state->__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator);
  Py_CLEAR(clear_module_state->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens);
  Py_CLEAR(clear_module_state->__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens);
  Py_CLEAR(clear_module_state->__pyx_array_type);
  Py_CLEAR(clear_module_state->__pyx_type___pyx_array);
  Py_CLEAR(clear_module_state->__pyx_MemviewEnum_type);
  Py_CLEAR(clear_module_state->__pyx_type___pyx_MemviewEnum);
  Py_CLEAR(clear_module_state->__pyx_memoryview_type);
  Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryview);
  Py_CLEAR(clear_module_state->__pyx_memoryviewslice_type);
  Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryviewslice);
  Py_CLEAR(clear_module_state->__pyx_k__9);
  for (int i=0; i<2; ++i) { Py_CLEAR(clear_module_state->__pyx_slice[i]); }
  for (int i=0; i<17; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); }
  for (int i=0; i<114; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); }
  for (int i=0; i<763; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); }
  for (int i=0; i<8; ++i) { Py_CLEAR(clear_module_state->__pyx_number_tab[i]); }
/* #### Code section: module_state_clear_contents ### */
/* CommonTypesMetaclass.module_state_clear */
Py_CLEAR(clear_module_state->__pyx_CommonTypesMetaclassType);

/* Generator.module_state_clear */
Py_CLEAR(clear_module_state->__pyx_GeneratorType);

/* CythonFunctionShared.module_state_clear */
Py_CLEAR(clear_module_state->__pyx_CyFunctionType);

/* #### Code section: module_state_clear_end ### */
return 0;
}
#endif
/* #### Code section: module_state_traverse ### */
#if CYTHON_USE_MODULE_STATE
static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
  __pyx_mstatetype *traverse_module_state = __Pyx_PyModule_GetState(m);
  if (!traverse_module_state) return 0;
  Py_VISIT(traverse_module_state->__pyx_d);
  Py_VISIT(traverse_module_state->__pyx_b);
  Py_VISIT(traverse_module_state->__pyx_cython_runtime);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_tuple);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_bytes);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_unicode);
  Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type);
  Py_VISIT(traverse_module_state->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList);
  Py_VISIT(traverse_module_state->__pyx_type_6pkcs11_7_pkcs11_HasFuncList);
  Py_VISIT(traverse_module_state->__pyx_ptype_6pkcs11_7_pkcs11_lib);
  Py_VISIT(traverse_module_state->__pyx_type_6pkcs11_7_pkcs11_lib);
  Py_VISIT(traverse_module_state->__pyx_ptype_6pkcs11_7_pkcs11_AttributeList);
  Py_VISIT(traverse_module_state->__pyx_type_6pkcs11_7_pkcs11_AttributeList);
  Py_VISIT(traverse_module_state->__pyx_ptype_6pkcs11_7_pkcs11_MechanismWithParam);
  Py_VISIT(traverse_module_state->__pyx_type_6pkcs11_7_pkcs11_MechanismWithParam);
  Py_VISIT(traverse_module_state->__pyx_ptype_6pkcs11_7_pkcs11_Slot);
  Py_VISIT(traverse_module_state->__pyx_type_6pkcs11_7_pkcs11_Slot);
  Py_VISIT(traverse_module_state->__pyx_ptype_6pkcs11_7_pkcs11_Token);
  Py_VISIT(traverse_module_state->__pyx_type_6pkcs11_7_pkcs11_Token);
  Py_VISIT(traverse_module_state->__pyx_ptype_6pkcs11_7_pkcs11_OperationContext);
  Py_VISIT(traverse_module_state->__pyx_type_6pkcs11_7_pkcs11_OperationContext);
  Py_VISIT(traverse_module_state->__pyx_ptype_6pkcs11_7_pkcs11_OperationWithBinaryOutput);
  Py_VISIT(traverse_module_state->__pyx_type_6pkcs11_7_pkcs11_OperationWithBinaryOutput);
  Py_VISIT(traverse_module_state->__pyx_ptype_6pkcs11_7_pkcs11_SearchIter);
  Py_VISIT(traverse_module_state->__pyx_type_6pkcs11_7_pkcs11_SearchIter);
  Py_VISIT(traverse_module_state->__pyx_ptype_6pkcs11_7_pkcs11_DigestOperation);
  Py_VISIT(traverse_module_state->__pyx_type_6pkcs11_7_pkcs11_DigestOperation);
  Py_VISIT(traverse_module_state->__pyx_ptype_6pkcs11_7_pkcs11_Session);
  Py_VISIT(traverse_module_state->__pyx_type_6pkcs11_7_pkcs11_Session);
  Py_VISIT(traverse_module_state->__pyx_ptype_6pkcs11_7_pkcs11_ObjectHandleWrapper);
  Py_VISIT(traverse_module_state->__pyx_type_6pkcs11_7_pkcs11_ObjectHandleWrapper);
  Py_VISIT(traverse_module_state->__pyx_ptype_6pkcs11_7_pkcs11_KeyOperation);
  Py_VISIT(traverse_module_state->__pyx_type_6pkcs11_7_pkcs11_KeyOperation);
  Py_VISIT(traverse_module_state->__pyx_ptype_6pkcs11_7_pkcs11_DataCryptOperation);
  Py_VISIT(traverse_module_state->__pyx_type_6pkcs11_7_pkcs11_DataCryptOperation);
  Py_VISIT(traverse_module_state->__pyx_ptype_6pkcs11_7_pkcs11_SignOrVerifyOperation);
  Py_VISIT(traverse_module_state->__pyx_type_6pkcs11_7_pkcs11_SignOrVerifyOperation);
  Py_VISIT(traverse_module_state->__pyx_ptype_6pkcs11_7_pkcs11_DataSignOperation);
  Py_VISIT(traverse_module_state->__pyx_type_6pkcs11_7_pkcs11_DataSignOperation);
  Py_VISIT(traverse_module_state->__pyx_ptype_6pkcs11_7_pkcs11_DataVerifyOperation);
  Py_VISIT(traverse_module_state->__pyx_type_6pkcs11_7_pkcs11_DataVerifyOperation);
  Py_VISIT(traverse_module_state->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter);
  Py_VISIT(traverse_module_state->__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter);
  Py_VISIT(traverse_module_state->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects);
  Py_VISIT(traverse_module_state->__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects);
  Py_VISIT(traverse_module_state->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks);
  Py_VISIT(traverse_module_state->__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks);
  Py_VISIT(traverse_module_state->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator);
  Py_VISIT(traverse_module_state->__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator);
  Py_VISIT(traverse_module_state->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator);
  Py_VISIT(traverse_module_state->__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator);
  Py_VISIT(traverse_module_state->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens);
  Py_VISIT(traverse_module_state->__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens);
  Py_VISIT(traverse_module_state->__pyx_array_type);
  Py_VISIT(traverse_module_state->__pyx_type___pyx_array);
  Py_VISIT(traverse_module_state->__pyx_MemviewEnum_type);
  Py_VISIT(traverse_module_state->__pyx_type___pyx_MemviewEnum);
  Py_VISIT(traverse_module_state->__pyx_memoryview_type);
  Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryview);
  Py_VISIT(traverse_module_state->__pyx_memoryviewslice_type);
  Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryviewslice);
  Py_VISIT(traverse_module_state->__pyx_k__9);
  for (int i=0; i<2; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_slice[i]); }
  for (int i=0; i<17; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); }
  for (int i=0; i<114; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); }
  for (int i=0; i<763; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); }
  for (int i=0; i<8; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_number_tab[i]); }
/* #### Code section: module_state_traverse_contents ### */
/* CommonTypesMetaclass.module_state_traverse */
Py_VISIT(traverse_module_state->__pyx_CommonTypesMetaclassType);

/* Generator.module_state_traverse */
Py_VISIT(traverse_module_state->__pyx_GeneratorType);

/* CythonFunctionShared.module_state_traverse */
Py_VISIT(traverse_module_state->__pyx_CyFunctionType);

/* #### Code section: module_state_traverse_end ### */
return 0;
}
#endif
/* #### Code section: module_code ### */

/* "carray.from_py":78
 *     object PyErr_Format(exc, const char *format, ...)
 * 
 * @cname("__Pyx_carray_from_py_CK_BYTE")             # <<<<<<<<<<<<<<
 * cdef int __Pyx_carray_from_py_CK_BYTE(object o, base_type *v, Py_ssize_t length) except -1:
 *     cdef Py_ssize_t i = length
*/

static int __Pyx_carray_from_py_CK_BYTE(PyObject *__pyx_v_o, CK_BYTE *__pyx_v_v, Py_ssize_t __pyx_v_length) {
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_item = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  CK_BYTE __pyx_t_11;
  char const *__pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_carray_from_py_CK_BYTE", 0);

  /* "carray.from_py":80
 * @cname("__Pyx_carray_from_py_CK_BYTE")
 * cdef int __Pyx_carray_from_py_CK_BYTE(object o, base_type *v, Py_ssize_t length) except -1:
 *     cdef Py_ssize_t i = length             # <<<<<<<<<<<<<<
 *     try:
 *         i = len(o)
*/
  __pyx_v_i = __pyx_v_length;

  /* "carray.from_py":81
 * cdef int __Pyx_carray_from_py_CK_BYTE(object o, base_type *v, Py_ssize_t length) except -1:
 *     cdef Py_ssize_t i = length
 *     try:             # <<<<<<<<<<<<<<
 *         i = len(o)
 *     except (TypeError, OverflowError):
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "carray.from_py":82
 *     cdef Py_ssize_t i = length
 *     try:
 *         i = len(o)             # <<<<<<<<<<<<<<
 *     except (TypeError, OverflowError):
 *         pass
*/
      __pyx_t_4 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 82, __pyx_L3_error)
      __pyx_v_i = __pyx_t_4;

      /* "carray.from_py":81
 * cdef int __Pyx_carray_from_py_CK_BYTE(object o, base_type *v, Py_ssize_t length) except -1:
 *     cdef Py_ssize_t i = length
 *     try:             # <<<<<<<<<<<<<<
 *         i = len(o)
 *     except (TypeError, OverflowError):
*/
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;

    /* "carray.from_py":83
 *     try:
 *         i = len(o)
 *     except (TypeError, OverflowError):             # <<<<<<<<<<<<<<
 *         pass
 *     if i == length:
*/
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches2(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), ((PyObject *)(((PyTypeObject*)PyExc_OverflowError))));
    if (__pyx_t_5) {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;

    /* "carray.from_py":81
 * cdef int __Pyx_carray_from_py_CK_BYTE(object o, base_type *v, Py_ssize_t length) except -1:
 *     cdef Py_ssize_t i = length
 *     try:             # <<<<<<<<<<<<<<
 *         i = len(o)
 *     except (TypeError, OverflowError):
*/
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L8_try_end:;
  }

  /* "carray.from_py":85
 *     except (TypeError, OverflowError):
 *         pass
 *     if i == length:             # <<<<<<<<<<<<<<
 *         for i, item in enumerate(o):
 *             if i >= length:
*/
  __pyx_t_6 = (__pyx_v_i == __pyx_v_length);
  if (__pyx_t_6) {

    /* "carray.from_py":86
 *         pass
 *     if i == length:
 *         for i, item in enumerate(o):             # <<<<<<<<<<<<<<
 *             if i >= length:
 *                 break
*/
    __pyx_t_4 = 0;
    if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) {
      __pyx_t_7 = __pyx_v_o; __Pyx_INCREF(__pyx_t_7);
      __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 86, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 86, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_9)) {
        if (likely(PyList_CheckExact(__pyx_t_7))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_7);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 86, __pyx_L1_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          __pyx_t_10 = __Pyx_PyList_GetItemRefFast(__pyx_t_7, __pyx_t_8, __Pyx_ReferenceSharing_OwnStrongReference);
          ++__pyx_t_8;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_7);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 86, __pyx_L1_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_10 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_8));
          #else
          __pyx_t_10 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_8);
          #endif
          ++__pyx_t_8;
        }
        if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 86, __pyx_L1_error)
      } else {
        __pyx_t_10 = __pyx_t_9(__pyx_t_7);
        if (unlikely(!__pyx_t_10)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 86, __pyx_L1_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_10);
      __pyx_t_10 = 0;
      __pyx_v_i = __pyx_t_4;
      __pyx_t_4 = (__pyx_t_4 + 1);

      /* "carray.from_py":87
 *     if i == length:
 *         for i, item in enumerate(o):
 *             if i >= length:             # <<<<<<<<<<<<<<
 *                 break
 *             v[i] = item
*/
      __pyx_t_6 = (__pyx_v_i >= __pyx_v_length);
      if (__pyx_t_6) {

        /* "carray.from_py":88
 *         for i, item in enumerate(o):
 *             if i >= length:
 *                 break             # <<<<<<<<<<<<<<
 *             v[i] = item
 *         else:
*/
        goto __pyx_L13_break;

        /* "carray.from_py":87
 *     if i == length:
 *         for i, item in enumerate(o):
 *             if i >= length:             # <<<<<<<<<<<<<<
 *                 break
 *             v[i] = item
*/
      }

      /* "carray.from_py":89
 *             if i >= length:
 *                 break
 *             v[i] = item             # <<<<<<<<<<<<<<
 *         else:
 *             i += 1  # convert index to length
*/
      __pyx_t_11 = __Pyx_PyLong_As_CK_BYTE(__pyx_v_item); if (unlikely((__pyx_t_11 == ((CK_BYTE)-1)) && PyErr_Occurred())) __PYX_ERR(1, 89, __pyx_L1_error)
      (__pyx_v_v[__pyx_v_i]) = __pyx_t_11;

      /* "carray.from_py":86
 *         pass
 *     if i == length:
 *         for i, item in enumerate(o):             # <<<<<<<<<<<<<<
 *             if i >= length:
 *                 break
*/
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L15_for_else;
    __pyx_L13_break:;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L16_for_end;
    /*else*/ {
      __pyx_L15_for_else:;

      /* "carray.from_py":91
 *             v[i] = item
 *         else:
 *             i += 1  # convert index to length             # <<<<<<<<<<<<<<
 *             if i == length:
 *                 return 0
*/
      __pyx_v_i = (__pyx_v_i + 1);

      /* "carray.from_py":92
 *         else:
 *             i += 1  # convert index to length
 *             if i == length:             # <<<<<<<<<<<<<<
 *                 return 0
 * 
*/
      __pyx_t_6 = (__pyx_v_i == __pyx_v_length);
      if (__pyx_t_6) {

        /* "carray.from_py":93
 *             i += 1  # convert index to length
 *             if i == length:
 *                 return 0             # <<<<<<<<<<<<<<
 * 
 *     PyErr_Format(
*/
        __pyx_r = 0;
        goto __pyx_L0;

        /* "carray.from_py":92
 *         else:
 *             i += 1  # convert index to length
 *             if i == length:             # <<<<<<<<<<<<<<
 *                 return 0
 * 
*/
      }
    }
    __pyx_L16_for_end:;

    /* "carray.from_py":85
 *     except (TypeError, OverflowError):
 *         pass
 *     if i == length:             # <<<<<<<<<<<<<<
 *         for i, item in enumerate(o):
 *             if i >= length:
*/
  }

  /* "carray.from_py":98
 *         IndexError,
 *         ("too many values found during array assignment, expected %zd"
 *          if i >= length else             # <<<<<<<<<<<<<<
 *          "not enough values found during array assignment, expected %zd, got %zd"),
 *         length, i)
*/
  __pyx_t_6 = (__pyx_v_i >= __pyx_v_length);
  if (__pyx_t_6) {
    __pyx_t_12 = __pyx_k_too_many_values_found_during_arr;
  } else {
    __pyx_t_12 = __pyx_k_not_enough_values_found_during_a;
  }

  /* "carray.from_py":95
 *                 return 0
 * 
 *     PyErr_Format(             # <<<<<<<<<<<<<<
 *         IndexError,
 *         ("too many values found during array assignment, expected %zd"
*/
  __pyx_t_7 = PyErr_Format(((PyObject *)(((PyTypeObject*)PyExc_IndexError))), __pyx_t_12, __pyx_v_length, __pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 95, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "carray.from_py":78
 *     object PyErr_Format(exc, const char *format, ...)
 * 
 * @cname("__Pyx_carray_from_py_CK_BYTE")             # <<<<<<<<<<<<<<
 * cdef int __Pyx_carray_from_py_CK_BYTE(object o, base_type *v, Py_ssize_t length) except -1:
 *     cdef Py_ssize_t i = length
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("carray.from_py.__Pyx_carray_from_py_CK_BYTE", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":137
 *         cdef bint dtype_is_object
 * 
 *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
 *                   mode="c", bint allocate_buffer=True):
 * 
*/

/* Python wrapper */
static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_shape = 0;
  Py_ssize_t __pyx_v_itemsize;
  PyObject *__pyx_v_format = 0;
  PyObject *__pyx_v_mode = 0;
  int __pyx_v_allocate_buffer;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_shape,&__pyx_mstate_global->__pyx_n_u_itemsize,&__pyx_mstate_global->__pyx_n_u_format,&__pyx_mstate_global->__pyx_n_u_mode,&__pyx_mstate_global->__pyx_n_u_allocate_buffer,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(1, 137, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(1, 137, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(1, 137, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 137, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 137, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 137, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(1, 137, __pyx_L3_error)
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_c));
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, i); __PYX_ERR(1, 137, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(1, 137, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(1, 137, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 137, __pyx_L3_error)
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 137, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 137, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_c));
    }
    __pyx_v_shape = ((PyObject*)values[0]);
    __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 137, __pyx_L3_error)
    __pyx_v_format = values[2];
    __pyx_v_mode = values[3];
    if (values[4]) {
      __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 138, __pyx_L3_error)
    } else {

      /* "View.MemoryView":138
 * 
 *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,
 *                   mode="c", bint allocate_buffer=True):             # <<<<<<<<<<<<<<
 * 
 *         cdef int idx
*/
      __pyx_v_allocate_buffer = ((int)1);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, __pyx_nargs); __PYX_ERR(1, 137, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(1, 137, __pyx_L1_error)
  if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(1, 137, __pyx_L1_error)
  }
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer);

  /* "View.MemoryView":137
 *         cdef bint dtype_is_object
 * 
 *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
 *                   mode="c", bint allocate_buffer=True):
 * 
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) {
  int __pyx_v_idx;
  Py_ssize_t __pyx_v_dim;
  char __pyx_v_order;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  char *__pyx_t_7;
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11[5];
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);
  __Pyx_INCREF(__pyx_v_format);

  /* "View.MemoryView":143
 *         cdef Py_ssize_t dim
 * 
 *         self.ndim = <int> len(shape)             # <<<<<<<<<<<<<<
 *         self.itemsize = itemsize
 * 
*/
  if (unlikely(__pyx_v_shape == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 143, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 143, __pyx_L1_error)
  __pyx_v_self->ndim = ((int)__pyx_t_1);

  /* "View.MemoryView":144
 * 
 *         self.ndim = <int> len(shape)
 *         self.itemsize = itemsize             # <<<<<<<<<<<<<<
 * 
 *         if not self.ndim:
*/
  __pyx_v_self->itemsize = __pyx_v_itemsize;

  /* "View.MemoryView":146
 *         self.itemsize = itemsize
 * 
 *         if not self.ndim:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Empty shape tuple for cython.array"
 * 
*/
  __pyx_t_2 = (!(__pyx_v_self->ndim != 0));
  if (unlikely(__pyx_t_2)) {

    /* "View.MemoryView":147
 * 
 *         if not self.ndim:
 *             raise ValueError, "Empty shape tuple for cython.array"             # <<<<<<<<<<<<<<
 * 
 *         if itemsize <= 0:
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Empty_shape_tuple_for_cython_arr, 0, 0);
    __PYX_ERR(1, 147, __pyx_L1_error)

    /* "View.MemoryView":146
 *         self.itemsize = itemsize
 * 
 *         if not self.ndim:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Empty shape tuple for cython.array"
 * 
*/
  }

  /* "View.MemoryView":149
 *             raise ValueError, "Empty shape tuple for cython.array"
 * 
 *         if itemsize <= 0:             # <<<<<<<<<<<<<<
 *             raise ValueError, "itemsize <= 0 for cython.array"
 * 
*/
  __pyx_t_2 = (__pyx_v_itemsize <= 0);
  if (unlikely(__pyx_t_2)) {

    /* "View.MemoryView":150
 * 
 *         if itemsize <= 0:
 *             raise ValueError, "itemsize <= 0 for cython.array"             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(format, bytes):
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_itemsize_0_for_cython_array, 0, 0);
    __PYX_ERR(1, 150, __pyx_L1_error)

    /* "View.MemoryView":149
 *             raise ValueError, "Empty shape tuple for cython.array"
 * 
 *         if itemsize <= 0:             # <<<<<<<<<<<<<<
 *             raise ValueError, "itemsize <= 0 for cython.array"
 * 
*/
  }

  /* "View.MemoryView":152
 *             raise ValueError, "itemsize <= 0 for cython.array"
 * 
 *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
 *             format = format.encode('ASCII')
 *         self._format = format  # keep a reference to the byte string
*/
  __pyx_t_2 = PyBytes_Check(__pyx_v_format); 
  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {

    /* "View.MemoryView":153
 * 
 *         if not isinstance(format, bytes):
 *             format = format.encode('ASCII')             # <<<<<<<<<<<<<<
 *         self._format = format  # keep a reference to the byte string
 *         self.format = self._format
*/
    __pyx_t_5 = __pyx_v_format;
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ASCII};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 153, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "View.MemoryView":152
 *             raise ValueError, "itemsize <= 0 for cython.array"
 * 
 *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
 *             format = format.encode('ASCII')
 *         self._format = format  # keep a reference to the byte string
*/
  }

  /* "View.MemoryView":154
 *         if not isinstance(format, bytes):
 *             format = format.encode('ASCII')
 *         self._format = format  # keep a reference to the byte string             # <<<<<<<<<<<<<<
 *         self.format = self._format
 * 
*/
  __pyx_t_4 = __pyx_v_format;
  __Pyx_INCREF(__pyx_t_4);
  if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(1, 154, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->_format);
  __Pyx_DECREF(__pyx_v_self->_format);
  __pyx_v_self->_format = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "View.MemoryView":155
 *             format = format.encode('ASCII')
 *         self._format = format  # keep a reference to the byte string
 *         self.format = self._format             # <<<<<<<<<<<<<<
 * 
 * 
*/
  if (unlikely(__pyx_v_self->_format == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(1, 155, __pyx_L1_error)
  }
  __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(1, 155, __pyx_L1_error)
  __pyx_v_self->format = __pyx_t_7;

  /* "View.MemoryView":158
 * 
 * 
 *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)             # <<<<<<<<<<<<<<
 *         self._strides = self._shape + self.ndim
 * 
*/
  __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));

  /* "View.MemoryView":159
 * 
 *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)
 *         self._strides = self._shape + self.ndim             # <<<<<<<<<<<<<<
 * 
 *         if not self._shape:
*/
  __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);

  /* "View.MemoryView":161
 *         self._strides = self._shape + self.ndim
 * 
 *         if not self._shape:             # <<<<<<<<<<<<<<
 *             raise MemoryError, "unable to allocate shape and strides."
 * 
*/
  __pyx_t_3 = (!(__pyx_v_self->_shape != 0));
  if (unlikely(__pyx_t_3)) {

    /* "View.MemoryView":162
 * 
 *         if not self._shape:
 *             raise MemoryError, "unable to allocate shape and strides."             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_MemoryError))), __pyx_mstate_global->__pyx_kp_u_unable_to_allocate_shape_and_str, 0, 0);
    __PYX_ERR(1, 162, __pyx_L1_error)

    /* "View.MemoryView":161
 *         self._strides = self._shape + self.ndim
 * 
 *         if not self._shape:             # <<<<<<<<<<<<<<
 *             raise MemoryError, "unable to allocate shape and strides."
 * 
*/
  }

  /* "View.MemoryView":165
 * 
 * 
 *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
 *             if dim <= 0:
 *                 raise ValueError, f"Invalid shape in axis {idx}: {dim}."
*/
  __pyx_t_8 = 0;
  __pyx_t_4 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_4);
  __pyx_t_1 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 165, __pyx_L1_error)
      #endif
      if (__pyx_t_1 >= __pyx_temp) break;
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1));
    #else
    __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_1);
    #endif
    ++__pyx_t_1;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 165, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 165, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_dim = __pyx_t_9;
    __pyx_v_idx = __pyx_t_8;
    __pyx_t_8 = (__pyx_t_8 + 1);

    /* "View.MemoryView":166
 * 
 *         for idx, dim in enumerate(shape):
 *             if dim <= 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError, f"Invalid shape in axis {idx}: {dim}."
 *             self._shape[idx] = dim
*/
    __pyx_t_3 = (__pyx_v_dim <= 0);
    if (unlikely(__pyx_t_3)) {

      /* "View.MemoryView":167
 *         for idx, dim in enumerate(shape):
 *             if dim <= 0:
 *                 raise ValueError, f"Invalid shape in axis {idx}: {dim}."             # <<<<<<<<<<<<<<
 *             self._shape[idx] = dim
 * 
*/
      __pyx_t_5 = __Pyx_PyUnicode_From_int(__pyx_v_idx, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 167, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_10 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 167, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11[0] = __pyx_mstate_global->__pyx_kp_u_Invalid_shape_in_axis;
      __pyx_t_11[1] = __pyx_t_5;
      __pyx_t_11[2] = __pyx_mstate_global->__pyx_kp_u_;
      __pyx_t_11[3] = __pyx_t_10;
      __pyx_t_11[4] = __pyx_mstate_global->__pyx_kp_u__2;
      __pyx_t_12 = __Pyx_PyUnicode_Join(__pyx_t_11, 5, 22 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10) + 1, 127);
      if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 167, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_12, 0, 0);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __PYX_ERR(1, 167, __pyx_L1_error)

      /* "View.MemoryView":166
 * 
 *         for idx, dim in enumerate(shape):
 *             if dim <= 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError, f"Invalid shape in axis {idx}: {dim}."
 *             self._shape[idx] = dim
*/
    }

    /* "View.MemoryView":168
 *             if dim <= 0:
 *                 raise ValueError, f"Invalid shape in axis {idx}: {dim}."
 *             self._shape[idx] = dim             # <<<<<<<<<<<<<<
 * 
 *         cdef char order
*/
    (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;

    /* "View.MemoryView":165
 * 
 * 
 *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
 *             if dim <= 0:
 *                 raise ValueError, f"Invalid shape in axis {idx}: {dim}."
*/
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "View.MemoryView":171
 * 
 *         cdef char order
 *         if mode == 'c':             # <<<<<<<<<<<<<<
 *             order = b'C'
 *             self.mode = u'c'
*/
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_mode, __pyx_mstate_global->__pyx_n_u_c, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 171, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "View.MemoryView":172
 *         cdef char order
 *         if mode == 'c':
 *             order = b'C'             # <<<<<<<<<<<<<<
 *             self.mode = u'c'
 *         elif mode == 'fortran':
*/
    __pyx_v_order = 'C';

    /* "View.MemoryView":173
 *         if mode == 'c':
 *             order = b'C'
 *             self.mode = u'c'             # <<<<<<<<<<<<<<
 *         elif mode == 'fortran':
 *             order = b'F'
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_c);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_c);
    __Pyx_GOTREF(__pyx_v_self->mode);
    __Pyx_DECREF(__pyx_v_self->mode);
    __pyx_v_self->mode = __pyx_mstate_global->__pyx_n_u_c;

    /* "View.MemoryView":171
 * 
 *         cdef char order
 *         if mode == 'c':             # <<<<<<<<<<<<<<
 *             order = b'C'
 *             self.mode = u'c'
*/
    goto __pyx_L11;
  }

  /* "View.MemoryView":174
 *             order = b'C'
 *             self.mode = u'c'
 *         elif mode == 'fortran':             # <<<<<<<<<<<<<<
 *             order = b'F'
 *             self.mode = u'fortran'
*/
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_mode, __pyx_mstate_global->__pyx_n_u_fortran, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 174, __pyx_L1_error)
  if (likely(__pyx_t_3)) {

    /* "View.MemoryView":175
 *             self.mode = u'c'
 *         elif mode == 'fortran':
 *             order = b'F'             # <<<<<<<<<<<<<<
 *             self.mode = u'fortran'
 *         else:
*/
    __pyx_v_order = 'F';

    /* "View.MemoryView":176
 *         elif mode == 'fortran':
 *             order = b'F'
 *             self.mode = u'fortran'             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}"
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_fortran);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_fortran);
    __Pyx_GOTREF(__pyx_v_self->mode);
    __Pyx_DECREF(__pyx_v_self->mode);
    __pyx_v_self->mode = __pyx_mstate_global->__pyx_n_u_fortran;

    /* "View.MemoryView":174
 *             order = b'C'
 *             self.mode = u'c'
 *         elif mode == 'fortran':             # <<<<<<<<<<<<<<
 *             order = b'F'
 *             self.mode = u'fortran'
*/
    goto __pyx_L11;
  }

  /* "View.MemoryView":178
 *             self.mode = u'fortran'
 *         else:
 *             raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}"             # <<<<<<<<<<<<<<
 * 
 *         self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order)
*/
  /*else*/ {
    __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_mode, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 178, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_12 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Invalid_mode_expected_c_or_fortr, __pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 178, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_12, 0, 0);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __PYX_ERR(1, 178, __pyx_L1_error)
  }
  __pyx_L11:;

  /* "View.MemoryView":180
 *             raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}"
 * 
 *         self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order)             # <<<<<<<<<<<<<<
 * 
 *         self.free_data = allocate_buffer
*/
  __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order);

  /* "View.MemoryView":182
 *         self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order)
 * 
 *         self.free_data = allocate_buffer             # <<<<<<<<<<<<<<
 *         self.dtype_is_object = format == b'O'
 * 
*/
  __pyx_v_self->free_data = __pyx_v_allocate_buffer;

  /* "View.MemoryView":183
 * 
 *         self.free_data = allocate_buffer
 *         self.dtype_is_object = format == b'O'             # <<<<<<<<<<<<<<
 * 
 *         if allocate_buffer:
*/
  __pyx_t_12 = PyObject_RichCompare(__pyx_v_format, __pyx_mstate_global->__pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 183, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 183, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_v_self->dtype_is_object = __pyx_t_3;

  /* "View.MemoryView":185
 *         self.dtype_is_object = format == b'O'
 * 
 *         if allocate_buffer:             # <<<<<<<<<<<<<<
 *             _allocate_buffer(self)
 * 
*/
  if (__pyx_v_allocate_buffer) {

    /* "View.MemoryView":186
 * 
 *         if allocate_buffer:
 *             _allocate_buffer(self)             # <<<<<<<<<<<<<<
 * 
 *     @cname('getbuffer')
*/
    __pyx_t_8 = __pyx_array_allocate_buffer(__pyx_v_self); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(1, 186, __pyx_L1_error)

    /* "View.MemoryView":185
 *         self.dtype_is_object = format == b'O'
 * 
 *         if allocate_buffer:             # <<<<<<<<<<<<<<
 *             _allocate_buffer(self)
 * 
*/
  }

  /* "View.MemoryView":137
 *         cdef bint dtype_is_object
 * 
 *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
 *                   mode="c", bint allocate_buffer=True):
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_format);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":188
 *             _allocate_buffer(self)
 * 
 *     @cname('getbuffer')             # <<<<<<<<<<<<<<
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         cdef int bufmode = -1
*/

/* Python wrapper */
CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));

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

static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_v_bufmode;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  char *__pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t *__pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  if (unlikely(__pyx_v_info == NULL)) {
    PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
    return -1;
  }
  __Pyx_RefNannySetupContext("__getbuffer__", 0);
  __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(__pyx_v_info->obj);

  /* "View.MemoryView":190
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         cdef int bufmode = -1             # <<<<<<<<<<<<<<
 *         if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS):
 *             if self.mode == u"c":
*/
  __pyx_v_bufmode = -1;

  /* "View.MemoryView":191
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         cdef int bufmode = -1
 *         if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS):             # <<<<<<<<<<<<<<
 *             if self.mode == u"c":
 *                 bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
*/
  __pyx_t_1 = ((__pyx_v_flags & ((PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS) | PyBUF_ANY_CONTIGUOUS)) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":192
 *         cdef int bufmode = -1
 *         if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS):
 *             if self.mode == u"c":             # <<<<<<<<<<<<<<
 *                 bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *             elif self.mode == u"fortran":
*/
    __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_mstate_global->__pyx_n_u_c, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 192, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "View.MemoryView":193
 *         if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS):
 *             if self.mode == u"c":
 *                 bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
 *             elif self.mode == u"fortran":
 *                 bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
*/
      __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);

      /* "View.MemoryView":192
 *         cdef int bufmode = -1
 *         if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS):
 *             if self.mode == u"c":             # <<<<<<<<<<<<<<
 *                 bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *             elif self.mode == u"fortran":
*/
      goto __pyx_L4;
    }

    /* "View.MemoryView":194
 *             if self.mode == u"c":
 *                 bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *             elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
 *                 bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *             if not (flags & bufmode):
*/
    __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_mstate_global->__pyx_n_u_fortran, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 194, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "View.MemoryView":195
 *                 bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *             elif self.mode == u"fortran":
 *                 bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
 *             if not (flags & bufmode):
 *                 raise ValueError, "Can only create a buffer that is contiguous in memory."
*/
      __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);

      /* "View.MemoryView":194
 *             if self.mode == u"c":
 *                 bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *             elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
 *                 bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *             if not (flags & bufmode):
*/
    }
    __pyx_L4:;

    /* "View.MemoryView":196
 *             elif self.mode == u"fortran":
 *                 bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *             if not (flags & bufmode):             # <<<<<<<<<<<<<<
 *                 raise ValueError, "Can only create a buffer that is contiguous in memory."
 *         info.buf = self.data
*/
    __pyx_t_1 = (!((__pyx_v_flags & __pyx_v_bufmode) != 0));
    if (unlikely(__pyx_t_1)) {

      /* "View.MemoryView":197
 *                 bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *             if not (flags & bufmode):
 *                 raise ValueError, "Can only create a buffer that is contiguous in memory."             # <<<<<<<<<<<<<<
 *         info.buf = self.data
 *         info.len = self.len
*/
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Can_only_create_a_buffer_that_is, 0, 0);
      __PYX_ERR(1, 197, __pyx_L1_error)

      /* "View.MemoryView":196
 *             elif self.mode == u"fortran":
 *                 bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *             if not (flags & bufmode):             # <<<<<<<<<<<<<<
 *                 raise ValueError, "Can only create a buffer that is contiguous in memory."
 *         info.buf = self.data
*/
    }

    /* "View.MemoryView":191
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         cdef int bufmode = -1
 *         if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS):             # <<<<<<<<<<<<<<
 *             if self.mode == u"c":
 *                 bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
*/
  }

  /* "View.MemoryView":198
 *             if not (flags & bufmode):
 *                 raise ValueError, "Can only create a buffer that is contiguous in memory."
 *         info.buf = self.data             # <<<<<<<<<<<<<<
 *         info.len = self.len
 * 
*/
  __pyx_t_2 = __pyx_v_self->data;
  __pyx_v_info->buf = __pyx_t_2;

  /* "View.MemoryView":199
 *                 raise ValueError, "Can only create a buffer that is contiguous in memory."
 *         info.buf = self.data
 *         info.len = self.len             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_STRIDES:
*/
  __pyx_t_3 = __pyx_v_self->len;
  __pyx_v_info->len = __pyx_t_3;

  /* "View.MemoryView":201
 *         info.len = self.len
 * 
 *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
 *             info.ndim = self.ndim
 *             info.shape = self._shape
*/
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":202
 * 
 *         if flags & PyBUF_STRIDES:
 *             info.ndim = self.ndim             # <<<<<<<<<<<<<<
 *             info.shape = self._shape
 *             info.strides = self._strides
*/
    __pyx_t_4 = __pyx_v_self->ndim;
    __pyx_v_info->ndim = __pyx_t_4;

    /* "View.MemoryView":203
 *         if flags & PyBUF_STRIDES:
 *             info.ndim = self.ndim
 *             info.shape = self._shape             # <<<<<<<<<<<<<<
 *             info.strides = self._strides
 *         else:
*/
    __pyx_t_5 = __pyx_v_self->_shape;
    __pyx_v_info->shape = __pyx_t_5;

    /* "View.MemoryView":204
 *             info.ndim = self.ndim
 *             info.shape = self._shape
 *             info.strides = self._strides             # <<<<<<<<<<<<<<
 *         else:
 *             info.ndim = 1
*/
    __pyx_t_5 = __pyx_v_self->_strides;
    __pyx_v_info->strides = __pyx_t_5;

    /* "View.MemoryView":201
 *         info.len = self.len
 * 
 *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
 *             info.ndim = self.ndim
 *             info.shape = self._shape
*/
    goto __pyx_L6;
  }

  /* "View.MemoryView":206
 *             info.strides = self._strides
 *         else:
 *             info.ndim = 1             # <<<<<<<<<<<<<<
 *             info.shape = &self.len if flags & PyBUF_ND else NULL
 *             info.strides = NULL
*/
  /*else*/ {
    __pyx_v_info->ndim = 1;

    /* "View.MemoryView":207
 *         else:
 *             info.ndim = 1
 *             info.shape = &self.len if flags & PyBUF_ND else NULL             # <<<<<<<<<<<<<<
 *             info.strides = NULL
 * 
*/
    __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
    if (__pyx_t_1) {
      __pyx_t_5 = (&__pyx_v_self->len);
    } else {
      __pyx_t_5 = NULL;
    }
    __pyx_v_info->shape = __pyx_t_5;

    /* "View.MemoryView":208
 *             info.ndim = 1
 *             info.shape = &self.len if flags & PyBUF_ND else NULL
 *             info.strides = NULL             # <<<<<<<<<<<<<<
 * 
 *         info.suboffsets = NULL
*/
    __pyx_v_info->strides = NULL;
  }
  __pyx_L6:;

  /* "View.MemoryView":210
 *             info.strides = NULL
 * 
 *         info.suboffsets = NULL             # <<<<<<<<<<<<<<
 *         info.itemsize = self.itemsize
 *         info.readonly = 0
*/
  __pyx_v_info->suboffsets = NULL;

  /* "View.MemoryView":211
 * 
 *         info.suboffsets = NULL
 *         info.itemsize = self.itemsize             # <<<<<<<<<<<<<<
 *         info.readonly = 0
 *         info.format = self.format if flags & PyBUF_FORMAT else NULL
*/
  __pyx_t_3 = __pyx_v_self->itemsize;
  __pyx_v_info->itemsize = __pyx_t_3;

  /* "View.MemoryView":212
 *         info.suboffsets = NULL
 *         info.itemsize = self.itemsize
 *         info.readonly = 0             # <<<<<<<<<<<<<<
 *         info.format = self.format if flags & PyBUF_FORMAT else NULL
 *         info.obj = self
*/
  __pyx_v_info->readonly = 0;

  /* "View.MemoryView":213
 *         info.itemsize = self.itemsize
 *         info.readonly = 0
 *         info.format = self.format if flags & PyBUF_FORMAT else NULL             # <<<<<<<<<<<<<<
 *         info.obj = self
 * 
*/
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
  if (__pyx_t_1) {
    __pyx_t_2 = __pyx_v_self->format;
  } else {
    __pyx_t_2 = NULL;
  }
  __pyx_v_info->format = __pyx_t_2;

  /* "View.MemoryView":214
 *         info.readonly = 0
 *         info.format = self.format if flags & PyBUF_FORMAT else NULL
 *         info.obj = self             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(array self):
*/
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self);
  __Pyx_GOTREF(__pyx_v_info->obj);
  __Pyx_DECREF(__pyx_v_info->obj);
  __pyx_v_info->obj = ((PyObject *)__pyx_v_self);

  /* "View.MemoryView":188
 *             _allocate_buffer(self)
 * 
 *     @cname('getbuffer')             # <<<<<<<<<<<<<<
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         cdef int bufmode = -1
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  if (__pyx_v_info->obj != NULL) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  }
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_info->obj == Py_None) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  }
  __pyx_L2:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":216
 *         info.obj = self
 * 
 *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)
*/

/* Python wrapper */
static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self));

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

static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) {
  int __pyx_t_1;
  int __pyx_t_2;

  /* "View.MemoryView":217
 * 
 *     def __dealloc__(array self):
 *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
 *             self.callback_free_data(self.data)
 *         elif self.free_data and self.data is not NULL:
*/
  __pyx_t_1 = (__pyx_v_self->callback_free_data != NULL);
  if (__pyx_t_1) {

    /* "View.MemoryView":218
 *     def __dealloc__(array self):
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)             # <<<<<<<<<<<<<<
 *         elif self.free_data and self.data is not NULL:
 *             if self.dtype_is_object:
*/
    __pyx_v_self->callback_free_data(__pyx_v_self->data);

    /* "View.MemoryView":217
 * 
 *     def __dealloc__(array self):
 *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
 *             self.callback_free_data(self.data)
 *         elif self.free_data and self.data is not NULL:
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":219
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)
 *         elif self.free_data and self.data is not NULL:             # <<<<<<<<<<<<<<
 *             if self.dtype_is_object:
 *                 refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False)
*/
  if (__pyx_v_self->free_data) {
  } else {
    __pyx_t_1 = __pyx_v_self->free_data;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_self->data != NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "View.MemoryView":220
 *             self.callback_free_data(self.data)
 *         elif self.free_data and self.data is not NULL:
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False)
 *             free(self.data)
*/
    if (__pyx_v_self->dtype_is_object) {

      /* "View.MemoryView":221
 *         elif self.free_data and self.data is not NULL:
 *             if self.dtype_is_object:
 *                 refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False)             # <<<<<<<<<<<<<<
 *             free(self.data)
 *         PyObject_Free(self._shape)
*/
      __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);

      /* "View.MemoryView":220
 *             self.callback_free_data(self.data)
 *         elif self.free_data and self.data is not NULL:
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False)
 *             free(self.data)
*/
    }

    /* "View.MemoryView":222
 *             if self.dtype_is_object:
 *                 refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False)
 *             free(self.data)             # <<<<<<<<<<<<<<
 *         PyObject_Free(self._shape)
 * 
*/
    free(__pyx_v_self->data);

    /* "View.MemoryView":219
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)
 *         elif self.free_data and self.data is not NULL:             # <<<<<<<<<<<<<<
 *             if self.dtype_is_object:
 *                 refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False)
*/
  }
  __pyx_L3:;

  /* "View.MemoryView":223
 *                 refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False)
 *             free(self.data)
 *         PyObject_Free(self._shape)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  PyObject_Free(__pyx_v_self->_shape);

  /* "View.MemoryView":216
 *         info.obj = self
 * 
 *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)
*/

  /* function exit code */
}

/* "View.MemoryView":225
 *         PyObject_Free(self._shape)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def memview(self):
 *         return self.get_memview()
*/

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self));

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

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

  /* "View.MemoryView":227
 *     @property
 *     def memview(self):
 *         return self.get_memview()             # <<<<<<<<<<<<<<
 * 
 *     @cname('get_memview')
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":225
 *         PyObject_Free(self._shape)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def memview(self):
 *         return self.get_memview()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":229
 *         return self.get_memview()
 * 
 *     @cname('get_memview')             # <<<<<<<<<<<<<<
 *     cdef get_memview(self):
 *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
*/

static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) {
  int __pyx_v_flags;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_memview", 0);

  /* "View.MemoryView":231
 *     @cname('get_memview')
 *     cdef get_memview(self):
 *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE             # <<<<<<<<<<<<<<
 *         return  memoryview(self, flags, self.dtype_is_object)
 * 
*/
  __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);

  /* "View.MemoryView":232
 *     cdef get_memview(self):
 *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
 *         return  memoryview(self, flags, self.dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 232, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 232, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_2, ((PyObject *)__pyx_v_self), __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_memoryview_type, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 232, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":229
 *         return self.get_memview()
 * 
 *     @cname('get_memview')             # <<<<<<<<<<<<<<
 *     cdef get_memview(self):
 *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
*/

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

/* "View.MemoryView":234
 *         return  memoryview(self, flags, self.dtype_is_object)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self._shape[0]
 * 
*/

/* Python wrapper */
static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self));

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

static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) {
  Py_ssize_t __pyx_r;

  /* "View.MemoryView":235
 * 
 *     def __len__(self):
 *         return self._shape[0]             # <<<<<<<<<<<<<<
 * 
 *     def __getattr__(self, attr):
*/
  __pyx_r = (__pyx_v_self->_shape[0]);
  goto __pyx_L0;

  /* "View.MemoryView":234
 *         return  memoryview(self, flags, self.dtype_is_object)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self._shape[0]
 * 
*/

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

/* "View.MemoryView":237
 *         return self._shape[0]
 * 
 *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
 *         return getattr(self.memview, attr)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/
static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));

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

static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getattr__", 0);

  /* "View.MemoryView":238
 * 
 *     def __getattr__(self, attr):
 *         return getattr(self.memview, attr)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, item):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":237
 *         return self._shape[0]
 * 
 *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
 *         return getattr(self.memview, attr)
 * 
*/

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

/* "View.MemoryView":240
 *         return getattr(self.memview, attr)
 * 
 *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
 *         return self.memview[item]
 * 
*/

/* Python wrapper */
static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));

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

static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "View.MemoryView":241
 * 
 *     def __getitem__(self, item):
 *         return self.memview[item]             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, item, value):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":240
 *         return getattr(self.memview, attr)
 * 
 *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
 *         return self.memview[item]
 * 
*/

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

/* "View.MemoryView":243
 *         return self.memview[item]
 * 
 *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
 *         self.memview[item] = value
 * 
*/

/* Python wrapper */
static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/
static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value));

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

static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "View.MemoryView":244
 * 
 *     def __setitem__(self, item, value):
 *         self.memview[item] = value             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely((PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0))) __PYX_ERR(1, 244, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "View.MemoryView":243
 *         return self.memview[item]
 * 
 *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
 *         self.memview[item] = value
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self));

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

static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 2, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v___pyx_state);

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

static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 4, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":253
 *         pass
 * 
 * @cname("__pyx_array_allocate_buffer")             # <<<<<<<<<<<<<<
 * cdef int _allocate_buffer(array self) except -1:
 * 
*/

static int __pyx_array_allocate_buffer(struct __pyx_array_obj *__pyx_v_self) {
  Py_ssize_t __pyx_v_i;
  PyObject **__pyx_v_p;
  int __pyx_r;
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "View.MemoryView":260
 *     cdef PyObject **p
 * 
 *     self.free_data = True             # <<<<<<<<<<<<<<
 *     self.data = <char *>malloc(self.len)
 *     if not self.data:
*/
  __pyx_v_self->free_data = 1;

  /* "View.MemoryView":261
 * 
 *     self.free_data = True
 *     self.data = <char *>malloc(self.len)             # <<<<<<<<<<<<<<
 *     if not self.data:
 *         raise MemoryError, "unable to allocate array data."
*/
  __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len));

  /* "View.MemoryView":262
 *     self.free_data = True
 *     self.data = <char *>malloc(self.len)
 *     if not self.data:             # <<<<<<<<<<<<<<
 *         raise MemoryError, "unable to allocate array data."
 * 
*/
  __pyx_t_1 = (!(__pyx_v_self->data != 0));
  if (unlikely(__pyx_t_1)) {

    /* "View.MemoryView":263
 *     self.data = <char *>malloc(self.len)
 *     if not self.data:
 *         raise MemoryError, "unable to allocate array data."             # <<<<<<<<<<<<<<
 * 
 *     if self.dtype_is_object:
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_MemoryError))), __pyx_mstate_global->__pyx_kp_u_unable_to_allocate_array_data, 0, 0);
    __PYX_ERR(1, 263, __pyx_L1_error)

    /* "View.MemoryView":262
 *     self.free_data = True
 *     self.data = <char *>malloc(self.len)
 *     if not self.data:             # <<<<<<<<<<<<<<
 *         raise MemoryError, "unable to allocate array data."
 * 
*/
  }

  /* "View.MemoryView":265
 *         raise MemoryError, "unable to allocate array data."
 * 
 *     if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *         p = <PyObject **> self.data
 *         for i in range(self.len // self.itemsize):
*/
  if (__pyx_v_self->dtype_is_object) {

    /* "View.MemoryView":266
 * 
 *     if self.dtype_is_object:
 *         p = <PyObject **> self.data             # <<<<<<<<<<<<<<
 *         for i in range(self.len // self.itemsize):
 *             p[i] = Py_None
*/
    __pyx_v_p = ((PyObject **)__pyx_v_self->data);

    /* "View.MemoryView":267
 *     if self.dtype_is_object:
 *         p = <PyObject **> self.data
 *         for i in range(self.len // self.itemsize):             # <<<<<<<<<<<<<<
 *             p[i] = Py_None
 *             Py_INCREF(Py_None)
*/
    if (unlikely(__pyx_v_self->itemsize == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      __PYX_ERR(1, 267, __pyx_L1_error)
    }
    else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_self->itemsize == (Py_ssize_t)-1)  && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) {
      PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
      __PYX_ERR(1, 267, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_self->itemsize, 0);
    __pyx_t_3 = __pyx_t_2;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "View.MemoryView":268
 *         p = <PyObject **> self.data
 *         for i in range(self.len // self.itemsize):
 *             p[i] = Py_None             # <<<<<<<<<<<<<<
 *             Py_INCREF(Py_None)
 *     return 0
*/
      (__pyx_v_p[__pyx_v_i]) = Py_None;

      /* "View.MemoryView":269
 *         for i in range(self.len // self.itemsize):
 *             p[i] = Py_None
 *             Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
      Py_INCREF(Py_None);
    }

    /* "View.MemoryView":265
 *         raise MemoryError, "unable to allocate array data."
 * 
 *     if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *         p = <PyObject **> self.data
 *         for i in range(self.len // self.itemsize):
*/
  }

  /* "View.MemoryView":270
 *             p[i] = Py_None
 *             Py_INCREF(Py_None)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "View.MemoryView":253
 *         pass
 * 
 * @cname("__pyx_array_allocate_buffer")             # <<<<<<<<<<<<<<
 * cdef int _allocate_buffer(array self) except -1:
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("View.MemoryView._allocate_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":273
 * 
 * 
 * @cname("__pyx_array_new")             # <<<<<<<<<<<<<<
 * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, const char *c_mode, char *buf):
 *     cdef array result
*/

static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char const *__pyx_v_c_mode, char *__pyx_v_buf) {
  struct __pyx_array_obj *__pyx_v_result = 0;
  PyObject *__pyx_v_mode = 0;
  struct __pyx_array_obj *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("array_cwrapper", 0);

  /* "View.MemoryView":276
 * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, const char *c_mode, char *buf):
 *     cdef array result
 *     cdef str mode = "fortran" if c_mode[0] == b'f' else "c"  # this often comes from a constant C string.             # <<<<<<<<<<<<<<
 * 
 *     if buf is NULL:
*/
  __pyx_t_2 = ((__pyx_v_c_mode[0]) == 'f');
  if (__pyx_t_2) {
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_fortran);
    __pyx_t_1 = __pyx_mstate_global->__pyx_n_u_fortran;
  } else {
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_c);
    __pyx_t_1 = __pyx_mstate_global->__pyx_n_u_c;
  }
  __pyx_v_mode = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":278
 *     cdef str mode = "fortran" if c_mode[0] == b'f' else "c"  # this often comes from a constant C string.
 * 
 *     if buf is NULL:             # <<<<<<<<<<<<<<
 *         result = array.__new__(array, shape, itemsize, format, mode)
 *     else:
*/
  __pyx_t_2 = (__pyx_v_buf == NULL);
  if (__pyx_t_2) {

    /* "View.MemoryView":279
 * 
 *     if buf is NULL:
 *         result = array.__new__(array, shape, itemsize, format, mode)             # <<<<<<<<<<<<<<
 *     else:
 *         result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False)
*/
    __pyx_t_1 = PyLong_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 279, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 279, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 279, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_shape);
    __Pyx_GIVEREF(__pyx_v_shape);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_shape) != (0)) __PYX_ERR(1, 279, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 279, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3) != (0)) __PYX_ERR(1, 279, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_mode);
    __Pyx_GIVEREF(__pyx_v_mode);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_mode) != (0)) __PYX_ERR(1, 279, __pyx_L1_error);
    __pyx_t_1 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_mstate_global->__pyx_array_type), __pyx_t_4, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 279, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "View.MemoryView":278
 *     cdef str mode = "fortran" if c_mode[0] == b'f' else "c"  # this often comes from a constant C string.
 * 
 *     if buf is NULL:             # <<<<<<<<<<<<<<
 *         result = array.__new__(array, shape, itemsize, format, mode)
 *     else:
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":281
 *         result = array.__new__(array, shape, itemsize, format, mode)
 *     else:
 *         result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False)             # <<<<<<<<<<<<<<
 *         result.data = buf
 * 
*/
  /*else*/ {
    __pyx_t_3 = PyLong_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 281, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 281, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 281, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_shape);
    __Pyx_GIVEREF(__pyx_v_shape);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_shape) != (0)) __PYX_ERR(1, 281, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3) != (0)) __PYX_ERR(1, 281, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4) != (0)) __PYX_ERR(1, 281, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_mode);
    __Pyx_GIVEREF(__pyx_v_mode);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_mode) != (0)) __PYX_ERR(1, 281, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 281, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_allocate_buffer, Py_False) < (0)) __PYX_ERR(1, 281, __pyx_L1_error)
    __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_mstate_global->__pyx_array_type), __pyx_t_1, __pyx_t_4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 281, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "View.MemoryView":282
 *     else:
 *         result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False)
 *         result.data = buf             # <<<<<<<<<<<<<<
 * 
 *     return result
*/
    __pyx_v_result->data = __pyx_v_buf;
  }
  __pyx_L3:;

  /* "View.MemoryView":284
 *         result.data = buf
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "View.MemoryView":273
 * 
 * 
 * @cname("__pyx_array_new")             # <<<<<<<<<<<<<<
 * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, const char *c_mode, char *buf):
 *     cdef array result
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_mode);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":310
 * cdef class Enum(object):
 *     cdef object name
 *     def __init__(self, name):             # <<<<<<<<<<<<<<
 *         self.name = name
 *     def __repr__(self):
*/

/* Python wrapper */
static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_name,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(1, 310, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 310, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(1, 310, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, i); __PYX_ERR(1, 310, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 310, __pyx_L3_error)
    }
    __pyx_v_name = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 310, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);

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

static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "View.MemoryView":311
 *     cdef object name
 *     def __init__(self, name):
 *         self.name = name             # <<<<<<<<<<<<<<
 *     def __repr__(self):
 *         return self.name
*/
  __Pyx_INCREF(__pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  __Pyx_GOTREF(__pyx_v_self->name);
  __Pyx_DECREF(__pyx_v_self->name);
  __pyx_v_self->name = __pyx_v_name;

  /* "View.MemoryView":310
 * cdef class Enum(object):
 *     cdef object name
 *     def __init__(self, name):             # <<<<<<<<<<<<<<
 *         self.name = name
 *     def __repr__(self):
*/

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

/* "View.MemoryView":312
 *     def __init__(self, name):
 *         self.name = name
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return self.name
 * 
*/

/* Python wrapper */
static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));

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

static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "View.MemoryView":313
 *         self.name = name
 *     def __repr__(self):
 *         return self.name             # <<<<<<<<<<<<<<
 * 
 * cdef generic = Enum("<strided and direct or indirect>")
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->name);
  __pyx_r = __pyx_v_self->name;
  goto __pyx_L0;

  /* "View.MemoryView":312
 *     def __init__(self, name):
 *         self.name = name
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return self.name
 * 
*/

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

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/

/* Python wrapper */
static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));

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

static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.name,)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:
*/
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_self->name);
  __Pyx_GIVEREF(__pyx_v_self->name);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name) != (0)) __PYX_ERR(1, 5, __pyx_L1_error);
  __pyx_v_state = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.name,)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None and _dict:
 *         state += (_dict,)
*/
  __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = (self.name,)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
  __pyx_t_3 = (__pyx_v__dict != Py_None);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v__dict); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 7, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
*/
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict) != (0)) __PYX_ERR(1, 8, __pyx_L1_error);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None and _dict:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.name is not None
*/
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.name,)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.name is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state
*/
  /*else*/ {
    __pyx_t_2 = (__pyx_v_self->name != Py_None);
    __pyx_v_use_setstate = __pyx_t_2;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.name is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state
 *     else:
*/
  if (__pyx_v_use_setstate) {

    /* "(tree fragment)":13
 *         use_setstate = self.name is not None
 *     if use_setstate:
 *         return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_Enum, (type(self), 0x82a3537, state)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_136983863);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_136983863);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_136983863) != (0)) __PYX_ERR(1, 13, __pyx_L1_error);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None) != (0)) __PYX_ERR(1, 13, __pyx_L1_error);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(1, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 13, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.name is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state
 *     else:
*/
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state
 *     else:
 *         return __pyx_unpickle_Enum, (type(self), 0x82a3537, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_136983863);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_136983863);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_136983863) != (0)) __PYX_ERR(1, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 15, __pyx_L1_error);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5) != (0)) __PYX_ERR(1, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 15, __pyx_L1_error);
    __pyx_t_5 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_Enum, (type(self), 0x82a3537, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
*/

/* Python wrapper */
static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(1, 16, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 16, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 16, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 16, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 16, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 16, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v___pyx_state);

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

static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_Enum, (type(self), 0x82a3537, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Enum__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
*/
  __pyx_t_1 = __pyx_v___pyx_state;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(1, 17, __pyx_L1_error)
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'");
    __PYX_ERR(1, 17, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_Enum, (type(self), 0x82a3537, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":356
 *     cdef const __Pyx_TypeInfo *typeinfo
 * 
 *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
 *         self.obj = obj
 *         self.flags = flags
*/

/* Python wrapper */
static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_obj = 0;
  int __pyx_v_flags;
  int __pyx_v_dtype_is_object;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_obj,&__pyx_mstate_global->__pyx_n_u_flags,&__pyx_mstate_global->__pyx_n_u_dtype_is_object,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(1, 356, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 356, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 356, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 356, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(1, 356, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, i); __PYX_ERR(1, 356, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 356, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 356, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 356, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_obj = values[0];
    __pyx_v_flags = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 356, __pyx_L3_error)
    if (values[2]) {
      __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 356, __pyx_L3_error)
    } else {
      __pyx_v_dtype_is_object = ((int)0);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, __pyx_nargs); __PYX_ERR(1, 356, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object);

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

static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "View.MemoryView":357
 * 
 *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
 *         self.obj = obj             # <<<<<<<<<<<<<<
 *         self.flags = flags
 *         if type(self) is memoryview or obj is not None:
*/
  __Pyx_INCREF(__pyx_v_obj);
  __Pyx_GIVEREF(__pyx_v_obj);
  __Pyx_GOTREF(__pyx_v_self->obj);
  __Pyx_DECREF(__pyx_v_self->obj);
  __pyx_v_self->obj = __pyx_v_obj;

  /* "View.MemoryView":358
 *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
 *         self.obj = obj
 *         self.flags = flags             # <<<<<<<<<<<<<<
 *         if type(self) is memoryview or obj is not None:
 *             PyObject_GetBuffer(obj, &self.view, flags)
*/
  __pyx_v_self->flags = __pyx_v_flags;

  /* "View.MemoryView":359
 *         self.obj = obj
 *         self.flags = flags
 *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
 *             PyObject_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:
*/
  __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_mstate_global->__pyx_memoryview_type));
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_obj != Py_None);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "View.MemoryView":360
 *         self.flags = flags
 *         if type(self) is memoryview or obj is not None:
 *             PyObject_GetBuffer(obj, &self.view, flags)             # <<<<<<<<<<<<<<
 *             if <PyObject *> self.view.obj == NULL:
 *                 (<__pyx_buffer *> &self.view).obj = Py_None
*/
    __pyx_t_3 = PyObject_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 360, __pyx_L1_error)

    /* "View.MemoryView":361
 *         if type(self) is memoryview or obj is not None:
 *             PyObject_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
 *                 (<__pyx_buffer *> &self.view).obj = Py_None
 *                 Py_INCREF(Py_None)
*/
    __pyx_t_1 = (((PyObject *)__pyx_v_self->view.obj) == NULL);
    if (__pyx_t_1) {

      /* "View.MemoryView":362
 *             PyObject_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:
 *                 (<__pyx_buffer *> &self.view).obj = Py_None             # <<<<<<<<<<<<<<
 *                 Py_INCREF(Py_None)
 * 
*/
      ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;

      /* "View.MemoryView":363
 *             if <PyObject *> self.view.obj == NULL:
 *                 (<__pyx_buffer *> &self.view).obj = Py_None
 *                 Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
 * 
 *         if not __PYX_CYTHON_ATOMICS_ENABLED():
*/
      Py_INCREF(Py_None);

      /* "View.MemoryView":361
 *         if type(self) is memoryview or obj is not None:
 *             PyObject_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
 *                 (<__pyx_buffer *> &self.view).obj = Py_None
 *                 Py_INCREF(Py_None)
*/
    }

    /* "View.MemoryView":359
 *         self.obj = obj
 *         self.flags = flags
 *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
 *             PyObject_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:
*/
  }

  /* "View.MemoryView":365
 *                 Py_INCREF(Py_None)
 * 
 *         if not __PYX_CYTHON_ATOMICS_ENABLED():             # <<<<<<<<<<<<<<
 *             global __pyx_memoryview_thread_locks_used
 *             if (__pyx_memoryview_thread_locks_used < 8 and
*/
  __pyx_t_1 = (!__PYX_CYTHON_ATOMICS_ENABLED());
  if (__pyx_t_1) {

    /* "View.MemoryView":367
 *         if not __PYX_CYTHON_ATOMICS_ENABLED():
 *             global __pyx_memoryview_thread_locks_used
 *             if (__pyx_memoryview_thread_locks_used < 8 and             # <<<<<<<<<<<<<<
 * 
 *                     not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()):
*/
    __pyx_t_2 = (__pyx_memoryview_thread_locks_used < 8);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L9_bool_binop_done;
    }

    /* "View.MemoryView":369
 *             if (__pyx_memoryview_thread_locks_used < 8 and
 * 
 *                     not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()):             # <<<<<<<<<<<<<<
 *                 self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
 *                 __pyx_memoryview_thread_locks_used += 1
*/
    __pyx_t_2 = (!__PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING());
    __pyx_t_1 = __pyx_t_2;
    __pyx_L9_bool_binop_done:;

    /* "View.MemoryView":367
 *         if not __PYX_CYTHON_ATOMICS_ENABLED():
 *             global __pyx_memoryview_thread_locks_used
 *             if (__pyx_memoryview_thread_locks_used < 8 and             # <<<<<<<<<<<<<<
 * 
 *                     not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()):
*/
    if (__pyx_t_1) {

      /* "View.MemoryView":370
 * 
 *                     not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()):
 *                 self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]             # <<<<<<<<<<<<<<
 *                 __pyx_memoryview_thread_locks_used += 1
 *             if self.lock is NULL:
*/
      __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);

      /* "View.MemoryView":371
 *                     not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()):
 *                 self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
 *                 __pyx_memoryview_thread_locks_used += 1             # <<<<<<<<<<<<<<
 *             if self.lock is NULL:
 *                 self.lock = PyThread_allocate_lock()
*/
      __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);

      /* "View.MemoryView":367
 *         if not __PYX_CYTHON_ATOMICS_ENABLED():
 *             global __pyx_memoryview_thread_locks_used
 *             if (__pyx_memoryview_thread_locks_used < 8 and             # <<<<<<<<<<<<<<
 * 
 *                     not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()):
*/
    }

    /* "View.MemoryView":372
 *                 self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
 *                 __pyx_memoryview_thread_locks_used += 1
 *             if self.lock is NULL:             # <<<<<<<<<<<<<<
 *                 self.lock = PyThread_allocate_lock()
 *                 if self.lock is NULL:
*/
    __pyx_t_1 = (__pyx_v_self->lock == NULL);
    if (__pyx_t_1) {

      /* "View.MemoryView":373
 *                 __pyx_memoryview_thread_locks_used += 1
 *             if self.lock is NULL:
 *                 self.lock = PyThread_allocate_lock()             # <<<<<<<<<<<<<<
 *                 if self.lock is NULL:
 *                     raise MemoryError
*/
      __pyx_v_self->lock = PyThread_allocate_lock();

      /* "View.MemoryView":374
 *             if self.lock is NULL:
 *                 self.lock = PyThread_allocate_lock()
 *                 if self.lock is NULL:             # <<<<<<<<<<<<<<
 *                     raise MemoryError
 * 
*/
      __pyx_t_1 = (__pyx_v_self->lock == NULL);
      if (unlikely(__pyx_t_1)) {

        /* "View.MemoryView":375
 *                 self.lock = PyThread_allocate_lock()
 *                 if self.lock is NULL:
 *                     raise MemoryError             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_FORMAT:
*/
        PyErr_NoMemory(); __PYX_ERR(1, 375, __pyx_L1_error)

        /* "View.MemoryView":374
 *             if self.lock is NULL:
 *                 self.lock = PyThread_allocate_lock()
 *                 if self.lock is NULL:             # <<<<<<<<<<<<<<
 *                     raise MemoryError
 * 
*/
      }

      /* "View.MemoryView":372
 *                 self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
 *                 __pyx_memoryview_thread_locks_used += 1
 *             if self.lock is NULL:             # <<<<<<<<<<<<<<
 *                 self.lock = PyThread_allocate_lock()
 *                 if self.lock is NULL:
*/
    }

    /* "View.MemoryView":365
 *                 Py_INCREF(Py_None)
 * 
 *         if not __PYX_CYTHON_ATOMICS_ENABLED():             # <<<<<<<<<<<<<<
 *             global __pyx_memoryview_thread_locks_used
 *             if (__pyx_memoryview_thread_locks_used < 8 and
*/
  }

  /* "View.MemoryView":377
 *                     raise MemoryError
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
 *         else:
*/
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":378
 * 
 *         if flags & PyBUF_FORMAT:
 *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')             # <<<<<<<<<<<<<<
 *         else:
 *             self.dtype_is_object = dtype_is_object
*/
    __pyx_t_2 = ((__pyx_v_self->view.format[0]) == 'O');
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L14_bool_binop_done;
    }
    __pyx_t_2 = ((__pyx_v_self->view.format[1]) == '\x00');
    __pyx_t_1 = __pyx_t_2;
    __pyx_L14_bool_binop_done:;
    __pyx_v_self->dtype_is_object = __pyx_t_1;

    /* "View.MemoryView":377
 *                     raise MemoryError
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
 *         else:
*/
    goto __pyx_L13;
  }

  /* "View.MemoryView":380
 *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
 *         else:
 *             self.dtype_is_object = dtype_is_object             # <<<<<<<<<<<<<<
 * 
 *         with cython.cdivision(True):
*/
  /*else*/ {
    __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
  }
  __pyx_L13:;

  /* "View.MemoryView":383
 * 
 *         with cython.cdivision(True):
 *             assert <Py_intptr_t>(&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0             # <<<<<<<<<<<<<<
 *         self.typeinfo = NULL
 * 
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = ((((Py_intptr_t)(&__pyx_v_self->acquisition_count)) % (sizeof(__pyx_atomic_int_type))) == 0);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
      __PYX_ERR(1, 383, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(1, 383, __pyx_L1_error)
  #endif

  /* "View.MemoryView":384
 *         with cython.cdivision(True):
 *             assert <Py_intptr_t>(&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0
 *         self.typeinfo = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(memoryview self):
*/
  __pyx_v_self->typeinfo = NULL;

  /* "View.MemoryView":356
 *     cdef const __Pyx_TypeInfo *typeinfo
 * 
 *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
 *         self.obj = obj
 *         self.flags = flags
*/

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

/* "View.MemoryView":386
 *         self.typeinfo = NULL
 * 
 *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
 *         if self.obj is not None:
 *             PyBuffer_Release(&self.view)
*/

/* Python wrapper */
static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
  int __pyx_v_i;
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyThread_type_lock __pyx_t_5;
  PyThread_type_lock __pyx_t_6;

  /* "View.MemoryView":387
 * 
 *     def __dealloc__(memoryview self):
 *         if self.obj is not None:             # <<<<<<<<<<<<<<
 *             PyBuffer_Release(&self.view)
 *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
*/
  __pyx_t_1 = (__pyx_v_self->obj != Py_None);
  if (__pyx_t_1) {

    /* "View.MemoryView":388
 *     def __dealloc__(memoryview self):
 *         if self.obj is not None:
 *             PyBuffer_Release(&self.view)             # <<<<<<<<<<<<<<
 *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
 * 
*/
    PyBuffer_Release((&__pyx_v_self->view));

    /* "View.MemoryView":387
 * 
 *     def __dealloc__(memoryview self):
 *         if self.obj is not None:             # <<<<<<<<<<<<<<
 *             PyBuffer_Release(&self.view)
 *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":389
 *         if self.obj is not None:
 *             PyBuffer_Release(&self.view)
 *         elif (<__pyx_buffer *> &self.view).obj == Py_None:             # <<<<<<<<<<<<<<
 * 
 *             (<__pyx_buffer *> &self.view).obj = NULL
*/
  __pyx_t_1 = (((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None);
  if (__pyx_t_1) {

    /* "View.MemoryView":391
 *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
 * 
 *             (<__pyx_buffer *> &self.view).obj = NULL             # <<<<<<<<<<<<<<
 *             Py_DECREF(Py_None)
 * 
*/
    ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL;

    /* "View.MemoryView":392
 * 
 *             (<__pyx_buffer *> &self.view).obj = NULL
 *             Py_DECREF(Py_None)             # <<<<<<<<<<<<<<
 * 
 *         cdef int i
*/
    Py_DECREF(Py_None);

    /* "View.MemoryView":389
 *         if self.obj is not None:
 *             PyBuffer_Release(&self.view)
 *         elif (<__pyx_buffer *> &self.view).obj == Py_None:             # <<<<<<<<<<<<<<
 * 
 *             (<__pyx_buffer *> &self.view).obj = NULL
*/
  }
  __pyx_L3:;

  /* "View.MemoryView":396
 *         cdef int i
 *         global __pyx_memoryview_thread_locks_used
 *         if self.lock != NULL:             # <<<<<<<<<<<<<<
 *             for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
*/
  __pyx_t_1 = (__pyx_v_self->lock != NULL);
  if (__pyx_t_1) {

    /* "View.MemoryView":397
 *         global __pyx_memoryview_thread_locks_used
 *         if self.lock != NULL:
 *             for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used):             # <<<<<<<<<<<<<<
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 *                     __pyx_memoryview_thread_locks_used -= 1
*/
    __pyx_t_1 = __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING();
    if (__pyx_t_1) {
      __pyx_t_2 = 0;
    } else {
      __pyx_t_2 = __pyx_memoryview_thread_locks_used;
    }
    __pyx_t_3 = __pyx_t_2;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "View.MemoryView":398
 *         if self.lock != NULL:
 *             for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:
*/
      __pyx_t_1 = ((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock);
      if (__pyx_t_1) {

        /* "View.MemoryView":399
 *             for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 *                     __pyx_memoryview_thread_locks_used -= 1             # <<<<<<<<<<<<<<
 *                     if i != __pyx_memoryview_thread_locks_used:
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
*/
        __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);

        /* "View.MemoryView":400
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
*/
        __pyx_t_1 = (__pyx_v_i != __pyx_memoryview_thread_locks_used);
        if (__pyx_t_1) {

          /* "View.MemoryView":402
 *                     if i != __pyx_memoryview_thread_locks_used:
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])             # <<<<<<<<<<<<<<
 *                     break
 *             else:
*/
          __pyx_t_5 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
          __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_v_i]);

          /* "View.MemoryView":401
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (             # <<<<<<<<<<<<<<
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
 *                     break
*/
          (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_5;
          (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_6;

          /* "View.MemoryView":400
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
*/
        }

        /* "View.MemoryView":403
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
 *                     break             # <<<<<<<<<<<<<<
 *             else:
 *                 PyThread_free_lock(self.lock)
*/
        goto __pyx_L6_break;

        /* "View.MemoryView":398
 *         if self.lock != NULL:
 *             for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:
*/
      }
    }
    /*else*/ {

      /* "View.MemoryView":405
 *                     break
 *             else:
 *                 PyThread_free_lock(self.lock)             # <<<<<<<<<<<<<<
 * 
 *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
*/
      PyThread_free_lock(__pyx_v_self->lock);
    }
    __pyx_L6_break:;

    /* "View.MemoryView":396
 *         cdef int i
 *         global __pyx_memoryview_thread_locks_used
 *         if self.lock != NULL:             # <<<<<<<<<<<<<<
 *             for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
*/
  }

  /* "View.MemoryView":386
 *         self.typeinfo = NULL
 * 
 *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
 *         if self.obj is not None:
 *             PyBuffer_Release(&self.view)
*/

  /* function exit code */
}

/* "View.MemoryView":407
 *                 PyThread_free_lock(self.lock)
 * 
 *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t dim
 *         cdef char *itemp = <char *> self.view.buf
*/

static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
  Py_ssize_t __pyx_v_dim;
  char *__pyx_v_itemp;
  PyObject *__pyx_v_idx = NULL;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  char *__pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_item_pointer", 0);

  /* "View.MemoryView":409
 *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
 *         cdef Py_ssize_t dim
 *         cdef char *itemp = <char *> self.view.buf             # <<<<<<<<<<<<<<
 * 
 *         for dim, idx in enumerate(index):
*/
  __pyx_v_itemp = ((char *)__pyx_v_self->view.buf);

  /* "View.MemoryView":411
 *         cdef char *itemp = <char *> self.view.buf
 * 
 *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
 *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
 * 
*/
  __pyx_t_1 = 0;
  if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
    __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 411, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 411, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 411, __pyx_L1_error)
          #endif
          if (__pyx_t_3 >= __pyx_temp) break;
        }
        __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_3;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 411, __pyx_L1_error)
          #endif
          if (__pyx_t_3 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3));
        #else
        __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3);
        #endif
        ++__pyx_t_3;
      }
      if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 411, __pyx_L1_error)
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 411, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_v_dim = __pyx_t_1;
    __pyx_t_1 = (__pyx_t_1 + 1);

    /* "View.MemoryView":412
 * 
 *         for dim, idx in enumerate(index):
 *             itemp = pybuffer_index(&self.view, itemp, idx, dim)             # <<<<<<<<<<<<<<
 * 
 *         return itemp
*/
    __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 412, __pyx_L1_error)
    __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(1, 412, __pyx_L1_error)
    __pyx_v_itemp = __pyx_t_7;

    /* "View.MemoryView":411
 *         cdef char *itemp = <char *> self.view.buf
 * 
 *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
 *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
 * 
*/
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "View.MemoryView":414
 *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
 * 
 *         return itemp             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = __pyx_v_itemp;
  goto __pyx_L0;

  /* "View.MemoryView":407
 *                 PyThread_free_lock(self.lock)
 * 
 *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t dim
 *         cdef char *itemp = <char *> self.view.buf
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_idx);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":417
 * 
 * 
 *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
 *         if index is Ellipsis:
 *             return self
*/

/* Python wrapper */
static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));

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

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
  PyObject *__pyx_v_have_slices = NULL;
  PyObject *__pyx_v_indices = NULL;
  char *__pyx_v_itemp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  char *__pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "View.MemoryView":418
 * 
 *     def __getitem__(memoryview self, object index):
 *         if index is Ellipsis:             # <<<<<<<<<<<<<<
 *             return self
 * 
*/
  __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
  if (__pyx_t_1) {

    /* "View.MemoryView":419
 *     def __getitem__(memoryview self, object index):
 *         if index is Ellipsis:
 *             return self             # <<<<<<<<<<<<<<
 * 
 *         have_slices, indices = _unellipsify(index, self.view.ndim)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF((PyObject *)__pyx_v_self);
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;

    /* "View.MemoryView":418
 * 
 *     def __getitem__(memoryview self, object index):
 *         if index is Ellipsis:             # <<<<<<<<<<<<<<
 *             return self
 * 
*/
  }

  /* "View.MemoryView":421
 *             return self
 * 
 *         have_slices, indices = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
 * 
 *         cdef char *itemp
*/
  __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (likely(__pyx_t_2 != Py_None)) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(1, 421, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 421, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 421, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 421, __pyx_L1_error)
  }
  __pyx_v_have_slices = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_indices = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "View.MemoryView":424
 * 
 *         cdef char *itemp
 *         if have_slices:             # <<<<<<<<<<<<<<
 *             return memview_slice(self, indices)
 *         else:
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 424, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "View.MemoryView":425
 *         cdef char *itemp
 *         if have_slices:
 *             return memview_slice(self, indices)             # <<<<<<<<<<<<<<
 *         else:
 *             itemp = self.get_item_pointer(indices)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 425, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "View.MemoryView":424
 * 
 *         cdef char *itemp
 *         if have_slices:             # <<<<<<<<<<<<<<
 *             return memview_slice(self, indices)
 *         else:
*/
  }

  /* "View.MemoryView":427
 *             return memview_slice(self, indices)
 *         else:
 *             itemp = self.get_item_pointer(indices)             # <<<<<<<<<<<<<<
 *             return self.convert_item_to_object(itemp)
 * 
*/
  /*else*/ {
    __pyx_t_5 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_5 == ((void *)NULL))) __PYX_ERR(1, 427, __pyx_L1_error)
    __pyx_v_itemp = __pyx_t_5;

    /* "View.MemoryView":428
 *         else:
 *             itemp = self.get_item_pointer(indices)
 *             return self.convert_item_to_object(itemp)             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(memoryview self, object index, object value):
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 428, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "View.MemoryView":417
 * 
 * 
 *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
 *         if index is Ellipsis:
 *             return self
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_have_slices);
  __Pyx_XDECREF(__pyx_v_indices);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":430
 *             return self.convert_item_to_object(itemp)
 * 
 *     def __setitem__(memoryview self, object index, object value):             # <<<<<<<<<<<<<<
 *         if self.view.readonly:
 *             raise TypeError, "Cannot assign to read-only memoryview"
*/

/* Python wrapper */
static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value));

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

static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_have_slices = NULL;
  PyObject *__pyx_v_obj = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);
  __Pyx_INCREF(__pyx_v_index);

  /* "View.MemoryView":431
 * 
 *     def __setitem__(memoryview self, object index, object value):
 *         if self.view.readonly:             # <<<<<<<<<<<<<<
 *             raise TypeError, "Cannot assign to read-only memoryview"
 * 
*/
  if (unlikely(__pyx_v_self->view.readonly)) {

    /* "View.MemoryView":432
 *     def __setitem__(memoryview self, object index, object value):
 *         if self.view.readonly:
 *             raise TypeError, "Cannot assign to read-only memoryview"             # <<<<<<<<<<<<<<
 * 
 *         have_slices, index = _unellipsify(index, self.view.ndim)
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_Cannot_assign_to_read_only_memor, 0, 0);
    __PYX_ERR(1, 432, __pyx_L1_error)

    /* "View.MemoryView":431
 * 
 *     def __setitem__(memoryview self, object index, object value):
 *         if self.view.readonly:             # <<<<<<<<<<<<<<
 *             raise TypeError, "Cannot assign to read-only memoryview"
 * 
*/
  }

  /* "View.MemoryView":434
 *             raise TypeError, "Cannot assign to read-only memoryview"
 * 
 *         have_slices, index = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
 * 
 *         if have_slices:
*/
  __pyx_t_1 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 434, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(1, 434, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 434, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 434, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 434, __pyx_L1_error)
  }
  __pyx_v_have_slices = __pyx_t_2;
  __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "View.MemoryView":436
 *         have_slices, index = _unellipsify(index, self.view.ndim)
 * 
 *         if have_slices:             # <<<<<<<<<<<<<<
 *             obj = self.is_slice(value)
 *             if obj is not None:
*/
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 436, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "View.MemoryView":437
 * 
 *         if have_slices:
 *             obj = self.is_slice(value)             # <<<<<<<<<<<<<<
 *             if obj is not None:
 *                 self.setitem_slice_assignment(self[index], obj)
*/
    __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 437, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_obj = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "View.MemoryView":438
 *         if have_slices:
 *             obj = self.is_slice(value)
 *             if obj is not None:             # <<<<<<<<<<<<<<
 *                 self.setitem_slice_assignment(self[index], obj)
 *             else:
*/
    __pyx_t_4 = (__pyx_v_obj != Py_None);
    if (__pyx_t_4) {

      /* "View.MemoryView":439
 *             obj = self.is_slice(value)
 *             if obj is not None:
 *                 self.setitem_slice_assignment(self[index], obj)             # <<<<<<<<<<<<<<
 *             else:
 *                 self.setitem_slice_assign_scalar(self[index], value)
*/
      __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 439, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_1, __pyx_v_obj); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 439, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "View.MemoryView":438
 *         if have_slices:
 *             obj = self.is_slice(value)
 *             if obj is not None:             # <<<<<<<<<<<<<<
 *                 self.setitem_slice_assignment(self[index], obj)
 *             else:
*/
      goto __pyx_L5;
    }

    /* "View.MemoryView":441
 *                 self.setitem_slice_assignment(self[index], obj)
 *             else:
 *                 self.setitem_slice_assign_scalar(self[index], value)             # <<<<<<<<<<<<<<
 *         else:
 *             self.setitem_indexed(index, value)
*/
    /*else*/ {
      __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 441, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 441, __pyx_L1_error)
      __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_3), __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 441, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __pyx_L5:;

    /* "View.MemoryView":436
 *         have_slices, index = _unellipsify(index, self.view.ndim)
 * 
 *         if have_slices:             # <<<<<<<<<<<<<<
 *             obj = self.is_slice(value)
 *             if obj is not None:
*/
    goto __pyx_L4;
  }

  /* "View.MemoryView":443
 *                 self.setitem_slice_assign_scalar(self[index], value)
 *         else:
 *             self.setitem_indexed(index, value)             # <<<<<<<<<<<<<<
 * 
 *     cdef is_slice(self, obj):
*/
  /*else*/ {
    __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 443, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L4:;

  /* "View.MemoryView":430
 *             return self.convert_item_to_object(itemp)
 * 
 *     def __setitem__(memoryview self, object index, object value):             # <<<<<<<<<<<<<<
 *         if self.view.readonly:
 *             raise TypeError, "Cannot assign to read-only memoryview"
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_have_slices);
  __Pyx_XDECREF(__pyx_v_obj);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":445
 *             self.setitem_indexed(index, value)
 * 
 *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
 *         if not isinstance(obj, memoryview):
 *             try:
*/

static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  size_t __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_slice", 0);
  __Pyx_INCREF(__pyx_v_obj);

  /* "View.MemoryView":446
 * 
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
 *             try:
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_mstate_global->__pyx_memoryview_type); 
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "View.MemoryView":447
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):
 *             try:             # <<<<<<<<<<<<<<
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)
*/
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      /*try:*/ {

        /* "View.MemoryView":448
 *         if not isinstance(obj, memoryview):
 *             try:
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
 *                                  self.dtype_is_object)
 *             except TypeError:
*/
        __pyx_t_7 = NULL;
        __pyx_t_8 = __Pyx_PyLong_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 448, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_8);

        /* "View.MemoryView":449
 *             try:
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)             # <<<<<<<<<<<<<<
 *             except TypeError:
 *                 return None
*/
        __pyx_t_9 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 449, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_10 = 1;
        {
          PyObject *__pyx_callargs[4] = {__pyx_t_7, __pyx_v_obj, __pyx_t_8, __pyx_t_9};
          __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_memoryview_type, __pyx_callargs+__pyx_t_10, (4-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 448, __pyx_L4_error)
          __Pyx_GOTREF((PyObject *)__pyx_t_6);
        }
        __Pyx_DECREF_SET(__pyx_v_obj, ((PyObject *)__pyx_t_6));
        __pyx_t_6 = 0;

        /* "View.MemoryView":447
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):
 *             try:             # <<<<<<<<<<<<<<
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)
*/
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L9_try_end;
      __pyx_L4_error:;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "View.MemoryView":450
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)
 *             except TypeError:             # <<<<<<<<<<<<<<
 *                 return None
 * 
*/
      __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_TypeError))));
      if (__pyx_t_11) {
        __Pyx_ErrRestore(0,0,0);

        /* "View.MemoryView":451
 *                                  self.dtype_is_object)
 *             except TypeError:
 *                 return None             # <<<<<<<<<<<<<<
 * 
 *         return obj
*/
        __Pyx_XDECREF(__pyx_r);
        __pyx_r = Py_None; __Pyx_INCREF(Py_None);
        goto __pyx_L7_except_return;
      }
      goto __pyx_L6_except_error;

      /* "View.MemoryView":447
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):
 *             try:             # <<<<<<<<<<<<<<
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)
*/
      __pyx_L6_except_error:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L1_error;
      __pyx_L7_except_return:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L0;
      __pyx_L9_try_end:;
    }

    /* "View.MemoryView":446
 * 
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
 *             try:
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
*/
  }

  /* "View.MemoryView":453
 *                 return None
 * 
 *         return obj             # <<<<<<<<<<<<<<
 * 
 *     cdef setitem_slice_assignment(self, dst, src):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_obj);
  __pyx_r = __pyx_v_obj;
  goto __pyx_L0;

  /* "View.MemoryView":445
 *             self.setitem_indexed(index, value)
 * 
 *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
 *         if not isinstance(obj, memoryview):
 *             try:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_obj);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":455
 *         return obj
 * 
 *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice dst_slice
 *         cdef __Pyx_memviewslice src_slice
*/

static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
  __Pyx_memviewslice __pyx_v_dst_slice;
  __Pyx_memviewslice __pyx_v_src_slice;
  __Pyx_memviewslice __pyx_v_msrc;
  __Pyx_memviewslice __pyx_v_mdst;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setitem_slice_assignment", 0);

  /* "View.MemoryView":458
 *         cdef __Pyx_memviewslice dst_slice
 *         cdef __Pyx_memviewslice src_slice
 *         cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0]             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0]
 * 
*/
  if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 458, __pyx_L1_error)
  __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 458, __pyx_L1_error)
  __pyx_v_msrc = (__pyx_t_1[0]);

  /* "View.MemoryView":459
 *         cdef __Pyx_memviewslice src_slice
 *         cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0]
 *         cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0]             # <<<<<<<<<<<<<<
 * 
 *         memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object)
*/
  if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 459, __pyx_L1_error)
  __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 459, __pyx_L1_error)
  __pyx_v_mdst = (__pyx_t_1[0]);

  /* "View.MemoryView":461
 *         cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0]
 * 
 *         memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
*/
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyLong_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 461, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyLong_As_int(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 461, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __pyx_memoryview_copy_contents(__pyx_v_msrc, __pyx_v_mdst, __pyx_t_3, __pyx_t_4, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 461, __pyx_L1_error)

  /* "View.MemoryView":455
 *         return obj
 * 
 *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice dst_slice
 *         cdef __Pyx_memviewslice src_slice
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":463
 *         memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object)
 * 
 *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
 *         cdef int array[128]
 *         cdef void *tmp = NULL
*/

static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) {
  int __pyx_v_array[128];
  void *__pyx_v_tmp;
  void *__pyx_v_item;
  __Pyx_memviewslice *__pyx_v_dst_slice;
  __Pyx_memviewslice __pyx_v_tmp_slice;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  char const *__pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0);

  /* "View.MemoryView":465
 *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
 *         cdef int array[128]
 *         cdef void *tmp = NULL             # <<<<<<<<<<<<<<
 *         cdef void *item
 * 
*/
  __pyx_v_tmp = NULL;

  /* "View.MemoryView":470
 *         cdef __Pyx_memviewslice *dst_slice
 *         cdef __Pyx_memviewslice tmp_slice
 *         dst_slice = get_slice_from_memview(dst, &tmp_slice)             # <<<<<<<<<<<<<<
 * 
 *         if <size_t>self.view.itemsize > sizeof(array):
*/
  __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 470, __pyx_L1_error)
  __pyx_v_dst_slice = __pyx_t_1;

  /* "View.MemoryView":472
 *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
 * 
 *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:
*/
  __pyx_t_2 = (((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array)));
  if (__pyx_t_2) {

    /* "View.MemoryView":473
 * 
 *         if <size_t>self.view.itemsize > sizeof(array):
 *             tmp = PyMem_Malloc(self.view.itemsize)             # <<<<<<<<<<<<<<
 *             if tmp == NULL:
 *                 raise MemoryError
*/
    __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);

    /* "View.MemoryView":474
 *         if <size_t>self.view.itemsize > sizeof(array):
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 *             item = tmp
*/
    __pyx_t_2 = (__pyx_v_tmp == NULL);
    if (unlikely(__pyx_t_2)) {

      /* "View.MemoryView":475
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:
 *                 raise MemoryError             # <<<<<<<<<<<<<<
 *             item = tmp
 *         else:
*/
      PyErr_NoMemory(); __PYX_ERR(1, 475, __pyx_L1_error)

      /* "View.MemoryView":474
 *         if <size_t>self.view.itemsize > sizeof(array):
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 *             item = tmp
*/
    }

    /* "View.MemoryView":476
 *             if tmp == NULL:
 *                 raise MemoryError
 *             item = tmp             # <<<<<<<<<<<<<<
 *         else:
 *             item = <void *> array
*/
    __pyx_v_item = __pyx_v_tmp;

    /* "View.MemoryView":472
 *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
 * 
 *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":478
 *             item = tmp
 *         else:
 *             item = <void *> array             # <<<<<<<<<<<<<<
 * 
 *         try:
*/
  /*else*/ {
    __pyx_v_item = ((void *)__pyx_v_array);
  }
  __pyx_L3:;

  /* "View.MemoryView":480
 *             item = <void *> array
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             if self.dtype_is_object:
 *                 (<PyObject **> item)[0] = <PyObject *> value
*/
  /*try:*/ {

    /* "View.MemoryView":481
 * 
 *         try:
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 (<PyObject **> item)[0] = <PyObject *> value
 *             else:
*/
    if (__pyx_v_self->dtype_is_object) {

      /* "View.MemoryView":482
 *         try:
 *             if self.dtype_is_object:
 *                 (<PyObject **> item)[0] = <PyObject *> value             # <<<<<<<<<<<<<<
 *             else:
 *                 self.assign_item_from_object(<char *> item, value)
*/
      (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);

      /* "View.MemoryView":481
 * 
 *         try:
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 (<PyObject **> item)[0] = <PyObject *> value
 *             else:
*/
      goto __pyx_L8;
    }

    /* "View.MemoryView":484
 *                 (<PyObject **> item)[0] = <PyObject *> value
 *             else:
 *                 self.assign_item_from_object(<char *> item, value)             # <<<<<<<<<<<<<<
 * 
 * 
*/
    /*else*/ {
      __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 484, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __pyx_L8:;

    /* "View.MemoryView":488
 * 
 * 
 *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
 *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
 *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
*/
    __pyx_t_2 = (__pyx_v_self->view.suboffsets != NULL);
    if (__pyx_t_2) {

      /* "View.MemoryView":489
 * 
 *             if self.view.suboffsets != NULL:
 *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)             # <<<<<<<<<<<<<<
 *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
 *                                 item, self.dtype_is_object)
*/
      __pyx_t_4 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 489, __pyx_L6_error)

      /* "View.MemoryView":488
 * 
 * 
 *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
 *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
 *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
*/
    }

    /* "View.MemoryView":490
 *             if self.view.suboffsets != NULL:
 *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
 *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,             # <<<<<<<<<<<<<<
 *                                 item, self.dtype_is_object)
 *         finally:
*/
    __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object);
  }

  /* "View.MemoryView":493
 *                                 item, self.dtype_is_object)
 *         finally:
 *             PyMem_Free(tmp)             # <<<<<<<<<<<<<<
 * 
 *     cdef setitem_indexed(self, index, value):
*/
  /*finally:*/ {
    /*normal exit:*/{
      PyMem_Free(__pyx_v_tmp);
      goto __pyx_L7;
    }
    __pyx_L6_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ( unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
      {
        PyMem_Free(__pyx_v_tmp);
      }
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
      goto __pyx_L1_error;
    }
    __pyx_L7:;
  }

  /* "View.MemoryView":463
 *         memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object)
 * 
 *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
 *         cdef int array[128]
 *         cdef void *tmp = NULL
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":495
 *             PyMem_Free(tmp)
 * 
 *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
 *         cdef char *itemp = self.get_item_pointer(index)
 *         self.assign_item_from_object(itemp, value)
*/

static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  char *__pyx_v_itemp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setitem_indexed", 0);

  /* "View.MemoryView":496
 * 
 *     cdef setitem_indexed(self, index, value):
 *         cdef char *itemp = self.get_item_pointer(index)             # <<<<<<<<<<<<<<
 *         self.assign_item_from_object(itemp, value)
 * 
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 496, __pyx_L1_error)
  __pyx_v_itemp = __pyx_t_1;

  /* "View.MemoryView":497
 *     cdef setitem_indexed(self, index, value):
 *         cdef char *itemp = self.get_item_pointer(index)
 *         self.assign_item_from_object(itemp, value)             # <<<<<<<<<<<<<<
 * 
 *     cdef convert_item_to_object(self, char *itemp):
*/
  __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 497, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "View.MemoryView":495
 *             PyMem_Free(tmp)
 * 
 *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
 *         cdef char *itemp = self.get_item_pointer(index)
 *         self.assign_item_from_object(itemp, value)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":499
 *         self.assign_item_from_object(itemp, value)
 * 
 *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
*/

static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) {
  PyObject *__pyx_v_struct = NULL;
  PyObject *__pyx_v_bytesitem = 0;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("convert_item_to_object", 0);

  /* "View.MemoryView":502
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
 *         import struct             # <<<<<<<<<<<<<<
 *         cdef bytes bytesitem
 * 
*/
  __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_struct, 0, 0, NULL, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 502, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_2;
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_struct = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "View.MemoryView":505
 *         cdef bytes bytesitem
 * 
 *         bytesitem = itemp[:self.view.itemsize]             # <<<<<<<<<<<<<<
 *         try:
 *             result = struct.unpack(self.view.format, bytesitem)
*/
  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 505, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":506
 * 
 *         bytesitem = itemp[:self.view.itemsize]
 *         try:             # <<<<<<<<<<<<<<
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    /*try:*/ {

      /* "View.MemoryView":507
 *         bytesitem = itemp[:self.view.itemsize]
 *         try:
 *             result = struct.unpack(self.view.format, bytesitem)             # <<<<<<<<<<<<<<
 *         except struct.error:
 *             raise ValueError, "Unable to convert item to object"
*/
      __pyx_t_5 = __pyx_v_struct;
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 507, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = 0;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_t_6, __pyx_v_bytesitem};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_unpack, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 507, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_v_result = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "View.MemoryView":506
 * 
 *         bytesitem = itemp[:self.view.itemsize]
 *         try:             # <<<<<<<<<<<<<<
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:
*/
    }

    /* "View.MemoryView":511
 *             raise ValueError, "Unable to convert item to object"
 *         else:
 *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
 *                 return result[0]
 *             return result
*/
    /*else:*/ {
      __pyx_t_8 = __Pyx_ssize_strlen(__pyx_v_self->view.format); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(1, 511, __pyx_L5_except_error)
      __pyx_t_9 = (__pyx_t_8 == 1);
      if (__pyx_t_9) {

        /* "View.MemoryView":512
 *         else:
 *             if len(self.view.format) == 1:
 *                 return result[0]             # <<<<<<<<<<<<<<
 *             return result
 * 
*/
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 512, __pyx_L5_except_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_r = __pyx_t_1;
        __pyx_t_1 = 0;
        goto __pyx_L6_except_return;

        /* "View.MemoryView":511
 *             raise ValueError, "Unable to convert item to object"
 *         else:
 *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
 *                 return result[0]
 *             return result
*/
      }

      /* "View.MemoryView":513
 *             if len(self.view.format) == 1:
 *                 return result[0]
 *             return result             # <<<<<<<<<<<<<<
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_result);
      __pyx_r = __pyx_v_result;
      goto __pyx_L6_except_return;
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "View.MemoryView":508
 *         try:
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Unable to convert item to object"
 *         else:
*/
    __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_6, &__pyx_t_5);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 508, __pyx_L5_except_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_11 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_10);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_ErrRestore(__pyx_t_1, __pyx_t_6, __pyx_t_5);
    __pyx_t_1 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0;
    if (__pyx_t_11) {
      __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_1) < 0) __PYX_ERR(1, 508, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_1);

      /* "View.MemoryView":509
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:
 *             raise ValueError, "Unable to convert item to object"             # <<<<<<<<<<<<<<
 *         else:
 *             if len(self.view.format) == 1:
*/
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Unable_to_convert_item_to_object, 0, 0);
      __PYX_ERR(1, 509, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;

    /* "View.MemoryView":506
 * 
 *         bytesitem = itemp[:self.view.itemsize]
 *         try:             # <<<<<<<<<<<<<<
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:
*/
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L0;
  }

  /* "View.MemoryView":499
 *         self.assign_item_from_object(itemp, value)
 * 
 *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_struct);
  __Pyx_XDECREF(__pyx_v_bytesitem);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":515
 *             return result
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
*/

static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_struct = NULL;
  char __pyx_v_c;
  PyObject *__pyx_v_bytesvalue = 0;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  char *__pyx_t_10;
  char *__pyx_t_11;
  Py_ssize_t __pyx_t_12;
  char *__pyx_t_13;
  char *__pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("assign_item_from_object", 0);

  /* "View.MemoryView":518
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
 *         import struct             # <<<<<<<<<<<<<<
 *         cdef char c
 *         cdef bytes bytesvalue
*/
  __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_struct, 0, 0, NULL, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 518, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_2;
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_struct = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "View.MemoryView":523
 *         cdef Py_ssize_t i
 * 
 *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
 *             bytesvalue = struct.pack(self.view.format, *value)
 *         else:
*/
  __pyx_t_3 = PyTuple_Check(__pyx_v_value); 
  if (__pyx_t_3) {

    /* "View.MemoryView":524
 * 
 *         if isinstance(value, tuple):
 *             bytesvalue = struct.pack(self.view.format, *value)             # <<<<<<<<<<<<<<
 *         else:
 *             bytesvalue = struct.pack(self.view.format, value)
*/
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_mstate_global->__pyx_n_u_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 524, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 524, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 524, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(1, 524, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 524, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 524, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 524, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(1, 524, __pyx_L1_error)
    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "View.MemoryView":523
 *         cdef Py_ssize_t i
 * 
 *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
 *             bytesvalue = struct.pack(self.view.format, *value)
 *         else:
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":526
 *             bytesvalue = struct.pack(self.view.format, *value)
 *         else:
 *             bytesvalue = struct.pack(self.view.format, value)             # <<<<<<<<<<<<<<
 * 
 *         for i, c in enumerate(bytesvalue):
*/
  /*else*/ {
    __pyx_t_6 = __pyx_v_struct;
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 526, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = 0;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_1, __pyx_v_value};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_pack, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 526, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(1, 526, __pyx_L1_error)
    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
  }
  __pyx_L3:;

  /* "View.MemoryView":528
 *             bytesvalue = struct.pack(self.view.format, value)
 * 
 *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
 *             itemp[i] = c
 * 
*/
  __pyx_t_8 = 0;
  if (unlikely(__pyx_v_bytesvalue == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
    __PYX_ERR(1, 528, __pyx_L1_error)
  }
  __Pyx_INCREF(__pyx_v_bytesvalue);
  __pyx_t_9 = __pyx_v_bytesvalue;
  __pyx_t_11 = __Pyx_PyBytes_AsWritableString(__pyx_t_9); if (unlikely(__pyx_t_11 == ((char *)NULL))) __PYX_ERR(1, 528, __pyx_L1_error)
  __pyx_t_12 = __Pyx_PyBytes_GET_SIZE(__pyx_t_9); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(1, 528, __pyx_L1_error)
  __pyx_t_13 = (__pyx_t_11 + __pyx_t_12);
  for (__pyx_t_14 = __pyx_t_11; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
    __pyx_t_10 = __pyx_t_14;
    __pyx_v_c = (__pyx_t_10[0]);

    /* "View.MemoryView":529
 * 
 *         for i, c in enumerate(bytesvalue):
 *             itemp[i] = c             # <<<<<<<<<<<<<<
 * 
 *     @cname('getbuffer')
*/
    __pyx_v_i = __pyx_t_8;

    /* "View.MemoryView":528
 *             bytesvalue = struct.pack(self.view.format, value)
 * 
 *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
 *             itemp[i] = c
 * 
*/
    __pyx_t_8 = (__pyx_t_8 + 1);

    /* "View.MemoryView":529
 * 
 *         for i, c in enumerate(bytesvalue):
 *             itemp[i] = c             # <<<<<<<<<<<<<<
 * 
 *     @cname('getbuffer')
*/
    (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
  }
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "View.MemoryView":515
 *             return result
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_struct);
  __Pyx_XDECREF(__pyx_v_bytesvalue);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":531
 *             itemp[i] = c
 * 
 *     @cname('getbuffer')             # <<<<<<<<<<<<<<
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         if flags & PyBUF_WRITABLE and self.view.readonly:
*/

/* Python wrapper */
CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));

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

static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Py_ssize_t *__pyx_t_3;
  char *__pyx_t_4;
  void *__pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  if (unlikely(__pyx_v_info == NULL)) {
    PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
    return -1;
  }
  __Pyx_RefNannySetupContext("__getbuffer__", 0);
  __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(__pyx_v_info->obj);

  /* "View.MemoryView":533
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         if flags & PyBUF_WRITABLE and self.view.readonly:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Cannot create writable memory view from read-only memoryview"
 * 
*/
  __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_1 = __pyx_v_self->view.readonly;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "View.MemoryView":534
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         if flags & PyBUF_WRITABLE and self.view.readonly:
 *             raise ValueError, "Cannot create writable memory view from read-only memoryview"             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_ND:
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Cannot_create_writable_memory_vi, 0, 0);
    __PYX_ERR(1, 534, __pyx_L1_error)

    /* "View.MemoryView":533
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         if flags & PyBUF_WRITABLE and self.view.readonly:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Cannot create writable memory view from read-only memoryview"
 * 
*/
  }

  /* "View.MemoryView":536
 *             raise ValueError, "Cannot create writable memory view from read-only memoryview"
 * 
 *         if flags & PyBUF_ND:             # <<<<<<<<<<<<<<
 *             info.shape = self.view.shape
 *         else:
*/
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":537
 * 
 *         if flags & PyBUF_ND:
 *             info.shape = self.view.shape             # <<<<<<<<<<<<<<
 *         else:
 *             info.shape = NULL
*/
    __pyx_t_3 = __pyx_v_self->view.shape;
    __pyx_v_info->shape = __pyx_t_3;

    /* "View.MemoryView":536
 *             raise ValueError, "Cannot create writable memory view from read-only memoryview"
 * 
 *         if flags & PyBUF_ND:             # <<<<<<<<<<<<<<
 *             info.shape = self.view.shape
 *         else:
*/
    goto __pyx_L6;
  }

  /* "View.MemoryView":539
 *             info.shape = self.view.shape
 *         else:
 *             info.shape = NULL             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_STRIDES:
*/
  /*else*/ {
    __pyx_v_info->shape = NULL;
  }
  __pyx_L6:;

  /* "View.MemoryView":541
 *             info.shape = NULL
 * 
 *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
 *             info.strides = self.view.strides
 *         else:
*/
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":542
 * 
 *         if flags & PyBUF_STRIDES:
 *             info.strides = self.view.strides             # <<<<<<<<<<<<<<
 *         else:
 *             info.strides = NULL
*/
    __pyx_t_3 = __pyx_v_self->view.strides;
    __pyx_v_info->strides = __pyx_t_3;

    /* "View.MemoryView":541
 *             info.shape = NULL
 * 
 *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
 *             info.strides = self.view.strides
 *         else:
*/
    goto __pyx_L7;
  }

  /* "View.MemoryView":544
 *             info.strides = self.view.strides
 *         else:
 *             info.strides = NULL             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_INDIRECT:
*/
  /*else*/ {
    __pyx_v_info->strides = NULL;
  }
  __pyx_L7:;

  /* "View.MemoryView":546
 *             info.strides = NULL
 * 
 *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
 *             info.suboffsets = self.view.suboffsets
 *         else:
*/
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":547
 * 
 *         if flags & PyBUF_INDIRECT:
 *             info.suboffsets = self.view.suboffsets             # <<<<<<<<<<<<<<
 *         else:
 *             info.suboffsets = NULL
*/
    __pyx_t_3 = __pyx_v_self->view.suboffsets;
    __pyx_v_info->suboffsets = __pyx_t_3;

    /* "View.MemoryView":546
 *             info.strides = NULL
 * 
 *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
 *             info.suboffsets = self.view.suboffsets
 *         else:
*/
    goto __pyx_L8;
  }

  /* "View.MemoryView":549
 *             info.suboffsets = self.view.suboffsets
 *         else:
 *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_FORMAT:
*/
  /*else*/ {
    __pyx_v_info->suboffsets = NULL;
  }
  __pyx_L8:;

  /* "View.MemoryView":551
 *             info.suboffsets = NULL
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             info.format = self.view.format
 *         else:
*/
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":552
 * 
 *         if flags & PyBUF_FORMAT:
 *             info.format = self.view.format             # <<<<<<<<<<<<<<
 *         else:
 *             info.format = NULL
*/
    __pyx_t_4 = __pyx_v_self->view.format;
    __pyx_v_info->format = __pyx_t_4;

    /* "View.MemoryView":551
 *             info.suboffsets = NULL
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             info.format = self.view.format
 *         else:
*/
    goto __pyx_L9;
  }

  /* "View.MemoryView":554
 *             info.format = self.view.format
 *         else:
 *             info.format = NULL             # <<<<<<<<<<<<<<
 * 
 *         info.buf = self.view.buf
*/
  /*else*/ {
    __pyx_v_info->format = NULL;
  }
  __pyx_L9:;

  /* "View.MemoryView":556
 *             info.format = NULL
 * 
 *         info.buf = self.view.buf             # <<<<<<<<<<<<<<
 *         info.ndim = self.view.ndim
 *         info.itemsize = self.view.itemsize
*/
  __pyx_t_5 = __pyx_v_self->view.buf;
  __pyx_v_info->buf = __pyx_t_5;

  /* "View.MemoryView":557
 * 
 *         info.buf = self.view.buf
 *         info.ndim = self.view.ndim             # <<<<<<<<<<<<<<
 *         info.itemsize = self.view.itemsize
 *         info.len = self.view.len
*/
  __pyx_t_6 = __pyx_v_self->view.ndim;
  __pyx_v_info->ndim = __pyx_t_6;

  /* "View.MemoryView":558
 *         info.buf = self.view.buf
 *         info.ndim = self.view.ndim
 *         info.itemsize = self.view.itemsize             # <<<<<<<<<<<<<<
 *         info.len = self.view.len
 *         info.readonly = self.view.readonly
*/
  __pyx_t_7 = __pyx_v_self->view.itemsize;
  __pyx_v_info->itemsize = __pyx_t_7;

  /* "View.MemoryView":559
 *         info.ndim = self.view.ndim
 *         info.itemsize = self.view.itemsize
 *         info.len = self.view.len             # <<<<<<<<<<<<<<
 *         info.readonly = self.view.readonly
 *         info.obj = self
*/
  __pyx_t_7 = __pyx_v_self->view.len;
  __pyx_v_info->len = __pyx_t_7;

  /* "View.MemoryView":560
 *         info.itemsize = self.view.itemsize
 *         info.len = self.view.len
 *         info.readonly = self.view.readonly             # <<<<<<<<<<<<<<
 *         info.obj = self
 * 
*/
  __pyx_t_1 = __pyx_v_self->view.readonly;
  __pyx_v_info->readonly = __pyx_t_1;

  /* "View.MemoryView":561
 *         info.len = self.view.len
 *         info.readonly = self.view.readonly
 *         info.obj = self             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self);
  __Pyx_GOTREF(__pyx_v_info->obj);
  __Pyx_DECREF(__pyx_v_info->obj);
  __pyx_v_info->obj = ((PyObject *)__pyx_v_self);

  /* "View.MemoryView":531
 *             itemp[i] = c
 * 
 *     @cname('getbuffer')             # <<<<<<<<<<<<<<
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         if flags & PyBUF_WRITABLE and self.view.readonly:
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  if (__pyx_v_info->obj != NULL) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  }
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_info->obj == Py_None) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  }
  __pyx_L2:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":564
 * 
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def T(self):
 *         cdef _memoryviewslice result = memoryview_copy(self)
*/

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":566
 *     @property
 *     def T(self):
 *         cdef _memoryviewslice result = memoryview_copy(self)             # <<<<<<<<<<<<<<
 *         transpose_memslice(&result.from_slice)
 *         return result
*/
  __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_memoryviewslice_type))))) __PYX_ERR(1, 566, __pyx_L1_error)
  __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":567
 *     def T(self):
 *         cdef _memoryviewslice result = memoryview_copy(self)
 *         transpose_memslice(&result.from_slice)             # <<<<<<<<<<<<<<
 *         return result
 * 
*/
  __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 567, __pyx_L1_error)

  /* "View.MemoryView":568
 *         cdef _memoryviewslice result = memoryview_copy(self)
 *         transpose_memslice(&result.from_slice)
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_result);
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "View.MemoryView":564
 * 
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def T(self):
 *         cdef _memoryviewslice result = memoryview_copy(self)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":570
 *         return result
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def base(self):
 *         return self._get_base()
*/

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

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

  /* "View.MemoryView":572
 *     @property
 *     def base(self):
 *         return self._get_base()             # <<<<<<<<<<<<<<
 * 
 *     cdef _get_base(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->_get_base(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 572, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":570
 *         return result
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def base(self):
 *         return self._get_base()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":574
 *         return self._get_base()
 * 
 *     cdef _get_base(self):             # <<<<<<<<<<<<<<
 *         return self.obj
 * 
*/

static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_base", 0);

  /* "View.MemoryView":575
 * 
 *     cdef _get_base(self):
 *         return self.obj             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->obj);
  __pyx_r = __pyx_v_self->obj;
  goto __pyx_L0;

  /* "View.MemoryView":574
 *         return self._get_base()
 * 
 *     cdef _get_base(self):             # <<<<<<<<<<<<<<
 *         return self.obj
 * 
*/

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

/* "View.MemoryView":577
 *         return self.obj
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def shape(self):
 *         return tuple([length for length in self.view.shape[:self.view.ndim]])
*/

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  Py_ssize_t __pyx_7genexpr__pyx_v_length;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t *__pyx_t_2;
  Py_ssize_t *__pyx_t_3;
  Py_ssize_t *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":579
 *     @property
 *     def shape(self):
 *         return tuple([length for length in self.view.shape[:self.view.ndim]])             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 579, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
    for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
      __pyx_t_2 = __pyx_t_4;
      __pyx_7genexpr__pyx_v_length = (__pyx_t_2[0]);
      __pyx_t_5 = PyLong_FromSsize_t(__pyx_7genexpr__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 579, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 579, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  } /* exit inner scope */
  __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 579, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":577
 *         return self.obj
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def shape(self):
 *         return tuple([length for length in self.view.shape[:self.view.ndim]])
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":581
 *         return tuple([length for length in self.view.shape[:self.view.ndim]])
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def strides(self):
 *         if self.view.strides == NULL:
*/

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  Py_ssize_t __pyx_8genexpr1__pyx_v_stride;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t *__pyx_t_3;
  Py_ssize_t *__pyx_t_4;
  Py_ssize_t *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":583
 *     @property
 *     def strides(self):
 *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
 * 
 *             raise ValueError, "Buffer view does not expose strides"
*/
  __pyx_t_1 = (__pyx_v_self->view.strides == NULL);
  if (unlikely(__pyx_t_1)) {

    /* "View.MemoryView":585
 *         if self.view.strides == NULL:
 * 
 *             raise ValueError, "Buffer view does not expose strides"             # <<<<<<<<<<<<<<
 * 
 *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Buffer_view_does_not_expose_stri, 0, 0);
    __PYX_ERR(1, 585, __pyx_L1_error)

    /* "View.MemoryView":583
 *     @property
 *     def strides(self):
 *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
 * 
 *             raise ValueError, "Buffer view does not expose strides"
*/
  }

  /* "View.MemoryView":587
 *             raise ValueError, "Buffer view does not expose strides"
 * 
 *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 587, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
    for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
      __pyx_t_3 = __pyx_t_5;
      __pyx_8genexpr1__pyx_v_stride = (__pyx_t_3[0]);
      __pyx_t_6 = PyLong_FromSsize_t(__pyx_8genexpr1__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 587, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 587, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
  } /* exit inner scope */
  __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 587, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":581
 *         return tuple([length for length in self.view.shape[:self.view.ndim]])
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def strides(self):
 *         if self.view.strides == NULL:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":589
 *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def suboffsets(self):
 *         if self.view.suboffsets == NULL:
*/

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  Py_ssize_t __pyx_8genexpr2__pyx_v_suboffset;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t *__pyx_t_3;
  Py_ssize_t *__pyx_t_4;
  Py_ssize_t *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":591
 *     @property
 *     def suboffsets(self):
 *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
 *             return (-1,) * self.view.ndim
 * 
*/
  __pyx_t_1 = (__pyx_v_self->view.suboffsets == NULL);
  if (__pyx_t_1) {

    /* "View.MemoryView":592
 *     def suboffsets(self):
 *         if self.view.suboffsets == NULL:
 *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
 * 
 *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PySequence_Multiply(__pyx_mstate_global->__pyx_tuple[0], __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 592, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "View.MemoryView":591
 *     @property
 *     def suboffsets(self):
 *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
 *             return (-1,) * self.view.ndim
 * 
*/
  }

  /* "View.MemoryView":594
 *             return (-1,) * self.view.ndim
 * 
 *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 594, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
    for (__pyx_t_5 = __pyx_v_self->view.suboffsets; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
      __pyx_t_3 = __pyx_t_5;
      __pyx_8genexpr2__pyx_v_suboffset = (__pyx_t_3[0]);
      __pyx_t_6 = PyLong_FromSsize_t(__pyx_8genexpr2__pyx_v_suboffset); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 594, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 594, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
  } /* exit inner scope */
  __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 594, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":589
 *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def suboffsets(self):
 *         if self.view.suboffsets == NULL:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":596
 *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def ndim(self):
 *         return self.view.ndim
*/

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

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

  /* "View.MemoryView":598
 *     @property
 *     def ndim(self):
 *         return self.view.ndim             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 598, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":596
 *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def ndim(self):
 *         return self.view.ndim
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":600
 *         return self.view.ndim
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def itemsize(self):
 *         return self.view.itemsize
*/

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

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

  /* "View.MemoryView":602
 *     @property
 *     def itemsize(self):
 *         return self.view.itemsize             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyLong_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 602, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":600
 *         return self.view.ndim
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def itemsize(self):
 *         return self.view.itemsize
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":604
 *         return self.view.itemsize
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def nbytes(self):
 *         return self.size * self.view.itemsize
*/

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":606
 *     @property
 *     def nbytes(self):
 *         return self.size * self.view.itemsize             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyLong_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":604
 *         return self.view.itemsize
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def nbytes(self):
 *         return self.size * self.view.itemsize
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":608
 *         return self.size * self.view.itemsize
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def size(self):
 *         if self._size is None:
*/

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_v_length = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t *__pyx_t_2;
  Py_ssize_t *__pyx_t_3;
  Py_ssize_t *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":610
 *     @property
 *     def size(self):
 *         if self._size is None:             # <<<<<<<<<<<<<<
 *             result = 1
 * 
*/
  __pyx_t_1 = (__pyx_v_self->_size == Py_None);
  if (__pyx_t_1) {

    /* "View.MemoryView":611
 *     def size(self):
 *         if self._size is None:
 *             result = 1             # <<<<<<<<<<<<<<
 * 
 *             for length in self.view.shape[:self.view.ndim]:
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_1);
    __pyx_v_result = __pyx_mstate_global->__pyx_int_1;

    /* "View.MemoryView":613
 *             result = 1
 * 
 *             for length in self.view.shape[:self.view.ndim]:             # <<<<<<<<<<<<<<
 *                 result *= length
 * 
*/
    __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
    for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
      __pyx_t_2 = __pyx_t_4;
      __pyx_t_5 = PyLong_FromSsize_t((__pyx_t_2[0])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 613, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "View.MemoryView":614
 * 
 *             for length in self.view.shape[:self.view.ndim]:
 *                 result *= length             # <<<<<<<<<<<<<<
 * 
 *             self._size = result
*/
      __pyx_t_5 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 614, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_5);
      __pyx_t_5 = 0;
    }

    /* "View.MemoryView":616
 *                 result *= length
 * 
 *             self._size = result             # <<<<<<<<<<<<<<
 * 
 *         return self._size
*/
    __Pyx_INCREF(__pyx_v_result);
    __Pyx_GIVEREF(__pyx_v_result);
    __Pyx_GOTREF(__pyx_v_self->_size);
    __Pyx_DECREF(__pyx_v_self->_size);
    __pyx_v_self->_size = __pyx_v_result;

    /* "View.MemoryView":610
 *     @property
 *     def size(self):
 *         if self._size is None:             # <<<<<<<<<<<<<<
 *             result = 1
 * 
*/
  }

  /* "View.MemoryView":618
 *             self._size = result
 * 
 *         return self._size             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_size);
  __pyx_r = __pyx_v_self->_size;
  goto __pyx_L0;

  /* "View.MemoryView":608
 *         return self.size * self.view.itemsize
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def size(self):
 *         if self._size is None:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_length);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":620
 *         return self._size
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         if self.view.ndim >= 1:
 *             return self.view.shape[0]
*/

/* Python wrapper */
static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  int __pyx_t_1;

  /* "View.MemoryView":621
 * 
 *     def __len__(self):
 *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
 *             return self.view.shape[0]
 * 
*/
  __pyx_t_1 = (__pyx_v_self->view.ndim >= 1);
  if (__pyx_t_1) {

    /* "View.MemoryView":622
 *     def __len__(self):
 *         if self.view.ndim >= 1:
 *             return self.view.shape[0]             # <<<<<<<<<<<<<<
 * 
 *         return 0
*/
    __pyx_r = (__pyx_v_self->view.shape[0]);
    goto __pyx_L0;

    /* "View.MemoryView":621
 * 
 *     def __len__(self):
 *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
 *             return self.view.shape[0]
 * 
*/
  }

  /* "View.MemoryView":624
 *             return self.view.shape[0]
 * 
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "View.MemoryView":620
 *         return self._size
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         if self.view.ndim >= 1:
 *             return self.view.shape[0]
*/

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

/* "View.MemoryView":626
 *         return 0
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
 *                                                id(self))
*/

/* Python wrapper */
static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4[5];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "View.MemoryView":627
 * 
 *     def __repr__(self):
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
 *                                                id(self))
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 627, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 627, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 627, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_1), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 627, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "View.MemoryView":628
 *     def __repr__(self):
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
 *                                                id(self))             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
*/
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_Format(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_MemoryView_of;
  __pyx_t_4[1] = __pyx_t_2;
  __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u_at_0x;
  __pyx_t_4[3] = __pyx_t_3;
  __pyx_t_4[4] = __pyx_mstate_global->__pyx_kp_u__3;

  /* "View.MemoryView":627
 * 
 *     def __repr__(self):
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
 *                                                id(self))
 * 
*/
  __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_4, 5, 15 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3));
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 627, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":626
 *         return 0
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
 *                                                id(self))
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":630
 *                                                id(self))
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3[3];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "View.MemoryView":631
 * 
 *     def __str__(self):
 *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 631, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 631, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 631, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_1), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 631, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3[0] = __pyx_mstate_global->__pyx_kp_u_MemoryView_of;
  __pyx_t_3[1] = __pyx_t_2;
  __pyx_t_3[2] = __pyx_mstate_global->__pyx_kp_u_object;
  __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, 15 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 8, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2));
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 631, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":630
 *                                                id(self))
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
 * 
*/

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

/* "View.MemoryView":634
 * 
 * 
 *     def is_c_contig(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
*/

/* Python wrapper */
static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("is_c_contig", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("is_c_contig", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
  __Pyx_memviewslice *__pyx_v_mslice;
  __Pyx_memviewslice __pyx_v_tmp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_c_contig", 0);

  /* "View.MemoryView":637
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
 *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
 *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
 * 
*/
  __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 637, __pyx_L1_error)
  __pyx_v_mslice = __pyx_t_1;

  /* "View.MemoryView":638
 *         cdef __Pyx_memviewslice tmp
 *         mslice = get_slice_from_memview(self, &tmp)
 *         return slice_is_contig(mslice[0], 'C', self.view.ndim)             # <<<<<<<<<<<<<<
 * 
 *     def is_f_contig(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":634
 * 
 * 
 *     def is_c_contig(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":640
 *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
 * 
 *     def is_f_contig(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
*/

/* Python wrapper */
static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("is_f_contig", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("is_f_contig", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
  __Pyx_memviewslice *__pyx_v_mslice;
  __Pyx_memviewslice __pyx_v_tmp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_f_contig", 0);

  /* "View.MemoryView":643
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
 *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
 *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
 * 
*/
  __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 643, __pyx_L1_error)
  __pyx_v_mslice = __pyx_t_1;

  /* "View.MemoryView":644
 *         cdef __Pyx_memviewslice tmp
 *         mslice = get_slice_from_memview(self, &tmp)
 *         return slice_is_contig(mslice[0], 'F', self.view.ndim)             # <<<<<<<<<<<<<<
 * 
 *     def copy(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 644, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":640
 *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
 * 
 *     def is_f_contig(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":646
 *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice mslice
 *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
*/

/* Python wrapper */
static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("copy", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("copy", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) {
  __Pyx_memviewslice __pyx_v_mslice;
  int __pyx_v_flags;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);

  /* "View.MemoryView":648
 *     def copy(self):
 *         cdef __Pyx_memviewslice mslice
 *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS             # <<<<<<<<<<<<<<
 * 
 *         slice_copy(self, &mslice)
*/
  __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));

  /* "View.MemoryView":650
 *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
 * 
 *         slice_copy(self, &mslice)             # <<<<<<<<<<<<<<
 *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,
 *                                    self.view.itemsize,
*/
  __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));

  /* "View.MemoryView":651
 * 
 *         slice_copy(self, &mslice)
 *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,             # <<<<<<<<<<<<<<
 *                                    self.view.itemsize,
 *                                    flags|PyBUF_C_CONTIGUOUS,
*/
  __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), __pyx_k_c, __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 651, __pyx_L1_error)
  __pyx_v_mslice = __pyx_t_1;

  /* "View.MemoryView":656
 *                                    self.dtype_is_object)
 * 
 *         return memoryview_copy_from_slice(self, &mslice)             # <<<<<<<<<<<<<<
 * 
 *     def copy_fortran(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 656, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":646
 *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice mslice
 *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":658
 *         return memoryview_copy_from_slice(self, &mslice)
 * 
 *     def copy_fortran(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice src, dst
 *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
*/

/* Python wrapper */
static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("copy_fortran", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("copy_fortran", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) {
  __Pyx_memviewslice __pyx_v_src;
  __Pyx_memviewslice __pyx_v_dst;
  int __pyx_v_flags;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy_fortran", 0);

  /* "View.MemoryView":660
 *     def copy_fortran(self):
 *         cdef __Pyx_memviewslice src, dst
 *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS             # <<<<<<<<<<<<<<
 * 
 *         slice_copy(self, &src)
*/
  __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));

  /* "View.MemoryView":662
 *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
 * 
 *         slice_copy(self, &src)             # <<<<<<<<<<<<<<
 *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,
 *                                 self.view.itemsize,
*/
  __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));

  /* "View.MemoryView":663
 * 
 *         slice_copy(self, &src)
 *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,             # <<<<<<<<<<<<<<
 *                                 self.view.itemsize,
 *                                 flags|PyBUF_F_CONTIGUOUS,
*/
  __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), __pyx_k_fortran, __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 663, __pyx_L1_error)
  __pyx_v_dst = __pyx_t_1;

  /* "View.MemoryView":668
 *                                 self.dtype_is_object)
 * 
 *         return memoryview_copy_from_slice(self, &dst)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 668, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":658
 *         return memoryview_copy_from_slice(self, &mslice)
 * 
 *     def copy_fortran(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice src, dst
 *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 2, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v___pyx_state);

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

static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 4, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":671
 * 
 * 
 * @cname('__pyx_memoryview_new')             # <<<<<<<<<<<<<<
 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo):
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
*/

static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo const *__pyx_v_typeinfo) {
  struct __pyx_memoryview_obj *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("memoryview_cwrapper", 0);

  /* "View.MemoryView":673
 * @cname('__pyx_memoryview_new')
 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo):
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)             # <<<<<<<<<<<<<<
 *     result.typeinfo = typeinfo
 *     return result
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 673, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 673, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_o, __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_memoryview_type, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 673, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":674
 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo):
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
 *     result.typeinfo = typeinfo             # <<<<<<<<<<<<<<
 *     return result
 * 
*/
  __pyx_v_result->typeinfo = __pyx_v_typeinfo;

  /* "View.MemoryView":675
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
 *     result.typeinfo = typeinfo
 *     return result             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_check')
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_result);
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "View.MemoryView":671
 * 
 * 
 * @cname('__pyx_memoryview_new')             # <<<<<<<<<<<<<<
 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo):
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":677
 *     return result
 * 
 * @cname('__pyx_memoryview_check')             # <<<<<<<<<<<<<<
 * cdef inline bint memoryview_check(object o) noexcept:
 *     return isinstance(o, memoryview)
*/

static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
  int __pyx_r;
  int __pyx_t_1;

  /* "View.MemoryView":679
 * @cname('__pyx_memoryview_check')
 * cdef inline bint memoryview_check(object o) noexcept:
 *     return isinstance(o, memoryview)             # <<<<<<<<<<<<<<
 * 
 * cdef tuple _unellipsify(object index, int ndim):
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_mstate_global->__pyx_memoryview_type); 
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "View.MemoryView":677
 *     return result
 * 
 * @cname('__pyx_memoryview_check')             # <<<<<<<<<<<<<<
 * cdef inline bint memoryview_check(object o) noexcept:
 *     return isinstance(o, memoryview)
*/

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

/* "View.MemoryView":681
 *     return isinstance(o, memoryview)
 * 
 * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
 *     """
 *     Replace all ellipses with full slices and fill incomplete indices with
*/

static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  Py_ssize_t __pyx_v_idx;
  PyObject *__pyx_v_tup = NULL;
  PyObject *__pyx_v_result = NULL;
  int __pyx_v_have_slices;
  int __pyx_v_seen_ellipsis;
  PyObject *__pyx_v_item = NULL;
  Py_ssize_t __pyx_v_nslices;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6[3];
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_unellipsify", 0);

  /* "View.MemoryView":687
 *     """
 *     cdef Py_ssize_t idx
 *     tup = <tuple>index if isinstance(index, tuple) else (index,)             # <<<<<<<<<<<<<<
 * 
 *     result = [slice(None)] * ndim
*/
  __pyx_t_2 = PyTuple_Check(__pyx_v_index); 
  if (__pyx_t_2) {
    __Pyx_INCREF(((PyObject*)__pyx_v_index));
    __pyx_t_1 = __pyx_v_index;
  } else {
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 687, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_index);
    __Pyx_GIVEREF(__pyx_v_index);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index) != (0)) __PYX_ERR(1, 687, __pyx_L1_error);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_v_tup = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":689
 *     tup = <tuple>index if isinstance(index, tuple) else (index,)
 * 
 *     result = [slice(None)] * ndim             # <<<<<<<<<<<<<<
 *     have_slices = False
 *     seen_ellipsis = False
*/
  __pyx_t_1 = PyList_New(1 * ((__pyx_v_ndim<0) ? 0:__pyx_v_ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 689, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  { Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < __pyx_v_ndim; __pyx_temp++) {
      __Pyx_INCREF(__pyx_mstate_global->__pyx_slice[0]);
      __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_1, __pyx_temp, __pyx_mstate_global->__pyx_slice[0]) != (0)) __PYX_ERR(1, 689, __pyx_L1_error);
    }
  }
  __pyx_v_result = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":690
 * 
 *     result = [slice(None)] * ndim
 *     have_slices = False             # <<<<<<<<<<<<<<
 *     seen_ellipsis = False
 *     idx = 0
*/
  __pyx_v_have_slices = 0;

  /* "View.MemoryView":691
 *     result = [slice(None)] * ndim
 *     have_slices = False
 *     seen_ellipsis = False             # <<<<<<<<<<<<<<
 *     idx = 0
 *     for item in tup:
*/
  __pyx_v_seen_ellipsis = 0;

  /* "View.MemoryView":692
 *     have_slices = False
 *     seen_ellipsis = False
 *     idx = 0             # <<<<<<<<<<<<<<
 *     for item in tup:
 *         if item is Ellipsis:
*/
  __pyx_v_idx = 0;

  /* "View.MemoryView":693
 *     seen_ellipsis = False
 *     idx = 0
 *     for item in tup:             # <<<<<<<<<<<<<<
 *         if item is Ellipsis:
 *             if not seen_ellipsis:
*/
  if (unlikely(__pyx_v_tup == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(1, 693, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_1);
  __pyx_t_4 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 693, __pyx_L1_error)
      #endif
      if (__pyx_t_4 >= __pyx_temp) break;
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4));
    #else
    __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_4);
    #endif
    ++__pyx_t_4;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 693, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "View.MemoryView":694
 *     idx = 0
 *     for item in tup:
 *         if item is Ellipsis:             # <<<<<<<<<<<<<<
 *             if not seen_ellipsis:
 *                 idx += ndim - len(tup)
*/
    __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
    if (__pyx_t_2) {

      /* "View.MemoryView":695
 *     for item in tup:
 *         if item is Ellipsis:
 *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
 *                 idx += ndim - len(tup)
 *                 seen_ellipsis = True
*/
      __pyx_t_2 = (!__pyx_v_seen_ellipsis);
      if (__pyx_t_2) {

        /* "View.MemoryView":696
 *         if item is Ellipsis:
 *             if not seen_ellipsis:
 *                 idx += ndim - len(tup)             # <<<<<<<<<<<<<<
 *                 seen_ellipsis = True
 *             have_slices = True
*/
        if (unlikely(__pyx_v_tup == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
          __PYX_ERR(1, 696, __pyx_L1_error)
        }
        __pyx_t_5 = __Pyx_PyTuple_GET_SIZE(__pyx_v_tup); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 696, __pyx_L1_error)
        __pyx_v_idx = (__pyx_v_idx + (__pyx_v_ndim - __pyx_t_5));

        /* "View.MemoryView":697
 *             if not seen_ellipsis:
 *                 idx += ndim - len(tup)
 *                 seen_ellipsis = True             # <<<<<<<<<<<<<<
 *             have_slices = True
 *         else:
*/
        __pyx_v_seen_ellipsis = 1;

        /* "View.MemoryView":695
 *     for item in tup:
 *         if item is Ellipsis:
 *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
 *                 idx += ndim - len(tup)
 *                 seen_ellipsis = True
*/
      }

      /* "View.MemoryView":698
 *                 idx += ndim - len(tup)
 *                 seen_ellipsis = True
 *             have_slices = True             # <<<<<<<<<<<<<<
 *         else:
 *             if isinstance(item, slice):
*/
      __pyx_v_have_slices = 1;

      /* "View.MemoryView":694
 *     idx = 0
 *     for item in tup:
 *         if item is Ellipsis:             # <<<<<<<<<<<<<<
 *             if not seen_ellipsis:
 *                 idx += ndim - len(tup)
*/
      goto __pyx_L5;
    }

    /* "View.MemoryView":700
 *             have_slices = True
 *         else:
 *             if isinstance(item, slice):             # <<<<<<<<<<<<<<
 *                 have_slices = True
 *             elif not PyIndex_Check(item):
*/
    /*else*/ {
      __pyx_t_2 = PySlice_Check(__pyx_v_item); 
      if (__pyx_t_2) {

        /* "View.MemoryView":701
 *         else:
 *             if isinstance(item, slice):
 *                 have_slices = True             # <<<<<<<<<<<<<<
 *             elif not PyIndex_Check(item):
 *                 raise TypeError, f"Cannot index with type '{type(item)}'"
*/
        __pyx_v_have_slices = 1;

        /* "View.MemoryView":700
 *             have_slices = True
 *         else:
 *             if isinstance(item, slice):             # <<<<<<<<<<<<<<
 *                 have_slices = True
 *             elif not PyIndex_Check(item):
*/
        goto __pyx_L7;
      }

      /* "View.MemoryView":702
 *             if isinstance(item, slice):
 *                 have_slices = True
 *             elif not PyIndex_Check(item):             # <<<<<<<<<<<<<<
 *                 raise TypeError, f"Cannot index with type '{type(item)}'"
 *             result[idx] = item
*/
      __pyx_t_2 = (!(PyIndex_Check(__pyx_v_item) != 0));
      if (unlikely(__pyx_t_2)) {

        /* "View.MemoryView":703
 *                 have_slices = True
 *             elif not PyIndex_Check(item):
 *                 raise TypeError, f"Cannot index with type '{type(item)}'"             # <<<<<<<<<<<<<<
 *             result[idx] = item
 *         idx += 1
*/
        __pyx_t_3 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_item)), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 703, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u_Cannot_index_with_type;
        __pyx_t_6[1] = __pyx_t_3;
        __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u__4;
        __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, 24 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3));
        if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 703, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_t_7, 0, 0);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __PYX_ERR(1, 703, __pyx_L1_error)

        /* "View.MemoryView":702
 *             if isinstance(item, slice):
 *                 have_slices = True
 *             elif not PyIndex_Check(item):             # <<<<<<<<<<<<<<
 *                 raise TypeError, f"Cannot index with type '{type(item)}'"
 *             result[idx] = item
*/
      }
      __pyx_L7:;

      /* "View.MemoryView":704
 *             elif not PyIndex_Check(item):
 *                 raise TypeError, f"Cannot index with type '{type(item)}'"
 *             result[idx] = item             # <<<<<<<<<<<<<<
 *         idx += 1
 * 
*/
      if (unlikely((__Pyx_SetItemInt(__pyx_v_result, __pyx_v_idx, __pyx_v_item, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(1, 704, __pyx_L1_error)
    }
    __pyx_L5:;

    /* "View.MemoryView":705
 *                 raise TypeError, f"Cannot index with type '{type(item)}'"
 *             result[idx] = item
 *         idx += 1             # <<<<<<<<<<<<<<
 * 
 *     nslices = ndim - idx
*/
    __pyx_v_idx = (__pyx_v_idx + 1);

    /* "View.MemoryView":693
 *     seen_ellipsis = False
 *     idx = 0
 *     for item in tup:             # <<<<<<<<<<<<<<
 *         if item is Ellipsis:
 *             if not seen_ellipsis:
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "View.MemoryView":707
 *         idx += 1
 * 
 *     nslices = ndim - idx             # <<<<<<<<<<<<<<
 *     return have_slices or nslices, tuple(result)
 * 
*/
  __pyx_v_nslices = (__pyx_v_ndim - __pyx_v_idx);

  /* "View.MemoryView":708
 * 
 *     nslices = ndim - idx
 *     return have_slices or nslices, tuple(result)             # <<<<<<<<<<<<<<
 * 
 * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1:
*/
  __Pyx_XDECREF(__pyx_r);
  if (!__pyx_v_have_slices) {
  } else {
    __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 708, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L9_bool_binop_done;
  }
  __pyx_t_7 = PyLong_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 708, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = __pyx_t_7;
  __pyx_t_7 = 0;
  __pyx_L9_bool_binop_done:;
  __pyx_t_7 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 708, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 708, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1) != (0)) __PYX_ERR(1, 708, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_7);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7) != (0)) __PYX_ERR(1, 708, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_7 = 0;
  __pyx_r = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":681
 *     return isinstance(o, memoryview)
 * 
 * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
 *     """
 *     Replace all ellipses with full slices and fill incomplete indices with
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tup);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":710
 *     return have_slices or nslices, tuple(result)
 * 
 * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1:             # <<<<<<<<<<<<<<
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:
*/

static int assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) {
  Py_ssize_t __pyx_v_suboffset;
  int __pyx_r;
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t *__pyx_t_2;
  Py_ssize_t *__pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "View.MemoryView":711
 * 
 * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1:
 *     for suboffset in suboffsets[:ndim]:             # <<<<<<<<<<<<<<
 *         if suboffset >= 0:
 *             raise ValueError, "Indirect dimensions not supported"
*/
  __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
  for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
    __pyx_t_1 = __pyx_t_3;
    __pyx_v_suboffset = (__pyx_t_1[0]);

    /* "View.MemoryView":712
 * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1:
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Indirect dimensions not supported"
 *     return 0  # return type just used as an error flag
*/
    __pyx_t_4 = (__pyx_v_suboffset >= 0);
    if (unlikely(__pyx_t_4)) {

      /* "View.MemoryView":713
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:
 *             raise ValueError, "Indirect dimensions not supported"             # <<<<<<<<<<<<<<
 *     return 0  # return type just used as an error flag
 * 
*/
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Indirect_dimensions_not_supporte, 0, 0);
      __PYX_ERR(1, 713, __pyx_L1_error)

      /* "View.MemoryView":712
 * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1:
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Indirect dimensions not supported"
 *     return 0  # return type just used as an error flag
*/
    }
  }

  /* "View.MemoryView":714
 *         if suboffset >= 0:
 *             raise ValueError, "Indirect dimensions not supported"
 *     return 0  # return type just used as an error flag             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "View.MemoryView":710
 *     return have_slices or nslices, tuple(result)
 * 
 * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1:             # <<<<<<<<<<<<<<
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":720
 * 
 * 
 * @cname('__pyx_memview_slice')             # <<<<<<<<<<<<<<
 * cdef memoryview memview_slice(memoryview memview, object indices):
 *     cdef int new_ndim = 0, suboffset_dim = -1, dim
*/

static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
  int __pyx_v_new_ndim;
  int __pyx_v_suboffset_dim;
  int __pyx_v_dim;
  __Pyx_memviewslice __pyx_v_src;
  __Pyx_memviewslice __pyx_v_dst;
  __Pyx_memviewslice *__pyx_v_p_src;
  struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
  __Pyx_memviewslice *__pyx_v_p_dst;
  int *__pyx_v_p_suboffset_dim;
  Py_ssize_t __pyx_v_start;
  Py_ssize_t __pyx_v_stop;
  Py_ssize_t __pyx_v_step;
  Py_ssize_t __pyx_v_cindex;
  int __pyx_v_have_start;
  int __pyx_v_have_stop;
  int __pyx_v_have_step;
  PyObject *__pyx_v_index = NULL;
  struct __pyx_memoryview_obj *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_memoryview_obj *__pyx_t_3;
  char *__pyx_t_4;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  int __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("memview_slice", 0);

  /* "View.MemoryView":722
 * @cname('__pyx_memview_slice')
 * cdef memoryview memview_slice(memoryview memview, object indices):
 *     cdef int new_ndim = 0, suboffset_dim = -1, dim             # <<<<<<<<<<<<<<
 *     cdef bint negative_step
 *     cdef __Pyx_memviewslice src, dst
*/
  __pyx_v_new_ndim = 0;
  __pyx_v_suboffset_dim = -1;

  /* "View.MemoryView":729
 * 
 * 
 *     memset(&dst, 0, sizeof(dst))             # <<<<<<<<<<<<<<
 * 
 *     cdef _memoryviewslice memviewsliceobj
*/
  (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst))));

  /* "View.MemoryView":733
 *     cdef _memoryviewslice memviewsliceobj
 * 
 *     assert memview.view.ndim > 0             # <<<<<<<<<<<<<<
 * 
 *     if isinstance(memview, _memoryviewslice):
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_memview->view.ndim > 0);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
      __PYX_ERR(1, 733, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(1, 733, __pyx_L1_error)
  #endif

  /* "View.MemoryView":735
 *     assert memview.view.ndim > 0
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         memviewsliceobj = memview
 *         p_src = &memviewsliceobj.from_slice
*/
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); 
  if (__pyx_t_1) {

    /* "View.MemoryView":736
 * 
 *     if isinstance(memview, _memoryviewslice):
 *         memviewsliceobj = memview             # <<<<<<<<<<<<<<
 *         p_src = &memviewsliceobj.from_slice
 *     else:
*/
    __pyx_t_2 = ((PyObject *)__pyx_v_memview);
    __Pyx_INCREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryviewslice_type))))) __PYX_ERR(1, 736, __pyx_L1_error)
    __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "View.MemoryView":737
 *     if isinstance(memview, _memoryviewslice):
 *         memviewsliceobj = memview
 *         p_src = &memviewsliceobj.from_slice             # <<<<<<<<<<<<<<
 *     else:
 *         slice_copy(memview, &src)
*/
    __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);

    /* "View.MemoryView":735
 *     assert memview.view.ndim > 0
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         memviewsliceobj = memview
 *         p_src = &memviewsliceobj.from_slice
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":739
 *         p_src = &memviewsliceobj.from_slice
 *     else:
 *         slice_copy(memview, &src)             # <<<<<<<<<<<<<<
 *         p_src = &src
 * 
*/
  /*else*/ {
    __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));

    /* "View.MemoryView":740
 *     else:
 *         slice_copy(memview, &src)
 *         p_src = &src             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_v_p_src = (&__pyx_v_src);
  }
  __pyx_L3:;

  /* "View.MemoryView":746
 * 
 * 
 *     dst.memview = p_src.memview             # <<<<<<<<<<<<<<
 *     dst.data = p_src.data
 * 
*/
  __pyx_t_3 = __pyx_v_p_src->memview;
  __pyx_v_dst.memview = __pyx_t_3;

  /* "View.MemoryView":747
 * 
 *     dst.memview = p_src.memview
 *     dst.data = p_src.data             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_4 = __pyx_v_p_src->data;
  __pyx_v_dst.data = __pyx_t_4;

  /* "View.MemoryView":752
 * 
 * 
 *     cdef __Pyx_memviewslice *p_dst = &dst             # <<<<<<<<<<<<<<
 *     cdef int *p_suboffset_dim = &suboffset_dim
 *     cdef Py_ssize_t start, stop, step, cindex
*/
  __pyx_v_p_dst = (&__pyx_v_dst);

  /* "View.MemoryView":753
 * 
 *     cdef __Pyx_memviewslice *p_dst = &dst
 *     cdef int *p_suboffset_dim = &suboffset_dim             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t start, stop, step, cindex
 *     cdef bint have_start, have_stop, have_step
*/
  __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);

  /* "View.MemoryView":757
 *     cdef bint have_start, have_stop, have_step
 * 
 *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
 *         if PyIndex_Check(index):
 *             cindex = index
*/
  __pyx_t_5 = 0;
  if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
    __pyx_t_2 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_2);
    __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 757, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 757, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 757, __pyx_L1_error)
          #endif
          if (__pyx_t_6 >= __pyx_temp) break;
        }
        __pyx_t_8 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_6;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 757, __pyx_L1_error)
          #endif
          if (__pyx_t_6 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_8 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6));
        #else
        __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_6);
        #endif
        ++__pyx_t_6;
      }
      if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 757, __pyx_L1_error)
    } else {
      __pyx_t_8 = __pyx_t_7(__pyx_t_2);
      if (unlikely(!__pyx_t_8)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 757, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_8);
    __pyx_t_8 = 0;
    __pyx_v_dim = __pyx_t_5;
    __pyx_t_5 = (__pyx_t_5 + 1);

    /* "View.MemoryView":758
 * 
 *     for dim, index in enumerate(indices):
 *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
 *             cindex = index
 *             slice_memviewslice(
*/
    __pyx_t_1 = (PyIndex_Check(__pyx_v_index) != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":759
 *     for dim, index in enumerate(indices):
 *         if PyIndex_Check(index):
 *             cindex = index             # <<<<<<<<<<<<<<
 *             slice_memviewslice(
 *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
*/
      __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 759, __pyx_L1_error)
      __pyx_v_cindex = __pyx_t_9;

      /* "View.MemoryView":760
 *         if PyIndex_Check(index):
 *             cindex = index
 *             slice_memviewslice(             # <<<<<<<<<<<<<<
 *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
 *                 dim, new_ndim, p_suboffset_dim,
*/
      __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_cindex, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 760, __pyx_L1_error)

      /* "View.MemoryView":758
 * 
 *     for dim, index in enumerate(indices):
 *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
 *             cindex = index
 *             slice_memviewslice(
*/
      goto __pyx_L6;
    }

    /* "View.MemoryView":766
 *                 0, 0, 0, # have_{start,stop,step}
 *                 False)
 *         elif index is None:             # <<<<<<<<<<<<<<
 *             p_dst.shape[new_ndim] = 1
 *             p_dst.strides[new_ndim] = 0
*/
    __pyx_t_1 = (__pyx_v_index == Py_None);
    if (__pyx_t_1) {

      /* "View.MemoryView":767
 *                 False)
 *         elif index is None:
 *             p_dst.shape[new_ndim] = 1             # <<<<<<<<<<<<<<
 *             p_dst.strides[new_ndim] = 0
 *             p_dst.suboffsets[new_ndim] = -1
*/
      (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;

      /* "View.MemoryView":768
 *         elif index is None:
 *             p_dst.shape[new_ndim] = 1
 *             p_dst.strides[new_ndim] = 0             # <<<<<<<<<<<<<<
 *             p_dst.suboffsets[new_ndim] = -1
 *             new_ndim += 1
*/
      (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;

      /* "View.MemoryView":769
 *             p_dst.shape[new_ndim] = 1
 *             p_dst.strides[new_ndim] = 0
 *             p_dst.suboffsets[new_ndim] = -1             # <<<<<<<<<<<<<<
 *             new_ndim += 1
 *         else:
*/
      (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L;

      /* "View.MemoryView":770
 *             p_dst.strides[new_ndim] = 0
 *             p_dst.suboffsets[new_ndim] = -1
 *             new_ndim += 1             # <<<<<<<<<<<<<<
 *         else:
 *             start = index.start or 0
*/
      __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);

      /* "View.MemoryView":766
 *                 0, 0, 0, # have_{start,stop,step}
 *                 False)
 *         elif index is None:             # <<<<<<<<<<<<<<
 *             p_dst.shape[new_ndim] = 1
 *             p_dst.strides[new_ndim] = 0
*/
      goto __pyx_L6;
    }

    /* "View.MemoryView":772
 *             new_ndim += 1
 *         else:
 *             start = index.start or 0             # <<<<<<<<<<<<<<
 *             stop = index.stop or 0
 *             step = index.step or 0
*/
    /*else*/ {
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 772, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 772, __pyx_L1_error)
      if (!__pyx_t_1) {
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else {
        __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 772, __pyx_L1_error)
        __pyx_t_9 = __pyx_t_11;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L7_bool_binop_done;
      }
      __pyx_t_9 = 0;
      __pyx_L7_bool_binop_done:;
      __pyx_v_start = __pyx_t_9;

      /* "View.MemoryView":773
 *         else:
 *             start = index.start or 0
 *             stop = index.stop or 0             # <<<<<<<<<<<<<<
 *             step = index.step or 0
 * 
*/
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 773, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 773, __pyx_L1_error)
      if (!__pyx_t_1) {
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else {
        __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 773, __pyx_L1_error)
        __pyx_t_9 = __pyx_t_11;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L9_bool_binop_done;
      }
      __pyx_t_9 = 0;
      __pyx_L9_bool_binop_done:;
      __pyx_v_stop = __pyx_t_9;

      /* "View.MemoryView":774
 *             start = index.start or 0
 *             stop = index.stop or 0
 *             step = index.step or 0             # <<<<<<<<<<<<<<
 * 
 *             have_start = index.start is not None
*/
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 774, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 774, __pyx_L1_error)
      if (!__pyx_t_1) {
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else {
        __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 774, __pyx_L1_error)
        __pyx_t_9 = __pyx_t_11;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L11_bool_binop_done;
      }
      __pyx_t_9 = 0;
      __pyx_L11_bool_binop_done:;
      __pyx_v_step = __pyx_t_9;

      /* "View.MemoryView":776
 *             step = index.step or 0
 * 
 *             have_start = index.start is not None             # <<<<<<<<<<<<<<
 *             have_stop = index.stop is not None
 *             have_step = index.step is not None
*/
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 776, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = (__pyx_t_8 != Py_None);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_v_have_start = __pyx_t_1;

      /* "View.MemoryView":777
 * 
 *             have_start = index.start is not None
 *             have_stop = index.stop is not None             # <<<<<<<<<<<<<<
 *             have_step = index.step is not None
 * 
*/
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 777, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = (__pyx_t_8 != Py_None);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_v_have_stop = __pyx_t_1;

      /* "View.MemoryView":778
 *             have_start = index.start is not None
 *             have_stop = index.stop is not None
 *             have_step = index.step is not None             # <<<<<<<<<<<<<<
 * 
 *             slice_memviewslice(
*/
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 778, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = (__pyx_t_8 != Py_None);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_v_have_step = __pyx_t_1;

      /* "View.MemoryView":780
 *             have_step = index.step is not None
 * 
 *             slice_memviewslice(             # <<<<<<<<<<<<<<
 *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
 *                 dim, new_ndim, p_suboffset_dim,
*/
      __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 780, __pyx_L1_error)

      /* "View.MemoryView":786
 *                 have_start, have_stop, have_step,
 *                 True)
 *             new_ndim += 1             # <<<<<<<<<<<<<<
 * 
 *     if isinstance(memview, _memoryviewslice):
*/
      __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
    }
    __pyx_L6:;

    /* "View.MemoryView":757
 *     cdef bint have_start, have_stop, have_step
 * 
 *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
 *         if PyIndex_Check(index):
 *             cindex = index
*/
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "View.MemoryView":788
 *             new_ndim += 1
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         return memoryview_fromslice(dst, new_ndim,
 *                                     memviewsliceobj.to_object_func,
*/
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); 
  if (__pyx_t_1) {

    /* "View.MemoryView":789
 * 
 *     if isinstance(memview, _memoryviewslice):
 *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
 *                                     memviewsliceobj.to_object_func,
 *                                     memviewsliceobj.to_dtype_func,
*/
    __Pyx_XDECREF((PyObject *)__pyx_r);

    /* "View.MemoryView":790
 *     if isinstance(memview, _memoryviewslice):
 *         return memoryview_fromslice(dst, new_ndim,
 *                                     memviewsliceobj.to_object_func,             # <<<<<<<<<<<<<<
 *                                     memviewsliceobj.to_dtype_func,
 *                                     memview.dtype_is_object)
*/
    if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 790, __pyx_L1_error) }

    /* "View.MemoryView":791
 *         return memoryview_fromslice(dst, new_ndim,
 *                                     memviewsliceobj.to_object_func,
 *                                     memviewsliceobj.to_dtype_func,             # <<<<<<<<<<<<<<
 *                                     memview.dtype_is_object)
 *     else:
*/
    if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 791, __pyx_L1_error) }

    /* "View.MemoryView":789
 * 
 *     if isinstance(memview, _memoryviewslice):
 *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
 *                                     memviewsliceobj.to_object_func,
 *                                     memviewsliceobj.to_dtype_func,
*/
    __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 789, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 789, __pyx_L1_error)
    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "View.MemoryView":788
 *             new_ndim += 1
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         return memoryview_fromslice(dst, new_ndim,
 *                                     memviewsliceobj.to_object_func,
*/
  }

  /* "View.MemoryView":794
 *                                     memview.dtype_is_object)
 *     else:
 *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
 *                                     memview.dtype_is_object)
 * 
*/
  /*else*/ {
    __Pyx_XDECREF((PyObject *)__pyx_r);

    /* "View.MemoryView":795
 *     else:
 *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,
 *                                     memview.dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 794, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "View.MemoryView":794
 *                                     memview.dtype_is_object)
 *     else:
 *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
 *                                     memview.dtype_is_object)
 * 
*/
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 794, __pyx_L1_error)
    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "View.MemoryView":720
 * 
 * 
 * @cname('__pyx_memview_slice')             # <<<<<<<<<<<<<<
 * cdef memoryview memview_slice(memoryview memview, object indices):
 *     cdef int new_ndim = 0, suboffset_dim = -1, dim
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":801
 * 
 * 
 * @cname('__pyx_pybuffer_index')             # <<<<<<<<<<<<<<
 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
 *                           Py_ssize_t dim) except NULL:
*/

static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) {
  Py_ssize_t __pyx_v_shape;
  Py_ssize_t __pyx_v_stride;
  Py_ssize_t __pyx_v_suboffset;
  Py_ssize_t __pyx_v_itemsize;
  char *__pyx_v_resultp;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4[3];
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pybuffer_index", 0);

  /* "View.MemoryView":804
 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
 *                           Py_ssize_t dim) except NULL:
 *     cdef Py_ssize_t shape, stride, suboffset = -1             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t itemsize = view.itemsize
 *     cdef char *resultp
*/
  __pyx_v_suboffset = -1L;

  /* "View.MemoryView":805
 *                           Py_ssize_t dim) except NULL:
 *     cdef Py_ssize_t shape, stride, suboffset = -1
 *     cdef Py_ssize_t itemsize = view.itemsize             # <<<<<<<<<<<<<<
 *     cdef char *resultp
 * 
*/
  __pyx_t_1 = __pyx_v_view->itemsize;
  __pyx_v_itemsize = __pyx_t_1;

  /* "View.MemoryView":808
 *     cdef char *resultp
 * 
 *     if view.ndim == 0:             # <<<<<<<<<<<<<<
 *         shape = view.len // itemsize
 *         stride = itemsize
*/
  __pyx_t_2 = (__pyx_v_view->ndim == 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":809
 * 
 *     if view.ndim == 0:
 *         shape = view.len // itemsize             # <<<<<<<<<<<<<<
 *         stride = itemsize
 *     else:
*/
    if (unlikely(__pyx_v_itemsize == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      __PYX_ERR(1, 809, __pyx_L1_error)
    }
    else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1)  && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) {
      PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
      __PYX_ERR(1, 809, __pyx_L1_error)
    }
    __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize, 0);

    /* "View.MemoryView":810
 *     if view.ndim == 0:
 *         shape = view.len // itemsize
 *         stride = itemsize             # <<<<<<<<<<<<<<
 *     else:
 *         shape = view.shape[dim]
*/
    __pyx_v_stride = __pyx_v_itemsize;

    /* "View.MemoryView":808
 *     cdef char *resultp
 * 
 *     if view.ndim == 0:             # <<<<<<<<<<<<<<
 *         shape = view.len // itemsize
 *         stride = itemsize
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":812
 *         stride = itemsize
 *     else:
 *         shape = view.shape[dim]             # <<<<<<<<<<<<<<
 *         stride = view.strides[dim]
 *         if view.suboffsets != NULL:
*/
  /*else*/ {
    __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);

    /* "View.MemoryView":813
 *     else:
 *         shape = view.shape[dim]
 *         stride = view.strides[dim]             # <<<<<<<<<<<<<<
 *         if view.suboffsets != NULL:
 *             suboffset = view.suboffsets[dim]
*/
    __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);

    /* "View.MemoryView":814
 *         shape = view.shape[dim]
 *         stride = view.strides[dim]
 *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
 *             suboffset = view.suboffsets[dim]
 * 
*/
    __pyx_t_2 = (__pyx_v_view->suboffsets != NULL);
    if (__pyx_t_2) {

      /* "View.MemoryView":815
 *         stride = view.strides[dim]
 *         if view.suboffsets != NULL:
 *             suboffset = view.suboffsets[dim]             # <<<<<<<<<<<<<<
 * 
 *     if index < 0:
*/
      __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);

      /* "View.MemoryView":814
 *         shape = view.shape[dim]
 *         stride = view.strides[dim]
 *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
 *             suboffset = view.suboffsets[dim]
 * 
*/
    }
  }
  __pyx_L3:;

  /* "View.MemoryView":817
 *             suboffset = view.suboffsets[dim]
 * 
 *     if index < 0:             # <<<<<<<<<<<<<<
 *         index += view.shape[dim]
 *         if index < 0:
*/
  __pyx_t_2 = (__pyx_v_index < 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":818
 * 
 *     if index < 0:
 *         index += view.shape[dim]             # <<<<<<<<<<<<<<
 *         if index < 0:
 *             raise IndexError, f"Out of bounds on buffer access (axis {dim})"
*/
    __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));

    /* "View.MemoryView":819
 *     if index < 0:
 *         index += view.shape[dim]
 *         if index < 0:             # <<<<<<<<<<<<<<
 *             raise IndexError, f"Out of bounds on buffer access (axis {dim})"
 * 
*/
    __pyx_t_2 = (__pyx_v_index < 0);
    if (unlikely(__pyx_t_2)) {

      /* "View.MemoryView":820
 *         index += view.shape[dim]
 *         if index < 0:
 *             raise IndexError, f"Out of bounds on buffer access (axis {dim})"             # <<<<<<<<<<<<<<
 * 
 *     if index >= shape:
*/
      __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 820, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_Out_of_bounds_on_buffer_access_a;
      __pyx_t_4[1] = __pyx_t_3;
      __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u__5;
      __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, 37 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127);
      if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 820, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_IndexError))), __pyx_t_5, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(1, 820, __pyx_L1_error)

      /* "View.MemoryView":819
 *     if index < 0:
 *         index += view.shape[dim]
 *         if index < 0:             # <<<<<<<<<<<<<<
 *             raise IndexError, f"Out of bounds on buffer access (axis {dim})"
 * 
*/
    }

    /* "View.MemoryView":817
 *             suboffset = view.suboffsets[dim]
 * 
 *     if index < 0:             # <<<<<<<<<<<<<<
 *         index += view.shape[dim]
 *         if index < 0:
*/
  }

  /* "View.MemoryView":822
 *             raise IndexError, f"Out of bounds on buffer access (axis {dim})"
 * 
 *     if index >= shape:             # <<<<<<<<<<<<<<
 *         raise IndexError, f"Out of bounds on buffer access (axis {dim})"
 * 
*/
  __pyx_t_2 = (__pyx_v_index >= __pyx_v_shape);
  if (unlikely(__pyx_t_2)) {

    /* "View.MemoryView":823
 * 
 *     if index >= shape:
 *         raise IndexError, f"Out of bounds on buffer access (axis {dim})"             # <<<<<<<<<<<<<<
 * 
 *     resultp = bufp + index * stride
*/
    __pyx_t_5 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 823, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_Out_of_bounds_on_buffer_access_a;
    __pyx_t_4[1] = __pyx_t_5;
    __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u__5;
    __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, 37 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 1, 127);
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 823, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_IndexError))), __pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 823, __pyx_L1_error)

    /* "View.MemoryView":822
 *             raise IndexError, f"Out of bounds on buffer access (axis {dim})"
 * 
 *     if index >= shape:             # <<<<<<<<<<<<<<
 *         raise IndexError, f"Out of bounds on buffer access (axis {dim})"
 * 
*/
  }

  /* "View.MemoryView":825
 *         raise IndexError, f"Out of bounds on buffer access (axis {dim})"
 * 
 *     resultp = bufp + index * stride             # <<<<<<<<<<<<<<
 *     if suboffset >= 0:
 *         resultp = (<char **> resultp)[0] + suboffset
*/
  __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));

  /* "View.MemoryView":826
 * 
 *     resultp = bufp + index * stride
 *     if suboffset >= 0:             # <<<<<<<<<<<<<<
 *         resultp = (<char **> resultp)[0] + suboffset
 * 
*/
  __pyx_t_2 = (__pyx_v_suboffset >= 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":827
 *     resultp = bufp + index * stride
 *     if suboffset >= 0:
 *         resultp = (<char **> resultp)[0] + suboffset             # <<<<<<<<<<<<<<
 * 
 *     return resultp
*/
    __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);

    /* "View.MemoryView":826
 * 
 *     resultp = bufp + index * stride
 *     if suboffset >= 0:             # <<<<<<<<<<<<<<
 *         resultp = (<char **> resultp)[0] + suboffset
 * 
*/
  }

  /* "View.MemoryView":829
 *         resultp = (<char **> resultp)[0] + suboffset
 * 
 *     return resultp             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = __pyx_v_resultp;
  goto __pyx_L0;

  /* "View.MemoryView":801
 * 
 * 
 * @cname('__pyx_pybuffer_index')             # <<<<<<<<<<<<<<
 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
 *                           Py_ssize_t dim) except NULL:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":834
 * 
 * 
 * @cname('__pyx_memslice_transpose')             # <<<<<<<<<<<<<<
 * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil:
 *     cdef int ndim = memslice.memview.view.ndim
*/

static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  int __pyx_v_ndim;
  Py_ssize_t *__pyx_v_shape;
  Py_ssize_t *__pyx_v_strides;
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_r;
  int __pyx_t_1;
  Py_ssize_t *__pyx_t_2;
  long __pyx_t_3;
  long __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save;

  /* "View.MemoryView":836
 * @cname('__pyx_memslice_transpose')
 * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil:
 *     cdef int ndim = memslice.memview.view.ndim             # <<<<<<<<<<<<<<
 * 
 *     cdef Py_ssize_t *shape = memslice.shape
*/
  __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
  __pyx_v_ndim = __pyx_t_1;

  /* "View.MemoryView":838
 *     cdef int ndim = memslice.memview.view.ndim
 * 
 *     cdef Py_ssize_t *shape = memslice.shape             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t *strides = memslice.strides
 * 
*/
  __pyx_t_2 = __pyx_v_memslice->shape;
  __pyx_v_shape = __pyx_t_2;

  /* "View.MemoryView":839
 * 
 *     cdef Py_ssize_t *shape = memslice.shape
 *     cdef Py_ssize_t *strides = memslice.strides             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_2 = __pyx_v_memslice->strides;
  __pyx_v_strides = __pyx_t_2;

  /* "View.MemoryView":843
 * 
 *     cdef int i, j
 *     for i in range(ndim // 2):             # <<<<<<<<<<<<<<
 *         j = ndim - 1 - i
 *         strides[i], strides[j] = strides[j], strides[i]
*/
  __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2, 1);
  __pyx_t_4 = __pyx_t_3;
  for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "View.MemoryView":844
 *     cdef int i, j
 *     for i in range(ndim // 2):
 *         j = ndim - 1 - i             # <<<<<<<<<<<<<<
 *         strides[i], strides[j] = strides[j], strides[i]
 *         shape[i], shape[j] = shape[j], shape[i]
*/
    __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);

    /* "View.MemoryView":845
 *     for i in range(ndim // 2):
 *         j = ndim - 1 - i
 *         strides[i], strides[j] = strides[j], strides[i]             # <<<<<<<<<<<<<<
 *         shape[i], shape[j] = shape[j], shape[i]
 * 
*/
    __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]);
    __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]);
    (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5;
    (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6;

    /* "View.MemoryView":846
 *         j = ndim - 1 - i
 *         strides[i], strides[j] = strides[j], strides[i]
 *         shape[i], shape[j] = shape[j], shape[i]             # <<<<<<<<<<<<<<
 * 
 *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
*/
    __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]);
    __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]);
    (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6;
    (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5;

    /* "View.MemoryView":848
 *         shape[i], shape[j] = shape[j], shape[i]
 * 
 *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
 *             _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions")
 * 
*/
    __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0);
    if (!__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0);
    __pyx_t_7 = __pyx_t_8;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_7) {

      /* "View.MemoryView":849
 * 
 *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
 *             _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions")             # <<<<<<<<<<<<<<
 * 
 *     return 0
*/
      __pyx_t_9 = __pyx_memoryview_err(PyExc_ValueError, __pyx_mstate_global->__pyx_kp_u_Cannot_transpose_memoryview_with); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 849, __pyx_L1_error)

      /* "View.MemoryView":848
 *         shape[i], shape[j] = shape[j], shape[i]
 * 
 *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
 *             _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions")
 * 
*/
    }
  }

  /* "View.MemoryView":851
 *             _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions")
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "View.MemoryView":834
 * 
 * 
 * @cname('__pyx_memslice_transpose')             # <<<<<<<<<<<<<<
 * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil:
 *     cdef int ndim = memslice.memview.view.ndim
*/

  /* function exit code */
  __pyx_L1_error:;
  __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":869
 *     cdef int (*to_dtype_func)(char *, object) except 0
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1)
 * 
*/

/* Python wrapper */
static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));

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

static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {

  /* "View.MemoryView":870
 * 
 *     def __dealloc__(self):
 *         __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1)             # <<<<<<<<<<<<<<
 * 
 *     cdef convert_item_to_object(self, char *itemp):
*/
  __PYX_XCLEAR_MEMVIEW((&__pyx_v_self->from_slice), 1);

  /* "View.MemoryView":869
 *     cdef int (*to_dtype_func)(char *, object) except 0
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1)
 * 
*/

  /* function exit code */
}

/* "View.MemoryView":872
 *         __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1)
 * 
 *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
 *         if self.to_object_func != NULL:
 *             return self.to_object_func(itemp)
*/

static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("convert_item_to_object", 0);

  /* "View.MemoryView":873
 * 
 *     cdef convert_item_to_object(self, char *itemp):
 *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
 *             return self.to_object_func(itemp)
 *         else:
*/
  __pyx_t_1 = (__pyx_v_self->to_object_func != NULL);
  if (__pyx_t_1) {

    /* "View.MemoryView":874
 *     cdef convert_item_to_object(self, char *itemp):
 *         if self.to_object_func != NULL:
 *             return self.to_object_func(itemp)             # <<<<<<<<<<<<<<
 *         else:
 *             return memoryview.convert_item_to_object(self, itemp)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 874, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "View.MemoryView":873
 * 
 *     cdef convert_item_to_object(self, char *itemp):
 *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
 *             return self.to_object_func(itemp)
 *         else:
*/
  }

  /* "View.MemoryView":876
 *             return self.to_object_func(itemp)
 *         else:
 *             return memoryview.convert_item_to_object(self, itemp)             # <<<<<<<<<<<<<<
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 876, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "View.MemoryView":872
 *         __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1)
 * 
 *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
 *         if self.to_object_func != NULL:
 *             return self.to_object_func(itemp)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":878
 *             return memoryview.convert_item_to_object(self, itemp)
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
 *         if self.to_dtype_func != NULL:
 *             self.to_dtype_func(itemp, value)
*/

static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("assign_item_from_object", 0);

  /* "View.MemoryView":879
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):
 *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
 *             self.to_dtype_func(itemp, value)
 *         else:
*/
  __pyx_t_1 = (__pyx_v_self->to_dtype_func != NULL);
  if (__pyx_t_1) {

    /* "View.MemoryView":880
 *     cdef assign_item_from_object(self, char *itemp, object value):
 *         if self.to_dtype_func != NULL:
 *             self.to_dtype_func(itemp, value)             # <<<<<<<<<<<<<<
 *         else:
 *             memoryview.assign_item_from_object(self, itemp, value)
*/
    __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 880, __pyx_L1_error)

    /* "View.MemoryView":879
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):
 *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
 *             self.to_dtype_func(itemp, value)
 *         else:
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":882
 *             self.to_dtype_func(itemp, value)
 *         else:
 *             memoryview.assign_item_from_object(self, itemp, value)             # <<<<<<<<<<<<<<
 * 
 *     cdef _get_base(self):
*/
  /*else*/ {
    __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 882, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "View.MemoryView":878
 *             return memoryview.convert_item_to_object(self, itemp)
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
 *         if self.to_dtype_func != NULL:
 *             self.to_dtype_func(itemp, value)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":884
 *             memoryview.assign_item_from_object(self, itemp, value)
 * 
 *     cdef _get_base(self):             # <<<<<<<<<<<<<<
 *         return self.from_object
 * 
*/

static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_base", 0);

  /* "View.MemoryView":885
 * 
 *     cdef _get_base(self):
 *         return self.from_object             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->from_object);
  __pyx_r = __pyx_v_self->from_object;
  goto __pyx_L0;

  /* "View.MemoryView":884
 *             memoryview.assign_item_from_object(self, itemp, value)
 * 
 *     cdef _get_base(self):             # <<<<<<<<<<<<<<
 *         return self.from_object
 * 
*/

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

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

/* Python wrapper */
static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));

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

static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 2, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), __pyx_v___pyx_state);

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

static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 4, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":904
 *     pass  # ignore failure, it's a minor issue
 * 
 * @cname('__pyx_memoryview_fromslice')             # <<<<<<<<<<<<<<
 * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,
 *                           int ndim,
*/

static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) {
  struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
  Py_ssize_t __pyx_v_suboffset;
  PyObject *__pyx_v_length = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_TypeInfo const *__pyx_t_4;
  Py_buffer __pyx_t_5;
  Py_ssize_t *__pyx_t_6;
  Py_ssize_t *__pyx_t_7;
  Py_ssize_t *__pyx_t_8;
  Py_ssize_t __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("memoryview_fromslice", 0);

  /* "View.MemoryView":913
 *     cdef _memoryviewslice result
 * 
 *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
 *         return None
 * 
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_memviewslice.memview) == Py_None);
  if (__pyx_t_1) {

    /* "View.MemoryView":914
 * 
 *     if <PyObject *> memviewslice.memview == Py_None:
 *         return None             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "View.MemoryView":913
 *     cdef _memoryviewslice result
 * 
 *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
 *         return None
 * 
*/
  }

  /* "View.MemoryView":919
 * 
 * 
 *     result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 *     result.from_slice = memviewslice
*/
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 919, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 919, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None) != (0)) __PYX_ERR(1, 919, __pyx_L1_error);
  __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_0);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_mstate_global->__pyx_int_0) != (0)) __PYX_ERR(1, 919, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2) != (0)) __PYX_ERR(1, 919, __pyx_L1_error);
  __pyx_t_2 = 0;
  __pyx_t_2 = ((PyObject *)__pyx_tp_new__memoryviewslice(((PyTypeObject *)__pyx_mstate_global->__pyx_memoryviewslice_type), __pyx_t_3, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 919, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "View.MemoryView":921
 *     result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object)
 * 
 *     result.from_slice = memviewslice             # <<<<<<<<<<<<<<
 *     __PYX_INC_MEMVIEW(&memviewslice, 1)
 * 
*/
  __pyx_v_result->from_slice = __pyx_v_memviewslice;

  /* "View.MemoryView":922
 * 
 *     result.from_slice = memviewslice
 *     __PYX_INC_MEMVIEW(&memviewslice, 1)             # <<<<<<<<<<<<<<
 * 
 *     result.from_object = (<memoryview> memviewslice.memview)._get_base()
*/
  __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);

  /* "View.MemoryView":924
 *     __PYX_INC_MEMVIEW(&memviewslice, 1)
 * 
 *     result.from_object = (<memoryview> memviewslice.memview)._get_base()             # <<<<<<<<<<<<<<
 *     result.typeinfo = memviewslice.memview.typeinfo
 * 
*/
  __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->__pyx_vtab)->_get_base(((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_result->from_object);
  __Pyx_DECREF(__pyx_v_result->from_object);
  __pyx_v_result->from_object = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "View.MemoryView":925
 * 
 *     result.from_object = (<memoryview> memviewslice.memview)._get_base()
 *     result.typeinfo = memviewslice.memview.typeinfo             # <<<<<<<<<<<<<<
 * 
 *     result.view = memviewslice.memview.view
*/
  __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
  __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;

  /* "View.MemoryView":927
 *     result.typeinfo = memviewslice.memview.typeinfo
 * 
 *     result.view = memviewslice.memview.view             # <<<<<<<<<<<<<<
 *     result.view.buf = <void *> memviewslice.data
 *     result.view.ndim = ndim
*/
  __pyx_t_5 = __pyx_v_memviewslice.memview->view;
  __pyx_v_result->__pyx_base.view = __pyx_t_5;

  /* "View.MemoryView":928
 * 
 *     result.view = memviewslice.memview.view
 *     result.view.buf = <void *> memviewslice.data             # <<<<<<<<<<<<<<
 *     result.view.ndim = ndim
 *     (<__pyx_buffer *> &result.view).obj = Py_None
*/
  __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data);

  /* "View.MemoryView":929
 *     result.view = memviewslice.memview.view
 *     result.view.buf = <void *> memviewslice.data
 *     result.view.ndim = ndim             # <<<<<<<<<<<<<<
 *     (<__pyx_buffer *> &result.view).obj = Py_None
 *     Py_INCREF(Py_None)
*/
  __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;

  /* "View.MemoryView":930
 *     result.view.buf = <void *> memviewslice.data
 *     result.view.ndim = ndim
 *     (<__pyx_buffer *> &result.view).obj = Py_None             # <<<<<<<<<<<<<<
 *     Py_INCREF(Py_None)
 * 
*/
  ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;

  /* "View.MemoryView":931
 *     result.view.ndim = ndim
 *     (<__pyx_buffer *> &result.view).obj = Py_None
 *     Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
 * 
 *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
*/
  Py_INCREF(Py_None);

  /* "View.MemoryView":933
 *     Py_INCREF(Py_None)
 * 
 *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
 *         result.flags = PyBUF_RECORDS
 *     else:
*/
  __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":934
 * 
 *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
 *         result.flags = PyBUF_RECORDS             # <<<<<<<<<<<<<<
 *     else:
 *         result.flags = PyBUF_RECORDS_RO
*/
    __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;

    /* "View.MemoryView":933
 *     Py_INCREF(Py_None)
 * 
 *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
 *         result.flags = PyBUF_RECORDS
 *     else:
*/
    goto __pyx_L4;
  }

  /* "View.MemoryView":936
 *         result.flags = PyBUF_RECORDS
 *     else:
 *         result.flags = PyBUF_RECORDS_RO             # <<<<<<<<<<<<<<
 * 
 *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
*/
  /*else*/ {
    __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
  }
  __pyx_L4:;

  /* "View.MemoryView":938
 *         result.flags = PyBUF_RECORDS_RO
 * 
 *     result.view.shape = <Py_ssize_t *> result.from_slice.shape             # <<<<<<<<<<<<<<
 *     result.view.strides = <Py_ssize_t *> result.from_slice.strides
 * 
*/
  __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);

  /* "View.MemoryView":939
 * 
 *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
 *     result.view.strides = <Py_ssize_t *> result.from_slice.strides             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);

  /* "View.MemoryView":942
 * 
 * 
 *     result.view.suboffsets = NULL             # <<<<<<<<<<<<<<
 *     for suboffset in result.from_slice.suboffsets[:ndim]:
 *         if suboffset >= 0:
*/
  __pyx_v_result->__pyx_base.view.suboffsets = NULL;

  /* "View.MemoryView":943
 * 
 *     result.view.suboffsets = NULL
 *     for suboffset in result.from_slice.suboffsets[:ndim]:             # <<<<<<<<<<<<<<
 *         if suboffset >= 0:
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
*/
  __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
  for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
    __pyx_t_6 = __pyx_t_8;
    __pyx_v_suboffset = (__pyx_t_6[0]);

    /* "View.MemoryView":944
 *     result.view.suboffsets = NULL
 *     for suboffset in result.from_slice.suboffsets[:ndim]:
 *         if suboffset >= 0:             # <<<<<<<<<<<<<<
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
 *             break
*/
    __pyx_t_1 = (__pyx_v_suboffset >= 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":945
 *     for suboffset in result.from_slice.suboffsets[:ndim]:
 *         if suboffset >= 0:
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets             # <<<<<<<<<<<<<<
 *             break
 * 
*/
      __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);

      /* "View.MemoryView":946
 *         if suboffset >= 0:
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
 *             break             # <<<<<<<<<<<<<<
 * 
 *     result.view.len = result.view.itemsize
*/
      goto __pyx_L6_break;

      /* "View.MemoryView":944
 *     result.view.suboffsets = NULL
 *     for suboffset in result.from_slice.suboffsets[:ndim]:
 *         if suboffset >= 0:             # <<<<<<<<<<<<<<
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
 *             break
*/
    }
  }
  __pyx_L6_break:;

  /* "View.MemoryView":948
 *             break
 * 
 *     result.view.len = result.view.itemsize             # <<<<<<<<<<<<<<
 *     for length in result.view.shape[:ndim]:
 *         result.view.len *= length
*/
  __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
  __pyx_v_result->__pyx_base.view.len = __pyx_t_9;

  /* "View.MemoryView":949
 * 
 *     result.view.len = result.view.itemsize
 *     for length in result.view.shape[:ndim]:             # <<<<<<<<<<<<<<
 *         result.view.len *= length
 * 
*/
  __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
  for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
    __pyx_t_6 = __pyx_t_8;
    __pyx_t_2 = PyLong_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 949, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "View.MemoryView":950
 *     result.view.len = result.view.itemsize
 *     for length in result.view.shape[:ndim]:
 *         result.view.len *= length             # <<<<<<<<<<<<<<
 * 
 *     result.to_object_func = to_object_func
*/
    __pyx_t_2 = PyLong_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 950, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 950, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 950, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
  }

  /* "View.MemoryView":952
 *         result.view.len *= length
 * 
 *     result.to_object_func = to_object_func             # <<<<<<<<<<<<<<
 *     result.to_dtype_func = to_dtype_func
 * 
*/
  __pyx_v_result->to_object_func = __pyx_v_to_object_func;

  /* "View.MemoryView":953
 * 
 *     result.to_object_func = to_object_func
 *     result.to_dtype_func = to_dtype_func             # <<<<<<<<<<<<<<
 * 
 *     return result
*/
  __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;

  /* "View.MemoryView":955
 *     result.to_dtype_func = to_dtype_func
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_get_slice_from_memoryview')
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_result);
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "View.MemoryView":904
 *     pass  # ignore failure, it's a minor issue
 * 
 * @cname('__pyx_memoryview_fromslice')             # <<<<<<<<<<<<<<
 * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,
 *                           int ndim,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_length);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":957
 *     return result
 * 
 * @cname('__pyx_memoryview_get_slice_from_memoryview')             # <<<<<<<<<<<<<<
 * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,
 *                                                    __Pyx_memviewslice *mslice) except NULL:
*/

static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
  struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
  __Pyx_memviewslice *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_slice_from_memview", 0);

  /* "View.MemoryView":961
 *                                                    __Pyx_memviewslice *mslice) except NULL:
 *     cdef _memoryviewslice obj
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         obj = memview
 *         return &obj.from_slice
*/
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); 
  if (__pyx_t_1) {

    /* "View.MemoryView":962
 *     cdef _memoryviewslice obj
 *     if isinstance(memview, _memoryviewslice):
 *         obj = memview             # <<<<<<<<<<<<<<
 *         return &obj.from_slice
 *     else:
*/
    __pyx_t_2 = ((PyObject *)__pyx_v_memview);
    __Pyx_INCREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryviewslice_type))))) __PYX_ERR(1, 962, __pyx_L1_error)
    __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "View.MemoryView":963
 *     if isinstance(memview, _memoryviewslice):
 *         obj = memview
 *         return &obj.from_slice             # <<<<<<<<<<<<<<
 *     else:
 *         slice_copy(memview, mslice)
*/
    __pyx_r = (&__pyx_v_obj->from_slice);
    goto __pyx_L0;

    /* "View.MemoryView":961
 *                                                    __Pyx_memviewslice *mslice) except NULL:
 *     cdef _memoryviewslice obj
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         obj = memview
 *         return &obj.from_slice
*/
  }

  /* "View.MemoryView":965
 *         return &obj.from_slice
 *     else:
 *         slice_copy(memview, mslice)             # <<<<<<<<<<<<<<
 *         return mslice
 * 
*/
  /*else*/ {
    __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);

    /* "View.MemoryView":966
 *     else:
 *         slice_copy(memview, mslice)
 *         return mslice             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_slice_copy')
*/
    __pyx_r = __pyx_v_mslice;
    goto __pyx_L0;
  }

  /* "View.MemoryView":957
 *     return result
 * 
 * @cname('__pyx_memoryview_get_slice_from_memoryview')             # <<<<<<<<<<<<<<
 * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,
 *                                                    __Pyx_memviewslice *mslice) except NULL:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_obj);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":968
 *         return mslice
 * 
 * @cname('__pyx_memoryview_slice_copy')             # <<<<<<<<<<<<<<
 * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept:
 *     cdef int dim
*/

static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
  int __pyx_v_dim;
  Py_ssize_t *__pyx_v_shape;
  Py_ssize_t *__pyx_v_strides;
  Py_ssize_t *__pyx_v_suboffsets;
  Py_ssize_t *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;

  /* "View.MemoryView":973
 *     cdef (Py_ssize_t*) shape, strides, suboffsets
 * 
 *     shape = memview.view.shape             # <<<<<<<<<<<<<<
 *     strides = memview.view.strides
 *     suboffsets = memview.view.suboffsets
*/
  __pyx_t_1 = __pyx_v_memview->view.shape;
  __pyx_v_shape = __pyx_t_1;

  /* "View.MemoryView":974
 * 
 *     shape = memview.view.shape
 *     strides = memview.view.strides             # <<<<<<<<<<<<<<
 *     suboffsets = memview.view.suboffsets
 * 
*/
  __pyx_t_1 = __pyx_v_memview->view.strides;
  __pyx_v_strides = __pyx_t_1;

  /* "View.MemoryView":975
 *     shape = memview.view.shape
 *     strides = memview.view.strides
 *     suboffsets = memview.view.suboffsets             # <<<<<<<<<<<<<<
 * 
 *     dst.memview = <__pyx_memoryview *> memview
*/
  __pyx_t_1 = __pyx_v_memview->view.suboffsets;
  __pyx_v_suboffsets = __pyx_t_1;

  /* "View.MemoryView":977
 *     suboffsets = memview.view.suboffsets
 * 
 *     dst.memview = <__pyx_memoryview *> memview             # <<<<<<<<<<<<<<
 *     dst.data = <char *> memview.view.buf
 * 
*/
  __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview);

  /* "View.MemoryView":978
 * 
 *     dst.memview = <__pyx_memoryview *> memview
 *     dst.data = <char *> memview.view.buf             # <<<<<<<<<<<<<<
 * 
 *     for dim in range(memview.view.ndim):
*/
  __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf);

  /* "View.MemoryView":980
 *     dst.data = <char *> memview.view.buf
 * 
 *     for dim in range(memview.view.ndim):             # <<<<<<<<<<<<<<
 *         dst.shape[dim] = shape[dim]
 *         dst.strides[dim] = strides[dim]
*/
  __pyx_t_2 = __pyx_v_memview->view.ndim;
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_dim = __pyx_t_4;

    /* "View.MemoryView":981
 * 
 *     for dim in range(memview.view.ndim):
 *         dst.shape[dim] = shape[dim]             # <<<<<<<<<<<<<<
 *         dst.strides[dim] = strides[dim]
 *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
*/
    (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);

    /* "View.MemoryView":982
 *     for dim in range(memview.view.ndim):
 *         dst.shape[dim] = shape[dim]
 *         dst.strides[dim] = strides[dim]             # <<<<<<<<<<<<<<
 *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
 * 
*/
    (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);

    /* "View.MemoryView":983
 *         dst.shape[dim] = shape[dim]
 *         dst.strides[dim] = strides[dim]
 *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_copy_object')
*/
    __pyx_t_6 = (__pyx_v_suboffsets != 0);
    if (__pyx_t_6) {
      __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
    } else {
      __pyx_t_5 = -1L;
    }
    (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
  }

  /* "View.MemoryView":968
 *         return mslice
 * 
 * @cname('__pyx_memoryview_slice_copy')             # <<<<<<<<<<<<<<
 * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept:
 *     cdef int dim
*/

  /* function exit code */
}

/* "View.MemoryView":985
 *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
 * 
 * @cname('__pyx_memoryview_copy_object')             # <<<<<<<<<<<<<<
 * cdef memoryview_copy(memoryview memview):
 *     "Create a new memoryview object"
*/

static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) {
  __Pyx_memviewslice __pyx_v_memviewslice;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("memoryview_copy", 0);

  /* "View.MemoryView":989
 *     "Create a new memoryview object"
 *     cdef __Pyx_memviewslice memviewslice
 *     slice_copy(memview, &memviewslice)             # <<<<<<<<<<<<<<
 *     return memoryview_copy_from_slice(memview, &memviewslice)
 * 
*/
  __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));

  /* "View.MemoryView":990
 *     cdef __Pyx_memviewslice memviewslice
 *     slice_copy(memview, &memviewslice)
 *     return memoryview_copy_from_slice(memview, &memviewslice)             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_copy_object_from_slice')
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":985
 *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
 * 
 * @cname('__pyx_memoryview_copy_object')             # <<<<<<<<<<<<<<
 * cdef memoryview_copy(memoryview memview):
 *     "Create a new memoryview object"
*/

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

/* "View.MemoryView":992
 *     return memoryview_copy_from_slice(memview, &memviewslice)
 * 
 * @cname('__pyx_memoryview_copy_object_from_slice')             # <<<<<<<<<<<<<<
 * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):
 *     """
*/

static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
  PyObject *(*__pyx_v_to_object_func)(char *);
  int (*__pyx_v_to_dtype_func)(char *, PyObject *);
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *(*__pyx_t_2)(char *);
  int (*__pyx_t_3)(char *, PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0);

  /* "View.MemoryView":1000
 *     cdef int (*to_dtype_func)(char *, object) except 0
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         to_object_func = (<_memoryviewslice> memview).to_object_func
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
*/
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); 
  if (__pyx_t_1) {

    /* "View.MemoryView":1001
 * 
 *     if isinstance(memview, _memoryviewslice):
 *         to_object_func = (<_memoryviewslice> memview).to_object_func             # <<<<<<<<<<<<<<
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
 *     else:
*/
    __pyx_t_2 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
    __pyx_v_to_object_func = __pyx_t_2;

    /* "View.MemoryView":1002
 *     if isinstance(memview, _memoryviewslice):
 *         to_object_func = (<_memoryviewslice> memview).to_object_func
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func             # <<<<<<<<<<<<<<
 *     else:
 *         to_object_func = NULL
*/
    __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
    __pyx_v_to_dtype_func = __pyx_t_3;

    /* "View.MemoryView":1000
 *     cdef int (*to_dtype_func)(char *, object) except 0
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         to_object_func = (<_memoryviewslice> memview).to_object_func
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":1004
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
 *     else:
 *         to_object_func = NULL             # <<<<<<<<<<<<<<
 *         to_dtype_func = NULL
 * 
*/
  /*else*/ {
    __pyx_v_to_object_func = NULL;

    /* "View.MemoryView":1005
 *     else:
 *         to_object_func = NULL
 *         to_dtype_func = NULL             # <<<<<<<<<<<<<<
 * 
 *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
*/
    __pyx_v_to_dtype_func = NULL;
  }
  __pyx_L3:;

  /* "View.MemoryView":1007
 *         to_dtype_func = NULL
 * 
 *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,             # <<<<<<<<<<<<<<
 *                                 to_object_func, to_dtype_func,
 *                                 memview.dtype_is_object)
*/
  __Pyx_XDECREF(__pyx_r);

  /* "View.MemoryView":1009
 *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
 *                                 to_object_func, to_dtype_func,
 *                                 memview.dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_4 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1007, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":992
 *     return memoryview_copy_from_slice(memview, &memviewslice)
 * 
 * @cname('__pyx_memoryview_copy_object_from_slice')             # <<<<<<<<<<<<<<
 * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):
 *     """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":1015
 * 
 * 
 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil:             # <<<<<<<<<<<<<<
 *     return -arg if arg < 0 else arg
 * 
*/

static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
  Py_ssize_t __pyx_r;
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;

  /* "View.MemoryView":1016
 * 
 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil:
 *     return -arg if arg < 0 else arg             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_get_best_slice_order')
*/
  __pyx_t_2 = (__pyx_v_arg < 0);
  if (__pyx_t_2) {
    __pyx_t_1 = (-__pyx_v_arg);
  } else {
    __pyx_t_1 = __pyx_v_arg;
  }
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "View.MemoryView":1015
 * 
 * 
 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil:             # <<<<<<<<<<<<<<
 *     return -arg if arg < 0 else arg
 * 
*/

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

/* "View.MemoryView":1018
 *     return -arg if arg < 0 else arg
 * 
 * @cname('__pyx_get_best_slice_order')             # <<<<<<<<<<<<<<
 * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil:
 *     """
*/

static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) {
  int __pyx_v_i;
  Py_ssize_t __pyx_v_c_stride;
  Py_ssize_t __pyx_v_f_stride;
  char __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;

  /* "View.MemoryView":1024
 *     """
 *     cdef int i
 *     cdef Py_ssize_t c_stride = 0             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t f_stride = 0
 * 
*/
  __pyx_v_c_stride = 0;

  /* "View.MemoryView":1025
 *     cdef int i
 *     cdef Py_ssize_t c_stride = 0
 *     cdef Py_ssize_t f_stride = 0             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ndim - 1, -1, -1):
*/
  __pyx_v_f_stride = 0;

  /* "View.MemoryView":1027
 *     cdef Py_ssize_t f_stride = 0
 * 
 *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
 *         if mslice.shape[i] > 1:
 *             c_stride = mslice.strides[i]
*/
  for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
    __pyx_v_i = __pyx_t_1;

    /* "View.MemoryView":1028
 * 
 *     for i in range(ndim - 1, -1, -1):
 *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
 *             c_stride = mslice.strides[i]
 *             break
*/
    __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1);
    if (__pyx_t_2) {

      /* "View.MemoryView":1029
 *     for i in range(ndim - 1, -1, -1):
 *         if mslice.shape[i] > 1:
 *             c_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
 *             break
 * 
*/
      __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);

      /* "View.MemoryView":1030
 *         if mslice.shape[i] > 1:
 *             c_stride = mslice.strides[i]
 *             break             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ndim):
*/
      goto __pyx_L4_break;

      /* "View.MemoryView":1028
 * 
 *     for i in range(ndim - 1, -1, -1):
 *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
 *             c_stride = mslice.strides[i]
 *             break
*/
    }
  }
  __pyx_L4_break:;

  /* "View.MemoryView":1032
 *             break
 * 
 *     for i in range(ndim):             # <<<<<<<<<<<<<<
 *         if mslice.shape[i] > 1:
 *             f_stride = mslice.strides[i]
*/
  __pyx_t_1 = __pyx_v_ndim;
  __pyx_t_3 = __pyx_t_1;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "View.MemoryView":1033
 * 
 *     for i in range(ndim):
 *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
 *             f_stride = mslice.strides[i]
 *             break
*/
    __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1);
    if (__pyx_t_2) {

      /* "View.MemoryView":1034
 *     for i in range(ndim):
 *         if mslice.shape[i] > 1:
 *             f_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
 *             break
 * 
*/
      __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);

      /* "View.MemoryView":1035
 *         if mslice.shape[i] > 1:
 *             f_stride = mslice.strides[i]
 *             break             # <<<<<<<<<<<<<<
 * 
 *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
*/
      goto __pyx_L7_break;

      /* "View.MemoryView":1033
 * 
 *     for i in range(ndim):
 *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
 *             f_stride = mslice.strides[i]
 *             break
*/
    }
  }
  __pyx_L7_break:;

  /* "View.MemoryView":1037
 *             break
 * 
 *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
 *         return 'C'
 *     else:
*/
  __pyx_t_2 = (abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride));
  if (__pyx_t_2) {

    /* "View.MemoryView":1038
 * 
 *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
 *         return 'C'             # <<<<<<<<<<<<<<
 *     else:
 *         return 'F'
*/
    __pyx_r = 'C';
    goto __pyx_L0;

    /* "View.MemoryView":1037
 *             break
 * 
 *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
 *         return 'C'
 *     else:
*/
  }

  /* "View.MemoryView":1040
 *         return 'C'
 *     else:
 *         return 'F'             # <<<<<<<<<<<<<<
 * 
 * @cython.cdivision(True)
*/
  /*else*/ {
    __pyx_r = 'F';
    goto __pyx_L0;
  }

  /* "View.MemoryView":1018
 *     return -arg if arg < 0 else arg
 * 
 * @cname('__pyx_get_best_slice_order')             # <<<<<<<<<<<<<<
 * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil:
 *     """
*/

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

/* "View.MemoryView":1042
 *         return 'F'
 * 
 * @cython.cdivision(True)             # <<<<<<<<<<<<<<
 * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,
 *                                    char *dst_data, Py_ssize_t *dst_strides,
*/

static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) {
  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
  Py_ssize_t __pyx_v_dst_extent;
  Py_ssize_t __pyx_v_src_stride;
  Py_ssize_t __pyx_v_dst_stride;
  int __pyx_t_1;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;

  /* "View.MemoryView":1050
 * 
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t src_extent = src_shape[0]             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t dst_extent = dst_shape[0]
 *     cdef Py_ssize_t src_stride = src_strides[0]
*/
  __pyx_v_src_extent = (__pyx_v_src_shape[0]);

  /* "View.MemoryView":1051
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t src_extent = src_shape[0]
 *     cdef Py_ssize_t dst_extent = dst_shape[0]             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t src_stride = src_strides[0]
 *     cdef Py_ssize_t dst_stride = dst_strides[0]
*/
  __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);

  /* "View.MemoryView":1052
 *     cdef Py_ssize_t src_extent = src_shape[0]
 *     cdef Py_ssize_t dst_extent = dst_shape[0]
 *     cdef Py_ssize_t src_stride = src_strides[0]             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t dst_stride = dst_strides[0]
 * 
*/
  __pyx_v_src_stride = (__pyx_v_src_strides[0]);

  /* "View.MemoryView":1053
 *     cdef Py_ssize_t dst_extent = dst_shape[0]
 *     cdef Py_ssize_t src_stride = src_strides[0]
 *     cdef Py_ssize_t dst_stride = dst_strides[0]             # <<<<<<<<<<<<<<
 * 
 *     if ndim == 1:
*/
  __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);

  /* "View.MemoryView":1055
 *     cdef Py_ssize_t dst_stride = dst_strides[0]
 * 
 *     if ndim == 1:             # <<<<<<<<<<<<<<
 *         if (src_stride > 0 and dst_stride > 0 and
 *                 <size_t> src_stride == itemsize == <size_t> dst_stride):
*/
  __pyx_t_1 = (__pyx_v_ndim == 1);
  if (__pyx_t_1) {

    /* "View.MemoryView":1056
 * 
 *     if ndim == 1:
 *         if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
 *                 <size_t> src_stride == itemsize == <size_t> dst_stride):
 *             memcpy(dst_data, src_data, itemsize * dst_extent)
*/
    __pyx_t_2 = (__pyx_v_src_stride > 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_2 = (__pyx_v_dst_stride > 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L5_bool_binop_done;
    }

    /* "View.MemoryView":1057
 *     if ndim == 1:
 *         if (src_stride > 0 and dst_stride > 0 and
 *                 <size_t> src_stride == itemsize == <size_t> dst_stride):             # <<<<<<<<<<<<<<
 *             memcpy(dst_data, src_data, itemsize * dst_extent)
 *         else:
*/
    __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
    if (__pyx_t_2) {
      __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
    }
    __pyx_t_1 = __pyx_t_2;
    __pyx_L5_bool_binop_done:;

    /* "View.MemoryView":1056
 * 
 *     if ndim == 1:
 *         if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
 *                 <size_t> src_stride == itemsize == <size_t> dst_stride):
 *             memcpy(dst_data, src_data, itemsize * dst_extent)
*/
    if (__pyx_t_1) {

      /* "View.MemoryView":1058
 *         if (src_stride > 0 and dst_stride > 0 and
 *                 <size_t> src_stride == itemsize == <size_t> dst_stride):
 *             memcpy(dst_data, src_data, itemsize * dst_extent)             # <<<<<<<<<<<<<<
 *         else:
 *             for i in range(dst_extent):
*/
      (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));

      /* "View.MemoryView":1056
 * 
 *     if ndim == 1:
 *         if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
 *                 <size_t> src_stride == itemsize == <size_t> dst_stride):
 *             memcpy(dst_data, src_data, itemsize * dst_extent)
*/
      goto __pyx_L4;
    }

    /* "View.MemoryView":1060
 *             memcpy(dst_data, src_data, itemsize * dst_extent)
 *         else:
 *             for i in range(dst_extent):             # <<<<<<<<<<<<<<
 *                 memcpy(dst_data, src_data, itemsize)
 *                 src_data += src_stride
*/
    /*else*/ {
      __pyx_t_3 = __pyx_v_dst_extent;
      __pyx_t_4 = __pyx_t_3;
      for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
        __pyx_v_i = __pyx_t_5;

        /* "View.MemoryView":1061
 *         else:
 *             for i in range(dst_extent):
 *                 memcpy(dst_data, src_data, itemsize)             # <<<<<<<<<<<<<<
 *                 src_data += src_stride
 *                 dst_data += dst_stride
*/
        (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));

        /* "View.MemoryView":1062
 *             for i in range(dst_extent):
 *                 memcpy(dst_data, src_data, itemsize)
 *                 src_data += src_stride             # <<<<<<<<<<<<<<
 *                 dst_data += dst_stride
 *     else:
*/
        __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);

        /* "View.MemoryView":1063
 *                 memcpy(dst_data, src_data, itemsize)
 *                 src_data += src_stride
 *                 dst_data += dst_stride             # <<<<<<<<<<<<<<
 *     else:
 *         for i in range(dst_extent):
*/
        __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
      }
    }
    __pyx_L4:;

    /* "View.MemoryView":1055
 *     cdef Py_ssize_t dst_stride = dst_strides[0]
 * 
 *     if ndim == 1:             # <<<<<<<<<<<<<<
 *         if (src_stride > 0 and dst_stride > 0 and
 *                 <size_t> src_stride == itemsize == <size_t> dst_stride):
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":1065
 *                 dst_data += dst_stride
 *     else:
 *         for i in range(dst_extent):             # <<<<<<<<<<<<<<
 *             _copy_strided_to_strided(src_data, src_strides + 1,
 *                                      dst_data, dst_strides + 1,
*/
  /*else*/ {
    __pyx_t_3 = __pyx_v_dst_extent;
    __pyx_t_4 = __pyx_t_3;
    for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
      __pyx_v_i = __pyx_t_5;

      /* "View.MemoryView":1066
 *     else:
 *         for i in range(dst_extent):
 *             _copy_strided_to_strided(src_data, src_strides + 1,             # <<<<<<<<<<<<<<
 *                                      dst_data, dst_strides + 1,
 *                                      src_shape + 1, dst_shape + 1,
*/
      _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize);

      /* "View.MemoryView":1070
 *                                      src_shape + 1, dst_shape + 1,
 *                                      ndim - 1, itemsize)
 *             src_data += src_stride             # <<<<<<<<<<<<<<
 *             dst_data += dst_stride
 * 
*/
      __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);

      /* "View.MemoryView":1071
 *                                      ndim - 1, itemsize)
 *             src_data += src_stride
 *             dst_data += dst_stride             # <<<<<<<<<<<<<<
 * 
 * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,
*/
      __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
    }
  }
  __pyx_L3:;

  /* "View.MemoryView":1042
 *         return 'F'
 * 
 * @cython.cdivision(True)             # <<<<<<<<<<<<<<
 * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,
 *                                    char *dst_data, Py_ssize_t *dst_strides,
*/

  /* function exit code */
}

/* "View.MemoryView":1073
 *             dst_data += dst_stride
 * 
 * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
 *                                   __Pyx_memviewslice *dst,
 *                                   int ndim, size_t itemsize) noexcept nogil:
*/

static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) {

  /* "View.MemoryView":1076
 *                                   __Pyx_memviewslice *dst,
 *                                   int ndim, size_t itemsize) noexcept nogil:
 *     _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides,             # <<<<<<<<<<<<<<
 *                              src.shape, dst.shape, ndim, itemsize)
 * 
*/
  _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize);

  /* "View.MemoryView":1073
 *             dst_data += dst_stride
 * 
 * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
 *                                   __Pyx_memviewslice *dst,
 *                                   int ndim, size_t itemsize) noexcept nogil:
*/

  /* function exit code */
}

/* "View.MemoryView":1079
 *                              src.shape, dst.shape, ndim, itemsize)
 * 
 * @cname('__pyx_memoryview_slice_get_size')             # <<<<<<<<<<<<<<
 * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil:
 *     "Return the size of the memory occupied by the slice in number of bytes"
*/

static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) {
  Py_ssize_t __pyx_v_shape;
  Py_ssize_t __pyx_v_size;
  Py_ssize_t __pyx_r;
  Py_ssize_t __pyx_t_1;
  Py_ssize_t *__pyx_t_2;
  Py_ssize_t *__pyx_t_3;
  Py_ssize_t *__pyx_t_4;

  /* "View.MemoryView":1082
 * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil:
 *     "Return the size of the memory occupied by the slice in number of bytes"
 *     cdef Py_ssize_t shape, size = src.memview.view.itemsize             # <<<<<<<<<<<<<<
 * 
 *     for shape in src.shape[:ndim]:
*/
  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
  __pyx_v_size = __pyx_t_1;

  /* "View.MemoryView":1084
 *     cdef Py_ssize_t shape, size = src.memview.view.itemsize
 * 
 *     for shape in src.shape[:ndim]:             # <<<<<<<<<<<<<<
 *         size *= shape
 * 
*/
  __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim);
  for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
    __pyx_t_2 = __pyx_t_4;
    __pyx_v_shape = (__pyx_t_2[0]);

    /* "View.MemoryView":1085
 * 
 *     for shape in src.shape[:ndim]:
 *         size *= shape             # <<<<<<<<<<<<<<
 * 
 *     return size
*/
    __pyx_v_size = (__pyx_v_size * __pyx_v_shape);
  }

  /* "View.MemoryView":1087
 *         size *= shape
 * 
 *     return size             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_fill_contig_strides_array')
*/
  __pyx_r = __pyx_v_size;
  goto __pyx_L0;

  /* "View.MemoryView":1079
 *                              src.shape, dst.shape, ndim, itemsize)
 * 
 * @cname('__pyx_memoryview_slice_get_size')             # <<<<<<<<<<<<<<
 * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil:
 *     "Return the size of the memory occupied by the slice in number of bytes"
*/

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

/* "View.MemoryView":1089
 *     return size
 * 
 * @cname('__pyx_fill_contig_strides_array')             # <<<<<<<<<<<<<<
 * cdef Py_ssize_t fill_contig_strides_array(
 *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
*/

static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) {
  int __pyx_v_idx;
  Py_ssize_t __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;

  /* "View.MemoryView":1099
 *     cdef int idx
 * 
 *     if order == 'F':             # <<<<<<<<<<<<<<
 *         for idx in range(ndim):
 *             strides[idx] = stride
*/
  __pyx_t_1 = (__pyx_v_order == 'F');
  if (__pyx_t_1) {

    /* "View.MemoryView":1100
 * 
 *     if order == 'F':
 *         for idx in range(ndim):             # <<<<<<<<<<<<<<
 *             strides[idx] = stride
 *             stride *= shape[idx]
*/
    __pyx_t_2 = __pyx_v_ndim;
    __pyx_t_3 = __pyx_t_2;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_idx = __pyx_t_4;

      /* "View.MemoryView":1101
 *     if order == 'F':
 *         for idx in range(ndim):
 *             strides[idx] = stride             # <<<<<<<<<<<<<<
 *             stride *= shape[idx]
 *     else:
*/
      (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;

      /* "View.MemoryView":1102
 *         for idx in range(ndim):
 *             strides[idx] = stride
 *             stride *= shape[idx]             # <<<<<<<<<<<<<<
 *     else:
 *         for idx in range(ndim - 1, -1, -1):
*/
      __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
    }

    /* "View.MemoryView":1099
 *     cdef int idx
 * 
 *     if order == 'F':             # <<<<<<<<<<<<<<
 *         for idx in range(ndim):
 *             strides[idx] = stride
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":1104
 *             stride *= shape[idx]
 *     else:
 *         for idx in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
 *             strides[idx] = stride
 *             stride *= shape[idx]
*/
  /*else*/ {
    for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
      __pyx_v_idx = __pyx_t_2;

      /* "View.MemoryView":1105
 *     else:
 *         for idx in range(ndim - 1, -1, -1):
 *             strides[idx] = stride             # <<<<<<<<<<<<<<
 *             stride *= shape[idx]
 * 
*/
      (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;

      /* "View.MemoryView":1106
 *         for idx in range(ndim - 1, -1, -1):
 *             strides[idx] = stride
 *             stride *= shape[idx]             # <<<<<<<<<<<<<<
 * 
 *     return stride
*/
      __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
    }
  }
  __pyx_L3:;

  /* "View.MemoryView":1108
 *             stride *= shape[idx]
 * 
 *     return stride             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_copy_data_to_temp')
*/
  __pyx_r = __pyx_v_stride;
  goto __pyx_L0;

  /* "View.MemoryView":1089
 *     return size
 * 
 * @cname('__pyx_fill_contig_strides_array')             # <<<<<<<<<<<<<<
 * cdef Py_ssize_t fill_contig_strides_array(
 *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
*/

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

/* "View.MemoryView":1110
 *     return stride
 * 
 * @cname('__pyx_memoryview_copy_data_to_temp')             # <<<<<<<<<<<<<<
 * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,
 *                              __Pyx_memviewslice *tmpslice,
*/

static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) {
  int __pyx_v_i;
  void *__pyx_v_result;
  size_t __pyx_v_itemsize;
  size_t __pyx_v_size;
  void *__pyx_r;
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  struct __pyx_memoryview_obj *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save;

  /* "View.MemoryView":1122
 *     cdef void *result
 * 
 *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
 *     cdef size_t size = slice_get_size(src, ndim)
 * 
*/
  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
  __pyx_v_itemsize = __pyx_t_1;

  /* "View.MemoryView":1123
 * 
 *     cdef size_t itemsize = src.memview.view.itemsize
 *     cdef size_t size = slice_get_size(src, ndim)             # <<<<<<<<<<<<<<
 * 
 *     result = malloc(size)
*/
  __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);

  /* "View.MemoryView":1125
 *     cdef size_t size = slice_get_size(src, ndim)
 * 
 *     result = malloc(size)             # <<<<<<<<<<<<<<
 *     if not result:
 *         _err_no_memory()
*/
  __pyx_v_result = malloc(__pyx_v_size);

  /* "View.MemoryView":1126
 * 
 *     result = malloc(size)
 *     if not result:             # <<<<<<<<<<<<<<
 *         _err_no_memory()
 * 
*/
  __pyx_t_2 = (!(__pyx_v_result != 0));
  if (__pyx_t_2) {

    /* "View.MemoryView":1127
 *     result = malloc(size)
 *     if not result:
 *         _err_no_memory()             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_t_3 = __pyx_memoryview_err_no_memory(); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1127, __pyx_L1_error)

    /* "View.MemoryView":1126
 * 
 *     result = malloc(size)
 *     if not result:             # <<<<<<<<<<<<<<
 *         _err_no_memory()
 * 
*/
  }

  /* "View.MemoryView":1130
 * 
 * 
 *     tmpslice.data = <char *> result             # <<<<<<<<<<<<<<
 *     tmpslice.memview = src.memview
 *     for i in range(ndim):
*/
  __pyx_v_tmpslice->data = ((char *)__pyx_v_result);

  /* "View.MemoryView":1131
 * 
 *     tmpslice.data = <char *> result
 *     tmpslice.memview = src.memview             # <<<<<<<<<<<<<<
 *     for i in range(ndim):
 *         tmpslice.shape[i] = src.shape[i]
*/
  __pyx_t_4 = __pyx_v_src->memview;
  __pyx_v_tmpslice->memview = __pyx_t_4;

  /* "View.MemoryView":1132
 *     tmpslice.data = <char *> result
 *     tmpslice.memview = src.memview
 *     for i in range(ndim):             # <<<<<<<<<<<<<<
 *         tmpslice.shape[i] = src.shape[i]
 *         tmpslice.suboffsets[i] = -1
*/
  __pyx_t_3 = __pyx_v_ndim;
  __pyx_t_5 = __pyx_t_3;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
    __pyx_v_i = __pyx_t_6;

    /* "View.MemoryView":1133
 *     tmpslice.memview = src.memview
 *     for i in range(ndim):
 *         tmpslice.shape[i] = src.shape[i]             # <<<<<<<<<<<<<<
 *         tmpslice.suboffsets[i] = -1
 * 
*/
    (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);

    /* "View.MemoryView":1134
 *     for i in range(ndim):
 *         tmpslice.shape[i] = src.shape[i]
 *         tmpslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
 * 
 *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order)
*/
    (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L;
  }

  /* "View.MemoryView":1136
 *         tmpslice.suboffsets[i] = -1
 * 
 *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order));

  /* "View.MemoryView":1139
 * 
 * 
 *     for i in range(ndim):             # <<<<<<<<<<<<<<
 *         if tmpslice.shape[i] == 1:
 *             tmpslice.strides[i] = 0
*/
  __pyx_t_3 = __pyx_v_ndim;
  __pyx_t_5 = __pyx_t_3;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
    __pyx_v_i = __pyx_t_6;

    /* "View.MemoryView":1140
 * 
 *     for i in range(ndim):
 *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
 *             tmpslice.strides[i] = 0
 * 
*/
    __pyx_t_2 = ((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1);
    if (__pyx_t_2) {

      /* "View.MemoryView":1141
 *     for i in range(ndim):
 *         if tmpslice.shape[i] == 1:
 *             tmpslice.strides[i] = 0             # <<<<<<<<<<<<<<
 * 
 *     if slice_is_contig(src[0], order, ndim):
*/
      (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;

      /* "View.MemoryView":1140
 * 
 *     for i in range(ndim):
 *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
 *             tmpslice.strides[i] = 0
 * 
*/
    }
  }

  /* "View.MemoryView":1143
 *             tmpslice.strides[i] = 0
 * 
 *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
 *         memcpy(result, src.data, size)
 *     else:
*/
  __pyx_t_2 = __pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim);
  if (__pyx_t_2) {

    /* "View.MemoryView":1144
 * 
 *     if slice_is_contig(src[0], order, ndim):
 *         memcpy(result, src.data, size)             # <<<<<<<<<<<<<<
 *     else:
 *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
*/
    (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));

    /* "View.MemoryView":1143
 *             tmpslice.strides[i] = 0
 * 
 *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
 *         memcpy(result, src.data, size)
 *     else:
*/
    goto __pyx_L9;
  }

  /* "View.MemoryView":1146
 *         memcpy(result, src.data, size)
 *     else:
 *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)             # <<<<<<<<<<<<<<
 * 
 *     return result
*/
  /*else*/ {
    copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
  }
  __pyx_L9:;

  /* "View.MemoryView":1148
 *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "View.MemoryView":1110
 *     return stride
 * 
 * @cname('__pyx_memoryview_copy_data_to_temp')             # <<<<<<<<<<<<<<
 * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,
 *                              __Pyx_memviewslice *tmpslice,
*/

  /* function exit code */
  __pyx_L1_error:;
  __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1152
 * 
 * 
 * @cname('__pyx_memoryview_err_extents')             # <<<<<<<<<<<<<<
 * cdef int _err_extents(int i, Py_ssize_t extent1,
 *                              Py_ssize_t extent2) except -1 with gil:
*/

static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4[7];
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_err_extents", 0);

  /* "View.MemoryView":1155
 * cdef int _err_extents(int i, Py_ssize_t extent1,
 *                              Py_ssize_t extent2) except -1 with gil:
 *     raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})"             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_err_dim')
*/
  __pyx_t_1 = __Pyx_PyUnicode_From_int(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent1, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent2, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_got_differing_extents_in_dimensi;
  __pyx_t_4[1] = __pyx_t_1;
  __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u_got;
  __pyx_t_4[3] = __pyx_t_2;
  __pyx_t_4[4] = __pyx_mstate_global->__pyx_kp_u_and;
  __pyx_t_4[5] = __pyx_t_3;
  __pyx_t_4[6] = __pyx_mstate_global->__pyx_kp_u__5;
  __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_4, 7, 35 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 5 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127);
  if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_5, 0, 0);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __PYX_ERR(1, 1155, __pyx_L1_error)

  /* "View.MemoryView":1152
 * 
 * 
 * @cname('__pyx_memoryview_err_extents')             # <<<<<<<<<<<<<<
 * cdef int _err_extents(int i, Py_ssize_t extent1,
 *                              Py_ssize_t extent2) except -1 with gil:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "View.MemoryView":1157
 *     raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})"
 * 
 * @cname('__pyx_memoryview_err_dim')             # <<<<<<<<<<<<<<
 * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil:
 *     raise <object>error, msg % dim
*/

static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, PyObject *__pyx_v_msg, int __pyx_v_dim) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_err_dim", 0);
  __Pyx_INCREF(__pyx_v_msg);

  /* "View.MemoryView":1159
 * @cname('__pyx_memoryview_err_dim')
 * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil:
 *     raise <object>error, msg % dim             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_err')
*/
  __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyUnicode_FormatSafe(__pyx_v_msg, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_t_2, 0, 0);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __PYX_ERR(1, 1159, __pyx_L1_error)

  /* "View.MemoryView":1157
 *     raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})"
 * 
 * @cname('__pyx_memoryview_err_dim')             # <<<<<<<<<<<<<<
 * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil:
 *     raise <object>error, msg % dim
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "View.MemoryView":1161
 *     raise <object>error, msg % dim
 * 
 * @cname('__pyx_memoryview_err')             # <<<<<<<<<<<<<<
 * cdef int _err(PyObject *error, str msg) except -1 with gil:
 *     raise <object>error, msg
*/

static int __pyx_memoryview_err(PyObject *__pyx_v_error, PyObject *__pyx_v_msg) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_err", 0);
  __Pyx_INCREF(__pyx_v_msg);

  /* "View.MemoryView":1163
 * @cname('__pyx_memoryview_err')
 * cdef int _err(PyObject *error, str msg) except -1 with gil:
 *     raise <object>error, msg             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_err_no_memory')
*/
  __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_v_msg, 0, 0);
  __PYX_ERR(1, 1163, __pyx_L1_error)

  /* "View.MemoryView":1161
 *     raise <object>error, msg % dim
 * 
 * @cname('__pyx_memoryview_err')             # <<<<<<<<<<<<<<
 * cdef int _err(PyObject *error, str msg) except -1 with gil:
 *     raise <object>error, msg
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "View.MemoryView":1165
 *     raise <object>error, msg
 * 
 * @cname('__pyx_memoryview_err_no_memory')             # <<<<<<<<<<<<<<
 * cdef int _err_no_memory() except -1 with gil:
 *     raise MemoryError
*/

static int __pyx_memoryview_err_no_memory(void) {
  int __pyx_r;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();

  /* "View.MemoryView":1167
 * @cname('__pyx_memoryview_err_no_memory')
 * cdef int _err_no_memory() except -1 with gil:
 *     raise MemoryError             # <<<<<<<<<<<<<<
 * 
 * 
*/
  PyErr_NoMemory(); __PYX_ERR(1, 1167, __pyx_L1_error)

  /* "View.MemoryView":1165
 *     raise <object>error, msg
 * 
 * @cname('__pyx_memoryview_err_no_memory')             # <<<<<<<<<<<<<<
 * cdef int _err_no_memory() except -1 with gil:
 *     raise MemoryError
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("View.MemoryView._err_no_memory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "View.MemoryView":1170
 * 
 * 
 * @cname('__pyx_memoryview_copy_contents')             # <<<<<<<<<<<<<<
 * cdef int memoryview_copy_contents(__Pyx_memviewslice src,
 *                                   __Pyx_memviewslice dst,
*/

static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) {
  void *__pyx_v_tmpdata;
  size_t __pyx_v_itemsize;
  int __pyx_v_i;
  char __pyx_v_order;
  int __pyx_v_broadcasting;
  int __pyx_v_direct_copy;
  __Pyx_memviewslice __pyx_v_tmp;
  int __pyx_v_ndim;
  int __pyx_r;
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  void *__pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save;

  /* "View.MemoryView":1179
 *     Check for overlapping memory and verify the shapes.
 *     """
 *     cdef void *tmpdata = NULL             # <<<<<<<<<<<<<<
 *     cdef size_t itemsize = src.memview.view.itemsize
 *     cdef int i
*/
  __pyx_v_tmpdata = NULL;

  /* "View.MemoryView":1180
 *     """
 *     cdef void *tmpdata = NULL
 *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
 *     cdef int i
 *     cdef char order = get_best_order(&src, src_ndim)
*/
  __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
  __pyx_v_itemsize = __pyx_t_1;

  /* "View.MemoryView":1182
 *     cdef size_t itemsize = src.memview.view.itemsize
 *     cdef int i
 *     cdef char order = get_best_order(&src, src_ndim)             # <<<<<<<<<<<<<<
 *     cdef bint broadcasting = False
 *     cdef bint direct_copy = False
*/
  __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);

  /* "View.MemoryView":1183
 *     cdef int i
 *     cdef char order = get_best_order(&src, src_ndim)
 *     cdef bint broadcasting = False             # <<<<<<<<<<<<<<
 *     cdef bint direct_copy = False
 *     cdef __Pyx_memviewslice tmp
*/
  __pyx_v_broadcasting = 0;

  /* "View.MemoryView":1184
 *     cdef char order = get_best_order(&src, src_ndim)
 *     cdef bint broadcasting = False
 *     cdef bint direct_copy = False             # <<<<<<<<<<<<<<
 *     cdef __Pyx_memviewslice tmp
 * 
*/
  __pyx_v_direct_copy = 0;

  /* "View.MemoryView":1187
 *     cdef __Pyx_memviewslice tmp
 * 
 *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:
*/
  __pyx_t_2 = (__pyx_v_src_ndim < __pyx_v_dst_ndim);
  if (__pyx_t_2) {

    /* "View.MemoryView":1188
 * 
 *     if src_ndim < dst_ndim:
 *         broadcast_leading(&src, src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
 *     elif dst_ndim < src_ndim:
 *         broadcast_leading(&dst, dst_ndim, src_ndim)
*/
    __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);

    /* "View.MemoryView":1187
 *     cdef __Pyx_memviewslice tmp
 * 
 *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":1189
 *     if src_ndim < dst_ndim:
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
 *         broadcast_leading(&dst, dst_ndim, src_ndim)
 * 
*/
  __pyx_t_2 = (__pyx_v_dst_ndim < __pyx_v_src_ndim);
  if (__pyx_t_2) {

    /* "View.MemoryView":1190
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:
 *         broadcast_leading(&dst, dst_ndim, src_ndim)             # <<<<<<<<<<<<<<
 * 
 *     cdef int ndim = max(src_ndim, dst_ndim)
*/
    __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);

    /* "View.MemoryView":1189
 *     if src_ndim < dst_ndim:
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
 *         broadcast_leading(&dst, dst_ndim, src_ndim)
 * 
*/
  }
  __pyx_L3:;

  /* "View.MemoryView":1192
 *         broadcast_leading(&dst, dst_ndim, src_ndim)
 * 
 *     cdef int ndim = max(src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ndim):
*/
  __pyx_t_3 = __pyx_v_dst_ndim;
  __pyx_t_4 = __pyx_v_src_ndim;
  __pyx_t_2 = (__pyx_t_3 > __pyx_t_4);
  if (__pyx_t_2) {
    __pyx_t_5 = __pyx_t_3;
  } else {
    __pyx_t_5 = __pyx_t_4;
  }
  __pyx_v_ndim = __pyx_t_5;

  /* "View.MemoryView":1194
 *     cdef int ndim = max(src_ndim, dst_ndim)
 * 
 *     for i in range(ndim):             # <<<<<<<<<<<<<<
 *         if src.shape[i] != dst.shape[i]:
 *             if src.shape[i] == 1:
*/
  __pyx_t_5 = __pyx_v_ndim;
  __pyx_t_3 = __pyx_t_5;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "View.MemoryView":1195
 * 
 *     for i in range(ndim):
 *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
 *             if src.shape[i] == 1:
 *                 broadcasting = True
*/
    __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i]));
    if (__pyx_t_2) {

      /* "View.MemoryView":1196
 *     for i in range(ndim):
 *         if src.shape[i] != dst.shape[i]:
 *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
 *                 broadcasting = True
 *                 src.strides[i] = 0
*/
      __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) == 1);
      if (__pyx_t_2) {

        /* "View.MemoryView":1197
 *         if src.shape[i] != dst.shape[i]:
 *             if src.shape[i] == 1:
 *                 broadcasting = True             # <<<<<<<<<<<<<<
 *                 src.strides[i] = 0
 *             else:
*/
        __pyx_v_broadcasting = 1;

        /* "View.MemoryView":1198
 *             if src.shape[i] == 1:
 *                 broadcasting = True
 *                 src.strides[i] = 0             # <<<<<<<<<<<<<<
 *             else:
 *                 _err_extents(i, dst.shape[i], src.shape[i])
*/
        (__pyx_v_src.strides[__pyx_v_i]) = 0;

        /* "View.MemoryView":1196
 *     for i in range(ndim):
 *         if src.shape[i] != dst.shape[i]:
 *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
 *                 broadcasting = True
 *                 src.strides[i] = 0
*/
        goto __pyx_L7;
      }

      /* "View.MemoryView":1200
 *                 src.strides[i] = 0
 *             else:
 *                 _err_extents(i, dst.shape[i], src.shape[i])             # <<<<<<<<<<<<<<
 * 
 *         if src.suboffsets[i] >= 0:
*/
      /*else*/ {
        __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1200, __pyx_L1_error)
      }
      __pyx_L7:;

      /* "View.MemoryView":1195
 * 
 *     for i in range(ndim):
 *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
 *             if src.shape[i] == 1:
 *                 broadcasting = True
*/
    }

    /* "View.MemoryView":1202
 *                 _err_extents(i, dst.shape[i], src.shape[i])
 * 
 *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
 *             _err_dim(PyExc_ValueError, "Dimension %d is not direct", i)
 * 
*/
    __pyx_t_2 = ((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1203
 * 
 *         if src.suboffsets[i] >= 0:
 *             _err_dim(PyExc_ValueError, "Dimension %d is not direct", i)             # <<<<<<<<<<<<<<
 * 
 *     if slices_overlap(&src, &dst, ndim, itemsize):
*/
      __pyx_t_6 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_mstate_global->__pyx_kp_u_Dimension_d_is_not_direct, __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1203, __pyx_L1_error)

      /* "View.MemoryView":1202
 *                 _err_extents(i, dst.shape[i], src.shape[i])
 * 
 *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
 *             _err_dim(PyExc_ValueError, "Dimension %d is not direct", i)
 * 
*/
    }
  }

  /* "View.MemoryView":1205
 *             _err_dim(PyExc_ValueError, "Dimension %d is not direct", i)
 * 
 *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
 * 
 *         if not slice_is_contig(src, order, ndim):
*/
  __pyx_t_2 = __pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
  if (__pyx_t_2) {

    /* "View.MemoryView":1207
 *     if slices_overlap(&src, &dst, ndim, itemsize):
 * 
 *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
 *             order = get_best_order(&dst, ndim)
 * 
*/
    __pyx_t_2 = (!__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim));
    if (__pyx_t_2) {

      /* "View.MemoryView":1208
 * 
 *         if not slice_is_contig(src, order, ndim):
 *             order = get_best_order(&dst, ndim)             # <<<<<<<<<<<<<<
 * 
 *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
*/
      __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);

      /* "View.MemoryView":1207
 *     if slices_overlap(&src, &dst, ndim, itemsize):
 * 
 *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
 *             order = get_best_order(&dst, ndim)
 * 
*/
    }

    /* "View.MemoryView":1210
 *             order = get_best_order(&dst, ndim)
 * 
 *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)             # <<<<<<<<<<<<<<
 *         src = tmp
 * 
*/
    __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(1, 1210, __pyx_L1_error)
    __pyx_v_tmpdata = __pyx_t_7;

    /* "View.MemoryView":1211
 * 
 *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
 *         src = tmp             # <<<<<<<<<<<<<<
 * 
 *     if not broadcasting:
*/
    __pyx_v_src = __pyx_v_tmp;

    /* "View.MemoryView":1205
 *             _err_dim(PyExc_ValueError, "Dimension %d is not direct", i)
 * 
 *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
 * 
 *         if not slice_is_contig(src, order, ndim):
*/
  }

  /* "View.MemoryView":1213
 *         src = tmp
 * 
 *     if not broadcasting:             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_2 = (!__pyx_v_broadcasting);
  if (__pyx_t_2) {

    /* "View.MemoryView":1216
 * 
 * 
 *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):
*/
    __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim);
    if (__pyx_t_2) {

      /* "View.MemoryView":1217
 * 
 *         if slice_is_contig(src, 'C', ndim):
 *             direct_copy = slice_is_contig(dst, 'C', ndim)             # <<<<<<<<<<<<<<
 *         elif slice_is_contig(src, 'F', ndim):
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
*/
      __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim);

      /* "View.MemoryView":1216
 * 
 * 
 *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):
*/
      goto __pyx_L12;
    }

    /* "View.MemoryView":1218
 *         if slice_is_contig(src, 'C', ndim):
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 * 
*/
    __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim);
    if (__pyx_t_2) {

      /* "View.MemoryView":1219
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):
 *             direct_copy = slice_is_contig(dst, 'F', ndim)             # <<<<<<<<<<<<<<
 * 
 *         if direct_copy:
*/
      __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim);

      /* "View.MemoryView":1218
 *         if slice_is_contig(src, 'C', ndim):
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 * 
*/
    }
    __pyx_L12:;

    /* "View.MemoryView":1221
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 * 
 *         if direct_copy:             # <<<<<<<<<<<<<<
 * 
 *             refcount_copying(&dst, dtype_is_object, ndim, inc=False)
*/
    if (__pyx_v_direct_copy) {

      /* "View.MemoryView":1223
 *         if direct_copy:
 * 
 *             refcount_copying(&dst, dtype_is_object, ndim, inc=False)             # <<<<<<<<<<<<<<
 *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
 *             refcount_copying(&dst, dtype_is_object, ndim, inc=True)
*/
      __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);

      /* "View.MemoryView":1224
 * 
 *             refcount_copying(&dst, dtype_is_object, ndim, inc=False)
 *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))             # <<<<<<<<<<<<<<
 *             refcount_copying(&dst, dtype_is_object, ndim, inc=True)
 *             free(tmpdata)
*/
      (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)));

      /* "View.MemoryView":1225
 *             refcount_copying(&dst, dtype_is_object, ndim, inc=False)
 *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
 *             refcount_copying(&dst, dtype_is_object, ndim, inc=True)             # <<<<<<<<<<<<<<
 *             free(tmpdata)
 *             return 0
*/
      __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);

      /* "View.MemoryView":1226
 *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
 *             refcount_copying(&dst, dtype_is_object, ndim, inc=True)
 *             free(tmpdata)             # <<<<<<<<<<<<<<
 *             return 0
 * 
*/
      free(__pyx_v_tmpdata);

      /* "View.MemoryView":1227
 *             refcount_copying(&dst, dtype_is_object, ndim, inc=True)
 *             free(tmpdata)
 *             return 0             # <<<<<<<<<<<<<<
 * 
 *     if order == 'F' == get_best_order(&dst, ndim):
*/
      __pyx_r = 0;
      goto __pyx_L0;

      /* "View.MemoryView":1221
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 * 
 *         if direct_copy:             # <<<<<<<<<<<<<<
 * 
 *             refcount_copying(&dst, dtype_is_object, ndim, inc=False)
*/
    }

    /* "View.MemoryView":1213
 *         src = tmp
 * 
 *     if not broadcasting:             # <<<<<<<<<<<<<<
 * 
 * 
*/
  }

  /* "View.MemoryView":1229
 *             return 0
 * 
 *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_2 = (__pyx_v_order == 'F');
  if (__pyx_t_2) {
    __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
  }
  if (__pyx_t_2) {

    /* "View.MemoryView":1232
 * 
 * 
 *         transpose_memslice(&src)             # <<<<<<<<<<<<<<
 *         transpose_memslice(&dst)
 * 
*/
    __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1232, __pyx_L1_error)

    /* "View.MemoryView":1233
 * 
 *         transpose_memslice(&src)
 *         transpose_memslice(&dst)             # <<<<<<<<<<<<<<
 * 
 *     refcount_copying(&dst, dtype_is_object, ndim, inc=False)
*/
    __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1233, __pyx_L1_error)

    /* "View.MemoryView":1229
 *             return 0
 * 
 *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
 * 
 * 
*/
  }

  /* "View.MemoryView":1235
 *         transpose_memslice(&dst)
 * 
 *     refcount_copying(&dst, dtype_is_object, ndim, inc=False)             # <<<<<<<<<<<<<<
 *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
 *     refcount_copying(&dst, dtype_is_object, ndim, inc=True)
*/
  __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);

  /* "View.MemoryView":1236
 * 
 *     refcount_copying(&dst, dtype_is_object, ndim, inc=False)
 *     copy_strided_to_strided(&src, &dst, ndim, itemsize)             # <<<<<<<<<<<<<<
 *     refcount_copying(&dst, dtype_is_object, ndim, inc=True)
 * 
*/
  copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);

  /* "View.MemoryView":1237
 *     refcount_copying(&dst, dtype_is_object, ndim, inc=False)
 *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
 *     refcount_copying(&dst, dtype_is_object, ndim, inc=True)             # <<<<<<<<<<<<<<
 * 
 *     free(tmpdata)
*/
  __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);

  /* "View.MemoryView":1239
 *     refcount_copying(&dst, dtype_is_object, ndim, inc=True)
 * 
 *     free(tmpdata)             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
  free(__pyx_v_tmpdata);

  /* "View.MemoryView":1240
 * 
 *     free(tmpdata)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_broadcast_leading')
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "View.MemoryView":1170
 * 
 * 
 * @cname('__pyx_memoryview_copy_contents')             # <<<<<<<<<<<<<<
 * cdef int memoryview_copy_contents(__Pyx_memviewslice src,
 *                                   __Pyx_memviewslice dst,
*/

  /* function exit code */
  __pyx_L1_error:;
  __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1242
 *     return 0
 * 
 * @cname('__pyx_memoryview_broadcast_leading')             # <<<<<<<<<<<<<<
 * cdef void broadcast_leading(__Pyx_memviewslice *mslice,
 *                             int ndim,
*/

static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) {
  int __pyx_v_i;
  int __pyx_v_offset;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "View.MemoryView":1247
 *                             int ndim_other) noexcept nogil:
 *     cdef int i
 *     cdef int offset = ndim_other - ndim             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ndim - 1, -1, -1):
*/
  __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);

  /* "View.MemoryView":1249
 *     cdef int offset = ndim_other - ndim
 * 
 *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
 *         mslice.shape[i + offset] = mslice.shape[i]
 *         mslice.strides[i + offset] = mslice.strides[i]
*/
  for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
    __pyx_v_i = __pyx_t_1;

    /* "View.MemoryView":1250
 * 
 *     for i in range(ndim - 1, -1, -1):
 *         mslice.shape[i + offset] = mslice.shape[i]             # <<<<<<<<<<<<<<
 *         mslice.strides[i + offset] = mslice.strides[i]
 *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
*/
    (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);

    /* "View.MemoryView":1251
 *     for i in range(ndim - 1, -1, -1):
 *         mslice.shape[i + offset] = mslice.shape[i]
 *         mslice.strides[i + offset] = mslice.strides[i]             # <<<<<<<<<<<<<<
 *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
 * 
*/
    (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);

    /* "View.MemoryView":1252
 *         mslice.shape[i + offset] = mslice.shape[i]
 *         mslice.strides[i + offset] = mslice.strides[i]
 *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]             # <<<<<<<<<<<<<<
 * 
 *     for i in range(offset):
*/
    (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
  }

  /* "View.MemoryView":1254
 *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
 * 
 *     for i in range(offset):             # <<<<<<<<<<<<<<
 *         mslice.shape[i] = 1
 *         mslice.strides[i] = mslice.strides[0]
*/
  __pyx_t_1 = __pyx_v_offset;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "View.MemoryView":1255
 * 
 *     for i in range(offset):
 *         mslice.shape[i] = 1             # <<<<<<<<<<<<<<
 *         mslice.strides[i] = mslice.strides[0]
 *         mslice.suboffsets[i] = -1
*/
    (__pyx_v_mslice->shape[__pyx_v_i]) = 1;

    /* "View.MemoryView":1256
 *     for i in range(offset):
 *         mslice.shape[i] = 1
 *         mslice.strides[i] = mslice.strides[0]             # <<<<<<<<<<<<<<
 *         mslice.suboffsets[i] = -1
 * 
*/
    (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);

    /* "View.MemoryView":1257
 *         mslice.shape[i] = 1
 *         mslice.strides[i] = mslice.strides[0]
 *         mslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
 * 
 * 
*/
    (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L;
  }

  /* "View.MemoryView":1242
 *     return 0
 * 
 * @cname('__pyx_memoryview_broadcast_leading')             # <<<<<<<<<<<<<<
 * cdef void broadcast_leading(__Pyx_memviewslice *mslice,
 *                             int ndim,
*/

  /* function exit code */
}

/* "View.MemoryView":1264
 * 
 * 
 * @cname('__pyx_memoryview_refcount_copying')             # <<<<<<<<<<<<<<
 * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil:
 * 
*/

static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) {

  /* "View.MemoryView":1267
 * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil:
 * 
 *     if dtype_is_object:             # <<<<<<<<<<<<<<
 *         refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc)
 * 
*/
  if (__pyx_v_dtype_is_object) {

    /* "View.MemoryView":1268
 * 
 *     if dtype_is_object:
 *         refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc)             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
*/
    __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc);

    /* "View.MemoryView":1267
 * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil:
 * 
 *     if dtype_is_object:             # <<<<<<<<<<<<<<
 *         refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc)
 * 
*/
  }

  /* "View.MemoryView":1264
 * 
 * 
 * @cname('__pyx_memoryview_refcount_copying')             # <<<<<<<<<<<<<<
 * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil:
 * 
*/

  /* function exit code */
}

/* "View.MemoryView":1270
 *         refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc)
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')             # <<<<<<<<<<<<<<
 * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,
 *                                              Py_ssize_t *strides, int ndim,
*/

static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) {
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();

  /* "View.MemoryView":1274
 *                                              Py_ssize_t *strides, int ndim,
 *                                              bint inc) noexcept with gil:
 *     refcount_objects_in_slice(data, shape, strides, ndim, inc)             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice')
*/
  __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);

  /* "View.MemoryView":1270
 *         refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc)
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')             # <<<<<<<<<<<<<<
 * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,
 *                                              Py_ssize_t *strides, int ndim,
*/

  /* function exit code */
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
}

/* "View.MemoryView":1276
 *     refcount_objects_in_slice(data, shape, strides, ndim, inc)
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice')             # <<<<<<<<<<<<<<
 * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,
 *                                     Py_ssize_t *strides, int ndim, bint inc) noexcept:
*/

static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) {
  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_stride;
  Py_ssize_t __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;

  /* "View.MemoryView":1280
 *                                     Py_ssize_t *strides, int ndim, bint inc) noexcept:
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t stride = strides[0]             # <<<<<<<<<<<<<<
 * 
 *     for i in range(shape[0]):
*/
  __pyx_v_stride = (__pyx_v_strides[0]);

  /* "View.MemoryView":1282
 *     cdef Py_ssize_t stride = strides[0]
 * 
 *     for i in range(shape[0]):             # <<<<<<<<<<<<<<
 *         if ndim == 1:
 *             if inc:
*/
  __pyx_t_1 = (__pyx_v_shape[0]);
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "View.MemoryView":1283
 * 
 *     for i in range(shape[0]):
 *         if ndim == 1:             # <<<<<<<<<<<<<<
 *             if inc:
 *                 Py_INCREF((<PyObject **> data)[0])
*/
    __pyx_t_4 = (__pyx_v_ndim == 1);
    if (__pyx_t_4) {

      /* "View.MemoryView":1284
 *     for i in range(shape[0]):
 *         if ndim == 1:
 *             if inc:             # <<<<<<<<<<<<<<
 *                 Py_INCREF((<PyObject **> data)[0])
 *             else:
*/
      if (__pyx_v_inc) {

        /* "View.MemoryView":1285
 *         if ndim == 1:
 *             if inc:
 *                 Py_INCREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
 *             else:
 *                 Py_DECREF((<PyObject **> data)[0])
*/
        Py_INCREF((((PyObject **)__pyx_v_data)[0]));

        /* "View.MemoryView":1284
 *     for i in range(shape[0]):
 *         if ndim == 1:
 *             if inc:             # <<<<<<<<<<<<<<
 *                 Py_INCREF((<PyObject **> data)[0])
 *             else:
*/
        goto __pyx_L6;
      }

      /* "View.MemoryView":1287
 *                 Py_INCREF((<PyObject **> data)[0])
 *             else:
 *                 Py_DECREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
 *         else:
 *             refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc)
*/
      /*else*/ {
        Py_DECREF((((PyObject **)__pyx_v_data)[0]));
      }
      __pyx_L6:;

      /* "View.MemoryView":1283
 * 
 *     for i in range(shape[0]):
 *         if ndim == 1:             # <<<<<<<<<<<<<<
 *             if inc:
 *                 Py_INCREF((<PyObject **> data)[0])
*/
      goto __pyx_L5;
    }

    /* "View.MemoryView":1289
 *                 Py_DECREF((<PyObject **> data)[0])
 *         else:
 *             refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc)             # <<<<<<<<<<<<<<
 * 
 *         data += stride
*/
    /*else*/ {
      __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
    }
    __pyx_L5:;

    /* "View.MemoryView":1291
 *             refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc)
 * 
 *         data += stride             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
  }

  /* "View.MemoryView":1276
 *     refcount_objects_in_slice(data, shape, strides, ndim, inc)
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice')             # <<<<<<<<<<<<<<
 * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,
 *                                     Py_ssize_t *strides, int ndim, bint inc) noexcept:
*/

  /* function exit code */
}

/* "View.MemoryView":1296
 * 
 * 
 * @cname('__pyx_memoryview_slice_assign_scalar')             # <<<<<<<<<<<<<<
 * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,
 *                               size_t itemsize, void *item,
*/

static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) {

  /* "View.MemoryView":1300
 *                               size_t itemsize, void *item,
 *                               bint dtype_is_object) noexcept nogil:
 *     refcount_copying(dst, dtype_is_object, ndim, inc=False)             # <<<<<<<<<<<<<<
 *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item)
 *     refcount_copying(dst, dtype_is_object, ndim, inc=True)
*/
  __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);

  /* "View.MemoryView":1301
 *                               bint dtype_is_object) noexcept nogil:
 *     refcount_copying(dst, dtype_is_object, ndim, inc=False)
 *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item)             # <<<<<<<<<<<<<<
 *     refcount_copying(dst, dtype_is_object, ndim, inc=True)
 * 
*/
  __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item);

  /* "View.MemoryView":1302
 *     refcount_copying(dst, dtype_is_object, ndim, inc=False)
 *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item)
 *     refcount_copying(dst, dtype_is_object, ndim, inc=True)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);

  /* "View.MemoryView":1296
 * 
 * 
 * @cname('__pyx_memoryview_slice_assign_scalar')             # <<<<<<<<<<<<<<
 * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,
 *                               size_t itemsize, void *item,
*/

  /* function exit code */
}

/* "View.MemoryView":1305
 * 
 * 
 * @cname('__pyx_memoryview__slice_assign_scalar')             # <<<<<<<<<<<<<<
 * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,
 *                               Py_ssize_t *strides, int ndim,
*/

static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) {
  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_stride;
  Py_ssize_t __pyx_v_extent;
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;

  /* "View.MemoryView":1310
 *                               size_t itemsize, void *item) noexcept nogil:
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t stride = strides[0]             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t extent = shape[0]
 * 
*/
  __pyx_v_stride = (__pyx_v_strides[0]);

  /* "View.MemoryView":1311
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t stride = strides[0]
 *     cdef Py_ssize_t extent = shape[0]             # <<<<<<<<<<<<<<
 * 
 *     if ndim == 1:
*/
  __pyx_v_extent = (__pyx_v_shape[0]);

  /* "View.MemoryView":1313
 *     cdef Py_ssize_t extent = shape[0]
 * 
 *     if ndim == 1:             # <<<<<<<<<<<<<<
 *         for i in range(extent):
 *             memcpy(data, item, itemsize)
*/
  __pyx_t_1 = (__pyx_v_ndim == 1);
  if (__pyx_t_1) {

    /* "View.MemoryView":1314
 * 
 *     if ndim == 1:
 *         for i in range(extent):             # <<<<<<<<<<<<<<
 *             memcpy(data, item, itemsize)
 *             data += stride
*/
    __pyx_t_2 = __pyx_v_extent;
    __pyx_t_3 = __pyx_t_2;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "View.MemoryView":1315
 *     if ndim == 1:
 *         for i in range(extent):
 *             memcpy(data, item, itemsize)             # <<<<<<<<<<<<<<
 *             data += stride
 *     else:
*/
      (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize));

      /* "View.MemoryView":1316
 *         for i in range(extent):
 *             memcpy(data, item, itemsize)
 *             data += stride             # <<<<<<<<<<<<<<
 *     else:
 *         for i in range(extent):
*/
      __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
    }

    /* "View.MemoryView":1313
 *     cdef Py_ssize_t extent = shape[0]
 * 
 *     if ndim == 1:             # <<<<<<<<<<<<<<
 *         for i in range(extent):
 *             memcpy(data, item, itemsize)
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":1318
 *             data += stride
 *     else:
 *         for i in range(extent):             # <<<<<<<<<<<<<<
 *             _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item)
 *             data += stride
*/
  /*else*/ {
    __pyx_t_2 = __pyx_v_extent;
    __pyx_t_3 = __pyx_t_2;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "View.MemoryView":1319
 *     else:
 *         for i in range(extent):
 *             _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item)             # <<<<<<<<<<<<<<
 *             data += stride
 * 
*/
      __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item);

      /* "View.MemoryView":1320
 *         for i in range(extent):
 *             _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item)
 *             data += stride             # <<<<<<<<<<<<<<
 * 
*/
      __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
    }
  }
  __pyx_L3:;

  /* "View.MemoryView":1305
 * 
 * 
 * @cname('__pyx_memoryview__slice_assign_scalar')             # <<<<<<<<<<<<<<
 * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,
 *                               Py_ssize_t *strides, int ndim,
*/

  /* function exit code */
}

/* "(tree fragment)":4
 *     int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1
 *     int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1
 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name')
*/

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(1, 4, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 4, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 4, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 4, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__pyx_unpickle_Enum", 0) < (0)) __PYX_ERR(1, 4, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, i); __PYX_ERR(1, 4, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 4, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 4, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 4, __pyx_L3_error)
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 4, __pyx_L3_error)
    __pyx_v___pyx_state = ((PyObject*)values[2]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 4, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v___pyx_state), (&PyTuple_Type), 1, "__pyx_state", 1))) __PYX_ERR(1, 4, __pyx_L1_error)
  __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0);

  /* "(tree fragment)":6
 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state):
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name')             # <<<<<<<<<<<<<<
 *     __pyx_result = Enum.__new__(__pyx_type)
 *     if __pyx_state is not None:
*/
  __pyx_t_1 = __Pyx_CheckUnpickleChecksum(__pyx_v___pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, __pyx_k_name); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 6, __pyx_L1_error)

  /* "(tree fragment)":7
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name')
 *     __pyx_result = Enum.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
*/
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_MemviewEnum_type);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_new, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_v___pyx_result = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "(tree fragment)":8
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name')
 *     __pyx_result = Enum.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  __pyx_t_5 = (__pyx_v___pyx_state != ((PyObject*)Py_None));
  if (__pyx_t_5) {

    /* "(tree fragment)":9
 *     __pyx_result = Enum.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple):
*/
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'");
      __PYX_ERR(1, 9, __pyx_L1_error)
    }
    __pyx_t_2 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), __pyx_v___pyx_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "(tree fragment)":8
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name')
 *     __pyx_result = Enum.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple):
 *     __pyx_result.name = __pyx_state[0]
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":4
 *     int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1
 *     int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1
 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name')
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple):             # <<<<<<<<<<<<<<
 *     __pyx_result.name = __pyx_state[0]
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1)
*/

static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple):
 *     __pyx_result.name = __pyx_state[0]             # <<<<<<<<<<<<<<
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1)
*/
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->name);
  __Pyx_DECREF(__pyx_v___pyx_result->name);
  __pyx_v___pyx_result->name = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple):
 *     __pyx_result.name = __pyx_state[0]
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1)             # <<<<<<<<<<<<<<
*/
  __pyx_t_2 = __Pyx_UpdateUnpickledDict(((PyObject *)__pyx_v___pyx_result), __pyx_v___pyx_state, 1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)

  /* "(tree fragment)":11
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple):             # <<<<<<<<<<<<<<
 *     __pyx_result.name = __pyx_state[0]
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pxd":630
 * ) nogil
 * 
 * cdef inline CK_BYTE_buffer(length):             # <<<<<<<<<<<<<<
 *     """Make a buffer for `length` CK_BYTEs."""
 *     return array(shape=(length,), itemsize=sizeof(CK_BYTE), format='B')
*/

static CYTHON_INLINE PyObject *__pyx_f_6pkcs11_7_pkcs11_CK_BYTE_buffer(PyObject *__pyx_v_length) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("CK_BYTE_buffer", 0);

  /* "pkcs11/_pkcs11.pxd":632
 * cdef inline CK_BYTE_buffer(length):
 *     """Make a buffer for `length` CK_BYTEs."""
 *     return array(shape=(length,), itemsize=sizeof(CK_BYTE), format='B')             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 632, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_length);
  __Pyx_GIVEREF(__pyx_v_length);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_length) != (0)) __PYX_ERR(2, 632, __pyx_L1_error);
  __pyx_t_4 = __Pyx_PyLong_FromSize_t((sizeof(CK_BYTE))); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 632, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_2, NULL};
    __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 632, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_shape, __pyx_t_3, __pyx_t_6, __pyx_callargs+1, 0) < (0)) __PYX_ERR(2, 632, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_itemsize, __pyx_t_4, __pyx_t_6, __pyx_callargs+1, 1) < (0)) __PYX_ERR(2, 632, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_format, __pyx_mstate_global->__pyx_n_u_B, __pyx_t_6, __pyx_callargs+1, 2) < (0)) __PYX_ERR(2, 632, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_array_type, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 632, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pxd":630
 * ) nogil
 * 
 * cdef inline CK_BYTE_buffer(length):             # <<<<<<<<<<<<<<
 *     """Make a buffer for `length` CK_BYTEs."""
 *     return array(shape=(length,), itemsize=sizeof(CK_BYTE), format='B')
*/

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

/* "pkcs11/_pkcs11.pxd":635
 * 
 * 
 * cdef inline CK_ULONG_buffer(length):             # <<<<<<<<<<<<<<
 *     """Make a buffer for `length` CK_ULONGs."""
 *     return array(shape=(length,), itemsize=sizeof(CK_ULONG), format='L')
*/

static CYTHON_INLINE PyObject *__pyx_f_6pkcs11_7_pkcs11_CK_ULONG_buffer(PyObject *__pyx_v_length) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("CK_ULONG_buffer", 0);

  /* "pkcs11/_pkcs11.pxd":637
 * cdef inline CK_ULONG_buffer(length):
 *     """Make a buffer for `length` CK_ULONGs."""
 *     return array(shape=(length,), itemsize=sizeof(CK_ULONG), format='L')             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_length);
  __Pyx_GIVEREF(__pyx_v_length);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_length) != (0)) __PYX_ERR(2, 637, __pyx_L1_error);
  __pyx_t_4 = __Pyx_PyLong_FromSize_t((sizeof(CK_ULONG))); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_2, NULL};
    __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 637, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_shape, __pyx_t_3, __pyx_t_6, __pyx_callargs+1, 0) < (0)) __PYX_ERR(2, 637, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_itemsize, __pyx_t_4, __pyx_t_6, __pyx_callargs+1, 1) < (0)) __PYX_ERR(2, 637, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_format, __pyx_mstate_global->__pyx_n_u_L, __pyx_t_6, __pyx_callargs+1, 2) < (0)) __PYX_ERR(2, 637, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_array_type, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 637, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pxd":635
 * 
 * 
 * cdef inline CK_ULONG_buffer(length):             # <<<<<<<<<<<<<<
 *     """Make a buffer for `length` CK_ULONGs."""
 *     return array(shape=(length,), itemsize=sizeof(CK_ULONG), format='L')
*/

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

/* "pkcs11/_pkcs11.pxd":644
 * # to avoid noise in the metrics.
 * 
 * cdef inline object map_rv_to_error(CK_RV rv):  # pragma: nocover             # <<<<<<<<<<<<<<
 *     if rv == CKR_ATTRIBUTE_TYPE_INVALID:
 *         exc = AttributeTypeInvalid()
*/

static CYTHON_INLINE PyObject *__pyx_f_6pkcs11_7_pkcs11_map_rv_to_error(CK_RV __pyx_v_rv) {
  PyObject *__pyx_v_exc = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("map_rv_to_error", 0);

  /* "pkcs11/_pkcs11.pxd":645
 * 
 * cdef inline object map_rv_to_error(CK_RV rv):  # pragma: nocover
 *     if rv == CKR_ATTRIBUTE_TYPE_INVALID:             # <<<<<<<<<<<<<<
 *         exc = AttributeTypeInvalid()
 *     elif rv == CKR_ATTRIBUTE_VALUE_INVALID:
*/
  switch (__pyx_v_rv) {
    case CKR_ATTRIBUTE_TYPE_INVALID:

    /* "pkcs11/_pkcs11.pxd":646
 * cdef inline object map_rv_to_error(CK_RV rv):  # pragma: nocover
 *     if rv == CKR_ATTRIBUTE_TYPE_INVALID:
 *         exc = AttributeTypeInvalid()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_ATTRIBUTE_VALUE_INVALID:
 *         exc = AttributeValueInvalid()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_AttributeTypeInvalid); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 646, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 646, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":645
 * 
 * cdef inline object map_rv_to_error(CK_RV rv):  # pragma: nocover
 *     if rv == CKR_ATTRIBUTE_TYPE_INVALID:             # <<<<<<<<<<<<<<
 *         exc = AttributeTypeInvalid()
 *     elif rv == CKR_ATTRIBUTE_VALUE_INVALID:
*/
    break;
    case CKR_ATTRIBUTE_VALUE_INVALID:

    /* "pkcs11/_pkcs11.pxd":648
 *         exc = AttributeTypeInvalid()
 *     elif rv == CKR_ATTRIBUTE_VALUE_INVALID:
 *         exc = AttributeValueInvalid()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_ATTRIBUTE_READ_ONLY:
 *         exc = AttributeReadOnly()
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_AttributeValueInvalid); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 648, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 648, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":647
 *     if rv == CKR_ATTRIBUTE_TYPE_INVALID:
 *         exc = AttributeTypeInvalid()
 *     elif rv == CKR_ATTRIBUTE_VALUE_INVALID:             # <<<<<<<<<<<<<<
 *         exc = AttributeValueInvalid()
 *     elif rv == CKR_ATTRIBUTE_READ_ONLY:
*/
    break;
    case CKR_ATTRIBUTE_READ_ONLY:

    /* "pkcs11/_pkcs11.pxd":650
 *         exc = AttributeValueInvalid()
 *     elif rv == CKR_ATTRIBUTE_READ_ONLY:
 *         exc = AttributeReadOnly()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_ATTRIBUTE_SENSITIVE:
 *         exc = AttributeSensitive()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_AttributeReadOnly); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 650, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 650, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":649
 *     elif rv == CKR_ATTRIBUTE_VALUE_INVALID:
 *         exc = AttributeValueInvalid()
 *     elif rv == CKR_ATTRIBUTE_READ_ONLY:             # <<<<<<<<<<<<<<
 *         exc = AttributeReadOnly()
 *     elif rv == CKR_ATTRIBUTE_SENSITIVE:
*/
    break;
    case CKR_ATTRIBUTE_SENSITIVE:

    /* "pkcs11/_pkcs11.pxd":652
 *         exc = AttributeReadOnly()
 *     elif rv == CKR_ATTRIBUTE_SENSITIVE:
 *         exc = AttributeSensitive()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_ARGUMENTS_BAD:
 *         exc = ArgumentsBad()
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_AttributeSensitive); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 652, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 652, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":651
 *     elif rv == CKR_ATTRIBUTE_READ_ONLY:
 *         exc = AttributeReadOnly()
 *     elif rv == CKR_ATTRIBUTE_SENSITIVE:             # <<<<<<<<<<<<<<
 *         exc = AttributeSensitive()
 *     elif rv == CKR_ARGUMENTS_BAD:
*/
    break;
    case CKR_ARGUMENTS_BAD:

    /* "pkcs11/_pkcs11.pxd":654
 *         exc = AttributeSensitive()
 *     elif rv == CKR_ARGUMENTS_BAD:
 *         exc = ArgumentsBad()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_BUFFER_TOO_SMALL:
 *         exc = PKCS11Error("Buffer was too small. Should never see this.")
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ArgumentsBad); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 654, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 654, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":653
 *     elif rv == CKR_ATTRIBUTE_SENSITIVE:
 *         exc = AttributeSensitive()
 *     elif rv == CKR_ARGUMENTS_BAD:             # <<<<<<<<<<<<<<
 *         exc = ArgumentsBad()
 *     elif rv == CKR_BUFFER_TOO_SMALL:
*/
    break;
    case CKR_BUFFER_TOO_SMALL:

    /* "pkcs11/_pkcs11.pxd":656
 *         exc = ArgumentsBad()
 *     elif rv == CKR_BUFFER_TOO_SMALL:
 *         exc = PKCS11Error("Buffer was too small. Should never see this.")             # <<<<<<<<<<<<<<
 *     elif rv == CKR_CRYPTOKI_ALREADY_INITIALIZED:
 *         exc = PKCS11Error("Initialisation error (already initialized). Should never see this.")
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_PKCS11Error); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 656, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Buffer_was_too_small_Should_neve};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 656, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":655
 *     elif rv == CKR_ARGUMENTS_BAD:
 *         exc = ArgumentsBad()
 *     elif rv == CKR_BUFFER_TOO_SMALL:             # <<<<<<<<<<<<<<
 *         exc = PKCS11Error("Buffer was too small. Should never see this.")
 *     elif rv == CKR_CRYPTOKI_ALREADY_INITIALIZED:
*/
    break;
    case CKR_CRYPTOKI_ALREADY_INITIALIZED:

    /* "pkcs11/_pkcs11.pxd":658
 *         exc = PKCS11Error("Buffer was too small. Should never see this.")
 *     elif rv == CKR_CRYPTOKI_ALREADY_INITIALIZED:
 *         exc = PKCS11Error("Initialisation error (already initialized). Should never see this.")             # <<<<<<<<<<<<<<
 *     elif rv == CKR_CRYPTOKI_NOT_INITIALIZED:
 *         exc = PKCS11Error("Initialisation error (not initialized). Should never see this.")
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_PKCS11Error); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 658, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_Initialisation_error_already_ini};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 658, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":657
 *     elif rv == CKR_BUFFER_TOO_SMALL:
 *         exc = PKCS11Error("Buffer was too small. Should never see this.")
 *     elif rv == CKR_CRYPTOKI_ALREADY_INITIALIZED:             # <<<<<<<<<<<<<<
 *         exc = PKCS11Error("Initialisation error (already initialized). Should never see this.")
 *     elif rv == CKR_CRYPTOKI_NOT_INITIALIZED:
*/
    break;
    case CKR_CRYPTOKI_NOT_INITIALIZED:

    /* "pkcs11/_pkcs11.pxd":660
 *         exc = PKCS11Error("Initialisation error (already initialized). Should never see this.")
 *     elif rv == CKR_CRYPTOKI_NOT_INITIALIZED:
 *         exc = PKCS11Error("Initialisation error (not initialized). Should never see this.")             # <<<<<<<<<<<<<<
 *     elif rv == CKR_DATA_INVALID:
 *         exc = DataInvalid()
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_PKCS11Error); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 660, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Initialisation_error_not_initial};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 660, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":659
 *     elif rv == CKR_CRYPTOKI_ALREADY_INITIALIZED:
 *         exc = PKCS11Error("Initialisation error (already initialized). Should never see this.")
 *     elif rv == CKR_CRYPTOKI_NOT_INITIALIZED:             # <<<<<<<<<<<<<<
 *         exc = PKCS11Error("Initialisation error (not initialized). Should never see this.")
 *     elif rv == CKR_DATA_INVALID:
*/
    break;
    case CKR_DATA_INVALID:

    /* "pkcs11/_pkcs11.pxd":662
 *         exc = PKCS11Error("Initialisation error (not initialized). Should never see this.")
 *     elif rv == CKR_DATA_INVALID:
 *         exc = DataInvalid()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_DATA_LEN_RANGE:
 *         exc = DataLenRange()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_DataInvalid); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 662, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 662, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":661
 *     elif rv == CKR_CRYPTOKI_NOT_INITIALIZED:
 *         exc = PKCS11Error("Initialisation error (not initialized). Should never see this.")
 *     elif rv == CKR_DATA_INVALID:             # <<<<<<<<<<<<<<
 *         exc = DataInvalid()
 *     elif rv == CKR_DATA_LEN_RANGE:
*/
    break;
    case CKR_DATA_LEN_RANGE:

    /* "pkcs11/_pkcs11.pxd":664
 *         exc = DataInvalid()
 *     elif rv == CKR_DATA_LEN_RANGE:
 *         exc = DataLenRange()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_DOMAIN_PARAMS_INVALID:
 *         exc = DomainParamsInvalid()
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DataLenRange); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 664, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 664, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":663
 *     elif rv == CKR_DATA_INVALID:
 *         exc = DataInvalid()
 *     elif rv == CKR_DATA_LEN_RANGE:             # <<<<<<<<<<<<<<
 *         exc = DataLenRange()
 *     elif rv == CKR_DOMAIN_PARAMS_INVALID:
*/
    break;
    case CKR_DOMAIN_PARAMS_INVALID:

    /* "pkcs11/_pkcs11.pxd":666
 *         exc = DataLenRange()
 *     elif rv == CKR_DOMAIN_PARAMS_INVALID:
 *         exc = DomainParamsInvalid()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_DEVICE_ERROR:
 *         exc = DeviceError()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_DomainParamsInvalid); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 666, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 666, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":665
 *     elif rv == CKR_DATA_LEN_RANGE:
 *         exc = DataLenRange()
 *     elif rv == CKR_DOMAIN_PARAMS_INVALID:             # <<<<<<<<<<<<<<
 *         exc = DomainParamsInvalid()
 *     elif rv == CKR_DEVICE_ERROR:
*/
    break;
    case CKR_DEVICE_ERROR:

    /* "pkcs11/_pkcs11.pxd":668
 *         exc = DomainParamsInvalid()
 *     elif rv == CKR_DEVICE_ERROR:
 *         exc = DeviceError()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_DEVICE_MEMORY:
 *         exc = DeviceMemory()
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DeviceError); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 668, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 668, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":667
 *     elif rv == CKR_DOMAIN_PARAMS_INVALID:
 *         exc = DomainParamsInvalid()
 *     elif rv == CKR_DEVICE_ERROR:             # <<<<<<<<<<<<<<
 *         exc = DeviceError()
 *     elif rv == CKR_DEVICE_MEMORY:
*/
    break;
    case CKR_DEVICE_MEMORY:

    /* "pkcs11/_pkcs11.pxd":670
 *         exc = DeviceError()
 *     elif rv == CKR_DEVICE_MEMORY:
 *         exc = DeviceMemory()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_DEVICE_REMOVED:
 *         exc = DeviceRemoved()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_DeviceMemory); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 670, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 670, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":669
 *     elif rv == CKR_DEVICE_ERROR:
 *         exc = DeviceError()
 *     elif rv == CKR_DEVICE_MEMORY:             # <<<<<<<<<<<<<<
 *         exc = DeviceMemory()
 *     elif rv == CKR_DEVICE_REMOVED:
*/
    break;
    case CKR_DEVICE_REMOVED:

    /* "pkcs11/_pkcs11.pxd":672
 *         exc = DeviceMemory()
 *     elif rv == CKR_DEVICE_REMOVED:
 *         exc = DeviceRemoved()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_ENCRYPTED_DATA_INVALID:
 *         exc = EncryptedDataInvalid()
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DeviceRemoved); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 672, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 672, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":671
 *     elif rv == CKR_DEVICE_MEMORY:
 *         exc = DeviceMemory()
 *     elif rv == CKR_DEVICE_REMOVED:             # <<<<<<<<<<<<<<
 *         exc = DeviceRemoved()
 *     elif rv == CKR_ENCRYPTED_DATA_INVALID:
*/
    break;
    case CKR_ENCRYPTED_DATA_INVALID:

    /* "pkcs11/_pkcs11.pxd":674
 *         exc = DeviceRemoved()
 *     elif rv == CKR_ENCRYPTED_DATA_INVALID:
 *         exc = EncryptedDataInvalid()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_ENCRYPTED_DATA_LEN_RANGE:
 *         exc = EncryptedDataLenRange()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_EncryptedDataInvalid); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 674, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 674, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":673
 *     elif rv == CKR_DEVICE_REMOVED:
 *         exc = DeviceRemoved()
 *     elif rv == CKR_ENCRYPTED_DATA_INVALID:             # <<<<<<<<<<<<<<
 *         exc = EncryptedDataInvalid()
 *     elif rv == CKR_ENCRYPTED_DATA_LEN_RANGE:
*/
    break;
    case CKR_ENCRYPTED_DATA_LEN_RANGE:

    /* "pkcs11/_pkcs11.pxd":676
 *         exc = EncryptedDataInvalid()
 *     elif rv == CKR_ENCRYPTED_DATA_LEN_RANGE:
 *         exc = EncryptedDataLenRange()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_EXCEEDED_MAX_ITERATIONS:
 *         exc = ExceededMaxIterations()
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_EncryptedDataLenRange); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 676, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 676, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":675
 *     elif rv == CKR_ENCRYPTED_DATA_INVALID:
 *         exc = EncryptedDataInvalid()
 *     elif rv == CKR_ENCRYPTED_DATA_LEN_RANGE:             # <<<<<<<<<<<<<<
 *         exc = EncryptedDataLenRange()
 *     elif rv == CKR_EXCEEDED_MAX_ITERATIONS:
*/
    break;
    case CKR_EXCEEDED_MAX_ITERATIONS:

    /* "pkcs11/_pkcs11.pxd":678
 *         exc = EncryptedDataLenRange()
 *     elif rv == CKR_EXCEEDED_MAX_ITERATIONS:
 *         exc = ExceededMaxIterations()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_FUNCTION_CANCELED:
 *         exc = FunctionCancelled()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ExceededMaxIterations); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 678, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 678, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":677
 *     elif rv == CKR_ENCRYPTED_DATA_LEN_RANGE:
 *         exc = EncryptedDataLenRange()
 *     elif rv == CKR_EXCEEDED_MAX_ITERATIONS:             # <<<<<<<<<<<<<<
 *         exc = ExceededMaxIterations()
 *     elif rv == CKR_FUNCTION_CANCELED:
*/
    break;
    case CKR_FUNCTION_CANCELED:

    /* "pkcs11/_pkcs11.pxd":680
 *         exc = ExceededMaxIterations()
 *     elif rv == CKR_FUNCTION_CANCELED:
 *         exc = FunctionCancelled()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_FUNCTION_FAILED:
 *         exc = FunctionFailed()
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FunctionCancelled); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 680, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 680, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":679
 *     elif rv == CKR_EXCEEDED_MAX_ITERATIONS:
 *         exc = ExceededMaxIterations()
 *     elif rv == CKR_FUNCTION_CANCELED:             # <<<<<<<<<<<<<<
 *         exc = FunctionCancelled()
 *     elif rv == CKR_FUNCTION_FAILED:
*/
    break;
    case CKR_FUNCTION_FAILED:

    /* "pkcs11/_pkcs11.pxd":682
 *         exc = FunctionCancelled()
 *     elif rv == CKR_FUNCTION_FAILED:
 *         exc = FunctionFailed()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_FUNCTION_REJECTED:
 *         exc = FunctionRejected()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_FunctionFailed); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 682, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 682, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":681
 *     elif rv == CKR_FUNCTION_CANCELED:
 *         exc = FunctionCancelled()
 *     elif rv == CKR_FUNCTION_FAILED:             # <<<<<<<<<<<<<<
 *         exc = FunctionFailed()
 *     elif rv == CKR_FUNCTION_REJECTED:
*/
    break;
    case CKR_FUNCTION_REJECTED:

    /* "pkcs11/_pkcs11.pxd":684
 *         exc = FunctionFailed()
 *     elif rv == CKR_FUNCTION_REJECTED:
 *         exc = FunctionRejected()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_FUNCTION_NOT_SUPPORTED:
 *         exc = FunctionNotSupported()
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FunctionRejected); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 684, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 684, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":683
 *     elif rv == CKR_FUNCTION_FAILED:
 *         exc = FunctionFailed()
 *     elif rv == CKR_FUNCTION_REJECTED:             # <<<<<<<<<<<<<<
 *         exc = FunctionRejected()
 *     elif rv == CKR_FUNCTION_NOT_SUPPORTED:
*/
    break;
    case CKR_FUNCTION_NOT_SUPPORTED:

    /* "pkcs11/_pkcs11.pxd":686
 *         exc = FunctionRejected()
 *     elif rv == CKR_FUNCTION_NOT_SUPPORTED:
 *         exc = FunctionNotSupported()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_KEY_HANDLE_INVALID:
 *         exc = KeyHandleInvalid()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_FunctionNotSupported); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 686, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 686, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":685
 *     elif rv == CKR_FUNCTION_REJECTED:
 *         exc = FunctionRejected()
 *     elif rv == CKR_FUNCTION_NOT_SUPPORTED:             # <<<<<<<<<<<<<<
 *         exc = FunctionNotSupported()
 *     elif rv == CKR_KEY_HANDLE_INVALID:
*/
    break;
    case CKR_KEY_HANDLE_INVALID:

    /* "pkcs11/_pkcs11.pxd":688
 *         exc = FunctionNotSupported()
 *     elif rv == CKR_KEY_HANDLE_INVALID:
 *         exc = KeyHandleInvalid()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_KEY_INDIGESTIBLE:
 *         exc = KeyIndigestible()
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_KeyHandleInvalid); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 688, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 688, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":687
 *     elif rv == CKR_FUNCTION_NOT_SUPPORTED:
 *         exc = FunctionNotSupported()
 *     elif rv == CKR_KEY_HANDLE_INVALID:             # <<<<<<<<<<<<<<
 *         exc = KeyHandleInvalid()
 *     elif rv == CKR_KEY_INDIGESTIBLE:
*/
    break;
    case CKR_KEY_INDIGESTIBLE:

    /* "pkcs11/_pkcs11.pxd":690
 *         exc = KeyHandleInvalid()
 *     elif rv == CKR_KEY_INDIGESTIBLE:
 *         exc = KeyIndigestible()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_KEY_NEEDED:
 *         exc = KeyNeeded()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_KeyIndigestible); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 690, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 690, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":689
 *     elif rv == CKR_KEY_HANDLE_INVALID:
 *         exc = KeyHandleInvalid()
 *     elif rv == CKR_KEY_INDIGESTIBLE:             # <<<<<<<<<<<<<<
 *         exc = KeyIndigestible()
 *     elif rv == CKR_KEY_NEEDED:
*/
    break;
    case CKR_KEY_NEEDED:

    /* "pkcs11/_pkcs11.pxd":692
 *         exc = KeyIndigestible()
 *     elif rv == CKR_KEY_NEEDED:
 *         exc = KeyNeeded()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_KEY_NOT_NEEDED:
 *         exc = KeyNotNeeded()
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_KeyNeeded); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 692, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 692, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":691
 *     elif rv == CKR_KEY_INDIGESTIBLE:
 *         exc = KeyIndigestible()
 *     elif rv == CKR_KEY_NEEDED:             # <<<<<<<<<<<<<<
 *         exc = KeyNeeded()
 *     elif rv == CKR_KEY_NOT_NEEDED:
*/
    break;
    case CKR_KEY_NOT_NEEDED:

    /* "pkcs11/_pkcs11.pxd":694
 *         exc = KeyNeeded()
 *     elif rv == CKR_KEY_NOT_NEEDED:
 *         exc = KeyNotNeeded()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_KEY_SIZE_RANGE:
 *         exc = KeySizeRange()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_KeyNotNeeded); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 694, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 694, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":693
 *     elif rv == CKR_KEY_NEEDED:
 *         exc = KeyNeeded()
 *     elif rv == CKR_KEY_NOT_NEEDED:             # <<<<<<<<<<<<<<
 *         exc = KeyNotNeeded()
 *     elif rv == CKR_KEY_SIZE_RANGE:
*/
    break;
    case CKR_KEY_SIZE_RANGE:

    /* "pkcs11/_pkcs11.pxd":696
 *         exc = KeyNotNeeded()
 *     elif rv == CKR_KEY_SIZE_RANGE:
 *         exc = KeySizeRange()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_KEY_NOT_WRAPPABLE:
 *         exc = KeyNotWrappable()
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_KeySizeRange); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 696, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 696, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":695
 *     elif rv == CKR_KEY_NOT_NEEDED:
 *         exc = KeyNotNeeded()
 *     elif rv == CKR_KEY_SIZE_RANGE:             # <<<<<<<<<<<<<<
 *         exc = KeySizeRange()
 *     elif rv == CKR_KEY_NOT_WRAPPABLE:
*/
    break;
    case CKR_KEY_NOT_WRAPPABLE:

    /* "pkcs11/_pkcs11.pxd":698
 *         exc = KeySizeRange()
 *     elif rv == CKR_KEY_NOT_WRAPPABLE:
 *         exc = KeyNotWrappable()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_KEY_TYPE_INCONSISTENT:
 *         exc = KeyTypeInconsistent()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_KeyNotWrappable); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 698, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 698, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":697
 *     elif rv == CKR_KEY_SIZE_RANGE:
 *         exc = KeySizeRange()
 *     elif rv == CKR_KEY_NOT_WRAPPABLE:             # <<<<<<<<<<<<<<
 *         exc = KeyNotWrappable()
 *     elif rv == CKR_KEY_TYPE_INCONSISTENT:
*/
    break;
    case CKR_KEY_TYPE_INCONSISTENT:

    /* "pkcs11/_pkcs11.pxd":700
 *         exc = KeyNotWrappable()
 *     elif rv == CKR_KEY_TYPE_INCONSISTENT:
 *         exc = KeyTypeInconsistent()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_KEY_UNEXTRACTABLE:
 *         exc = KeyUnextractable()
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_KeyTypeInconsistent); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 700, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 700, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":699
 *     elif rv == CKR_KEY_NOT_WRAPPABLE:
 *         exc = KeyNotWrappable()
 *     elif rv == CKR_KEY_TYPE_INCONSISTENT:             # <<<<<<<<<<<<<<
 *         exc = KeyTypeInconsistent()
 *     elif rv == CKR_KEY_UNEXTRACTABLE:
*/
    break;
    case CKR_KEY_UNEXTRACTABLE:

    /* "pkcs11/_pkcs11.pxd":702
 *         exc = KeyTypeInconsistent()
 *     elif rv == CKR_KEY_UNEXTRACTABLE:
 *         exc = KeyUnextractable()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_GENERAL_ERROR:
 *         exc = GeneralError()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_KeyUnextractable); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 702, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 702, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":701
 *     elif rv == CKR_KEY_TYPE_INCONSISTENT:
 *         exc = KeyTypeInconsistent()
 *     elif rv == CKR_KEY_UNEXTRACTABLE:             # <<<<<<<<<<<<<<
 *         exc = KeyUnextractable()
 *     elif rv == CKR_GENERAL_ERROR:
*/
    break;
    case CKR_GENERAL_ERROR:

    /* "pkcs11/_pkcs11.pxd":704
 *         exc = KeyUnextractable()
 *     elif rv == CKR_GENERAL_ERROR:
 *         exc = GeneralError()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_HOST_MEMORY:
 *         exc = HostMemory()
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_GeneralError); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 704, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 704, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":703
 *     elif rv == CKR_KEY_UNEXTRACTABLE:
 *         exc = KeyUnextractable()
 *     elif rv == CKR_GENERAL_ERROR:             # <<<<<<<<<<<<<<
 *         exc = GeneralError()
 *     elif rv == CKR_HOST_MEMORY:
*/
    break;
    case CKR_HOST_MEMORY:

    /* "pkcs11/_pkcs11.pxd":706
 *         exc = GeneralError()
 *     elif rv == CKR_HOST_MEMORY:
 *         exc = HostMemory()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_MECHANISM_INVALID:
 *         exc = MechanismInvalid()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_HostMemory); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 706, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 706, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":705
 *     elif rv == CKR_GENERAL_ERROR:
 *         exc = GeneralError()
 *     elif rv == CKR_HOST_MEMORY:             # <<<<<<<<<<<<<<
 *         exc = HostMemory()
 *     elif rv == CKR_MECHANISM_INVALID:
*/
    break;
    case CKR_MECHANISM_INVALID:

    /* "pkcs11/_pkcs11.pxd":708
 *         exc = HostMemory()
 *     elif rv == CKR_MECHANISM_INVALID:
 *         exc = MechanismInvalid()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_MECHANISM_PARAM_INVALID:
 *         exc = MechanismParamInvalid()
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_MechanismInvalid); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 708, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 708, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":707
 *     elif rv == CKR_HOST_MEMORY:
 *         exc = HostMemory()
 *     elif rv == CKR_MECHANISM_INVALID:             # <<<<<<<<<<<<<<
 *         exc = MechanismInvalid()
 *     elif rv == CKR_MECHANISM_PARAM_INVALID:
*/
    break;
    case CKR_MECHANISM_PARAM_INVALID:

    /* "pkcs11/_pkcs11.pxd":710
 *         exc = MechanismInvalid()
 *     elif rv == CKR_MECHANISM_PARAM_INVALID:
 *         exc = MechanismParamInvalid()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_NO_EVENT:
 *         exc = NoEvent()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_MechanismParamInvalid); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 710, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 710, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":709
 *     elif rv == CKR_MECHANISM_INVALID:
 *         exc = MechanismInvalid()
 *     elif rv == CKR_MECHANISM_PARAM_INVALID:             # <<<<<<<<<<<<<<
 *         exc = MechanismParamInvalid()
 *     elif rv == CKR_NO_EVENT:
*/
    break;
    case CKR_NO_EVENT:

    /* "pkcs11/_pkcs11.pxd":712
 *         exc = MechanismParamInvalid()
 *     elif rv == CKR_NO_EVENT:
 *         exc = NoEvent()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_OBJECT_HANDLE_INVALID:
 *         exc = ObjectHandleInvalid()
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_NoEvent); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 712, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 712, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":711
 *     elif rv == CKR_MECHANISM_PARAM_INVALID:
 *         exc = MechanismParamInvalid()
 *     elif rv == CKR_NO_EVENT:             # <<<<<<<<<<<<<<
 *         exc = NoEvent()
 *     elif rv == CKR_OBJECT_HANDLE_INVALID:
*/
    break;
    case CKR_OBJECT_HANDLE_INVALID:

    /* "pkcs11/_pkcs11.pxd":714
 *         exc = NoEvent()
 *     elif rv == CKR_OBJECT_HANDLE_INVALID:
 *         exc = ObjectHandleInvalid()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_OPERATION_ACTIVE:
 *         exc = OperationActive()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ObjectHandleInvalid); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 714, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 714, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":713
 *     elif rv == CKR_NO_EVENT:
 *         exc = NoEvent()
 *     elif rv == CKR_OBJECT_HANDLE_INVALID:             # <<<<<<<<<<<<<<
 *         exc = ObjectHandleInvalid()
 *     elif rv == CKR_OPERATION_ACTIVE:
*/
    break;
    case CKR_OPERATION_ACTIVE:

    /* "pkcs11/_pkcs11.pxd":716
 *         exc = ObjectHandleInvalid()
 *     elif rv == CKR_OPERATION_ACTIVE:
 *         exc = OperationActive()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_OPERATION_NOT_INITIALIZED:
 *         exc = OperationNotInitialized()
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_OperationActive); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 716, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 716, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":715
 *     elif rv == CKR_OBJECT_HANDLE_INVALID:
 *         exc = ObjectHandleInvalid()
 *     elif rv == CKR_OPERATION_ACTIVE:             # <<<<<<<<<<<<<<
 *         exc = OperationActive()
 *     elif rv == CKR_OPERATION_NOT_INITIALIZED:
*/
    break;
    case CKR_OPERATION_NOT_INITIALIZED:

    /* "pkcs11/_pkcs11.pxd":718
 *         exc = OperationActive()
 *     elif rv == CKR_OPERATION_NOT_INITIALIZED:
 *         exc = OperationNotInitialized()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_PIN_EXPIRED:
 *         exc = PinExpired()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_OperationNotInitialized); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 718, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 718, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":717
 *     elif rv == CKR_OPERATION_ACTIVE:
 *         exc = OperationActive()
 *     elif rv == CKR_OPERATION_NOT_INITIALIZED:             # <<<<<<<<<<<<<<
 *         exc = OperationNotInitialized()
 *     elif rv == CKR_PIN_EXPIRED:
*/
    break;
    case CKR_PIN_EXPIRED:

    /* "pkcs11/_pkcs11.pxd":720
 *         exc = OperationNotInitialized()
 *     elif rv == CKR_PIN_EXPIRED:
 *         exc = PinExpired()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_PIN_INCORRECT:
 *         exc = PinIncorrect()
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_PinExpired); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 720, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 720, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":719
 *     elif rv == CKR_OPERATION_NOT_INITIALIZED:
 *         exc = OperationNotInitialized()
 *     elif rv == CKR_PIN_EXPIRED:             # <<<<<<<<<<<<<<
 *         exc = PinExpired()
 *     elif rv == CKR_PIN_INCORRECT:
*/
    break;
    case CKR_PIN_INCORRECT:

    /* "pkcs11/_pkcs11.pxd":722
 *         exc = PinExpired()
 *     elif rv == CKR_PIN_INCORRECT:
 *         exc = PinIncorrect()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_PIN_INVALID:
 *         exc = PinInvalid()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_PinIncorrect); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 722, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 722, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":721
 *     elif rv == CKR_PIN_EXPIRED:
 *         exc = PinExpired()
 *     elif rv == CKR_PIN_INCORRECT:             # <<<<<<<<<<<<<<
 *         exc = PinIncorrect()
 *     elif rv == CKR_PIN_INVALID:
*/
    break;
    case CKR_PIN_INVALID:

    /* "pkcs11/_pkcs11.pxd":724
 *         exc = PinIncorrect()
 *     elif rv == CKR_PIN_INVALID:
 *         exc = PinInvalid()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_PIN_LEN_RANGE:
 *         exc = PinLenRange()
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_PinInvalid); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 724, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 724, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":723
 *     elif rv == CKR_PIN_INCORRECT:
 *         exc = PinIncorrect()
 *     elif rv == CKR_PIN_INVALID:             # <<<<<<<<<<<<<<
 *         exc = PinInvalid()
 *     elif rv == CKR_PIN_LEN_RANGE:
*/
    break;
    case CKR_PIN_LEN_RANGE:

    /* "pkcs11/_pkcs11.pxd":726
 *         exc = PinInvalid()
 *     elif rv == CKR_PIN_LEN_RANGE:
 *         exc = PinLenRange()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_PIN_LOCKED:
 *         exc = PinLocked()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_PinLenRange); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 726, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 726, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":725
 *     elif rv == CKR_PIN_INVALID:
 *         exc = PinInvalid()
 *     elif rv == CKR_PIN_LEN_RANGE:             # <<<<<<<<<<<<<<
 *         exc = PinLenRange()
 *     elif rv == CKR_PIN_LOCKED:
*/
    break;
    case CKR_PIN_LOCKED:

    /* "pkcs11/_pkcs11.pxd":728
 *         exc = PinLenRange()
 *     elif rv == CKR_PIN_LOCKED:
 *         exc = PinLocked()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_PIN_TOO_WEAK:
 *         exc = PinTooWeak()
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_PinLocked); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 728, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 728, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":727
 *     elif rv == CKR_PIN_LEN_RANGE:
 *         exc = PinLenRange()
 *     elif rv == CKR_PIN_LOCKED:             # <<<<<<<<<<<<<<
 *         exc = PinLocked()
 *     elif rv == CKR_PIN_TOO_WEAK:
*/
    break;
    case CKR_PIN_TOO_WEAK:

    /* "pkcs11/_pkcs11.pxd":730
 *         exc = PinLocked()
 *     elif rv == CKR_PIN_TOO_WEAK:
 *         exc = PinTooWeak()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_PUBLIC_KEY_INVALID:
 *         exc = PublicKeyInvalid()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_PinTooWeak); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 730, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 730, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":729
 *     elif rv == CKR_PIN_LOCKED:
 *         exc = PinLocked()
 *     elif rv == CKR_PIN_TOO_WEAK:             # <<<<<<<<<<<<<<
 *         exc = PinTooWeak()
 *     elif rv == CKR_PUBLIC_KEY_INVALID:
*/
    break;
    case CKR_PUBLIC_KEY_INVALID:

    /* "pkcs11/_pkcs11.pxd":732
 *         exc = PinTooWeak()
 *     elif rv == CKR_PUBLIC_KEY_INVALID:
 *         exc = PublicKeyInvalid()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_RANDOM_NO_RNG:
 *         exc = RandomNoRNG()
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_PublicKeyInvalid); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 732, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 732, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":731
 *     elif rv == CKR_PIN_TOO_WEAK:
 *         exc = PinTooWeak()
 *     elif rv == CKR_PUBLIC_KEY_INVALID:             # <<<<<<<<<<<<<<
 *         exc = PublicKeyInvalid()
 *     elif rv == CKR_RANDOM_NO_RNG:
*/
    break;
    case CKR_RANDOM_NO_RNG:

    /* "pkcs11/_pkcs11.pxd":734
 *         exc = PublicKeyInvalid()
 *     elif rv == CKR_RANDOM_NO_RNG:
 *         exc = RandomNoRNG()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_RANDOM_SEED_NOT_SUPPORTED:
 *         exc = RandomSeedNotSupported()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_RandomNoRNG); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 734, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 734, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":733
 *     elif rv == CKR_PUBLIC_KEY_INVALID:
 *         exc = PublicKeyInvalid()
 *     elif rv == CKR_RANDOM_NO_RNG:             # <<<<<<<<<<<<<<
 *         exc = RandomNoRNG()
 *     elif rv == CKR_RANDOM_SEED_NOT_SUPPORTED:
*/
    break;
    case CKR_RANDOM_SEED_NOT_SUPPORTED:

    /* "pkcs11/_pkcs11.pxd":736
 *         exc = RandomNoRNG()
 *     elif rv == CKR_RANDOM_SEED_NOT_SUPPORTED:
 *         exc = RandomSeedNotSupported()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_SESSION_CLOSED:
 *         exc = SessionClosed()
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_RandomSeedNotSupported); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 736, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 736, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":735
 *     elif rv == CKR_RANDOM_NO_RNG:
 *         exc = RandomNoRNG()
 *     elif rv == CKR_RANDOM_SEED_NOT_SUPPORTED:             # <<<<<<<<<<<<<<
 *         exc = RandomSeedNotSupported()
 *     elif rv == CKR_SESSION_CLOSED:
*/
    break;
    case CKR_SESSION_CLOSED:

    /* "pkcs11/_pkcs11.pxd":738
 *         exc = RandomSeedNotSupported()
 *     elif rv == CKR_SESSION_CLOSED:
 *         exc = SessionClosed()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_SESSION_COUNT:
 *         exc = SessionCount()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_SessionClosed); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 738, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 738, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":737
 *     elif rv == CKR_RANDOM_SEED_NOT_SUPPORTED:
 *         exc = RandomSeedNotSupported()
 *     elif rv == CKR_SESSION_CLOSED:             # <<<<<<<<<<<<<<
 *         exc = SessionClosed()
 *     elif rv == CKR_SESSION_COUNT:
*/
    break;
    case CKR_SESSION_COUNT:

    /* "pkcs11/_pkcs11.pxd":740
 *         exc = SessionClosed()
 *     elif rv == CKR_SESSION_COUNT:
 *         exc = SessionCount()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_SESSION_EXISTS:
 *         exc = SessionExists()
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_SessionCount); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 740, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 740, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":739
 *     elif rv == CKR_SESSION_CLOSED:
 *         exc = SessionClosed()
 *     elif rv == CKR_SESSION_COUNT:             # <<<<<<<<<<<<<<
 *         exc = SessionCount()
 *     elif rv == CKR_SESSION_EXISTS:
*/
    break;
    case CKR_SESSION_EXISTS:

    /* "pkcs11/_pkcs11.pxd":742
 *         exc = SessionCount()
 *     elif rv == CKR_SESSION_EXISTS:
 *         exc = SessionExists()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_SESSION_HANDLE_INVALID:
 *         exc = SessionHandleInvalid()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_SessionExists); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 742, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 742, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":741
 *     elif rv == CKR_SESSION_COUNT:
 *         exc = SessionCount()
 *     elif rv == CKR_SESSION_EXISTS:             # <<<<<<<<<<<<<<
 *         exc = SessionExists()
 *     elif rv == CKR_SESSION_HANDLE_INVALID:
*/
    break;
    case CKR_SESSION_HANDLE_INVALID:

    /* "pkcs11/_pkcs11.pxd":744
 *         exc = SessionExists()
 *     elif rv == CKR_SESSION_HANDLE_INVALID:
 *         exc = SessionHandleInvalid()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_SESSION_PARALLEL_NOT_SUPPORTED:
 *         exc = PKCS11Error("Parallel not supported. Should never see this.")
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_SessionHandleInvalid); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 744, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 744, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":743
 *     elif rv == CKR_SESSION_EXISTS:
 *         exc = SessionExists()
 *     elif rv == CKR_SESSION_HANDLE_INVALID:             # <<<<<<<<<<<<<<
 *         exc = SessionHandleInvalid()
 *     elif rv == CKR_SESSION_PARALLEL_NOT_SUPPORTED:
*/
    break;
    case CKR_SESSION_PARALLEL_NOT_SUPPORTED:

    /* "pkcs11/_pkcs11.pxd":746
 *         exc = SessionHandleInvalid()
 *     elif rv == CKR_SESSION_PARALLEL_NOT_SUPPORTED:
 *         exc = PKCS11Error("Parallel not supported. Should never see this.")             # <<<<<<<<<<<<<<
 *     elif rv == CKR_SESSION_READ_ONLY:
 *         exc = SessionReadOnly()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_PKCS11Error); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 746, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_Parallel_not_supported_Should_ne};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 746, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":745
 *     elif rv == CKR_SESSION_HANDLE_INVALID:
 *         exc = SessionHandleInvalid()
 *     elif rv == CKR_SESSION_PARALLEL_NOT_SUPPORTED:             # <<<<<<<<<<<<<<
 *         exc = PKCS11Error("Parallel not supported. Should never see this.")
 *     elif rv == CKR_SESSION_READ_ONLY:
*/
    break;
    case CKR_SESSION_READ_ONLY:

    /* "pkcs11/_pkcs11.pxd":748
 *         exc = PKCS11Error("Parallel not supported. Should never see this.")
 *     elif rv == CKR_SESSION_READ_ONLY:
 *         exc = SessionReadOnly()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_SESSION_READ_ONLY_EXISTS:
 *         exc = SessionReadOnlyExists()
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_SessionReadOnly); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 748, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 748, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":747
 *     elif rv == CKR_SESSION_PARALLEL_NOT_SUPPORTED:
 *         exc = PKCS11Error("Parallel not supported. Should never see this.")
 *     elif rv == CKR_SESSION_READ_ONLY:             # <<<<<<<<<<<<<<
 *         exc = SessionReadOnly()
 *     elif rv == CKR_SESSION_READ_ONLY_EXISTS:
*/
    break;
    case CKR_SESSION_READ_ONLY_EXISTS:

    /* "pkcs11/_pkcs11.pxd":750
 *         exc = SessionReadOnly()
 *     elif rv == CKR_SESSION_READ_ONLY_EXISTS:
 *         exc = SessionReadOnlyExists()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_SESSION_READ_WRITE_SO_EXISTS:
 *         exc = SessionReadWriteSOExists()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_SessionReadOnlyExists); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 750, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 750, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":749
 *     elif rv == CKR_SESSION_READ_ONLY:
 *         exc = SessionReadOnly()
 *     elif rv == CKR_SESSION_READ_ONLY_EXISTS:             # <<<<<<<<<<<<<<
 *         exc = SessionReadOnlyExists()
 *     elif rv == CKR_SESSION_READ_WRITE_SO_EXISTS:
*/
    break;
    case CKR_SESSION_READ_WRITE_SO_EXISTS:

    /* "pkcs11/_pkcs11.pxd":752
 *         exc = SessionReadOnlyExists()
 *     elif rv == CKR_SESSION_READ_WRITE_SO_EXISTS:
 *         exc = SessionReadWriteSOExists()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_SIGNATURE_LEN_RANGE:
 *         exc = SignatureLenRange()
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_SessionReadWriteSOExists); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 752, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 752, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":751
 *     elif rv == CKR_SESSION_READ_ONLY_EXISTS:
 *         exc = SessionReadOnlyExists()
 *     elif rv == CKR_SESSION_READ_WRITE_SO_EXISTS:             # <<<<<<<<<<<<<<
 *         exc = SessionReadWriteSOExists()
 *     elif rv == CKR_SIGNATURE_LEN_RANGE:
*/
    break;
    case CKR_SIGNATURE_LEN_RANGE:

    /* "pkcs11/_pkcs11.pxd":754
 *         exc = SessionReadWriteSOExists()
 *     elif rv == CKR_SIGNATURE_LEN_RANGE:
 *         exc = SignatureLenRange()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_SIGNATURE_INVALID:
 *         exc = SignatureInvalid()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_SignatureLenRange); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 754, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 754, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":753
 *     elif rv == CKR_SESSION_READ_WRITE_SO_EXISTS:
 *         exc = SessionReadWriteSOExists()
 *     elif rv == CKR_SIGNATURE_LEN_RANGE:             # <<<<<<<<<<<<<<
 *         exc = SignatureLenRange()
 *     elif rv == CKR_SIGNATURE_INVALID:
*/
    break;
    case CKR_SIGNATURE_INVALID:

    /* "pkcs11/_pkcs11.pxd":756
 *         exc = SignatureLenRange()
 *     elif rv == CKR_SIGNATURE_INVALID:
 *         exc = SignatureInvalid()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_TEMPLATE_INCOMPLETE:
 *         exc = TemplateIncomplete()
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_SignatureInvalid); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 756, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 756, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":755
 *     elif rv == CKR_SIGNATURE_LEN_RANGE:
 *         exc = SignatureLenRange()
 *     elif rv == CKR_SIGNATURE_INVALID:             # <<<<<<<<<<<<<<
 *         exc = SignatureInvalid()
 *     elif rv == CKR_TEMPLATE_INCOMPLETE:
*/
    break;
    case CKR_TEMPLATE_INCOMPLETE:

    /* "pkcs11/_pkcs11.pxd":758
 *         exc = SignatureInvalid()
 *     elif rv == CKR_TEMPLATE_INCOMPLETE:
 *         exc = TemplateIncomplete()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_TEMPLATE_INCONSISTENT:
 *         exc = TemplateInconsistent()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_TemplateIncomplete); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 758, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 758, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":757
 *     elif rv == CKR_SIGNATURE_INVALID:
 *         exc = SignatureInvalid()
 *     elif rv == CKR_TEMPLATE_INCOMPLETE:             # <<<<<<<<<<<<<<
 *         exc = TemplateIncomplete()
 *     elif rv == CKR_TEMPLATE_INCONSISTENT:
*/
    break;
    case CKR_TEMPLATE_INCONSISTENT:

    /* "pkcs11/_pkcs11.pxd":760
 *         exc = TemplateIncomplete()
 *     elif rv == CKR_TEMPLATE_INCONSISTENT:
 *         exc = TemplateInconsistent()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_SLOT_ID_INVALID:
 *         exc = SlotIDInvalid()
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_TemplateInconsistent); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 760, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 760, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":759
 *     elif rv == CKR_TEMPLATE_INCOMPLETE:
 *         exc = TemplateIncomplete()
 *     elif rv == CKR_TEMPLATE_INCONSISTENT:             # <<<<<<<<<<<<<<
 *         exc = TemplateInconsistent()
 *     elif rv == CKR_SLOT_ID_INVALID:
*/
    break;
    case CKR_SLOT_ID_INVALID:

    /* "pkcs11/_pkcs11.pxd":762
 *         exc = TemplateInconsistent()
 *     elif rv == CKR_SLOT_ID_INVALID:
 *         exc = SlotIDInvalid()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_TOKEN_NOT_PRESENT:
 *         exc = TokenNotPresent()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_SlotIDInvalid); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 762, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 762, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":761
 *     elif rv == CKR_TEMPLATE_INCONSISTENT:
 *         exc = TemplateInconsistent()
 *     elif rv == CKR_SLOT_ID_INVALID:             # <<<<<<<<<<<<<<
 *         exc = SlotIDInvalid()
 *     elif rv == CKR_TOKEN_NOT_PRESENT:
*/
    break;
    case CKR_TOKEN_NOT_PRESENT:

    /* "pkcs11/_pkcs11.pxd":764
 *         exc = SlotIDInvalid()
 *     elif rv == CKR_TOKEN_NOT_PRESENT:
 *         exc = TokenNotPresent()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_TOKEN_NOT_RECOGNIZED:
 *         exc = TokenNotRecognised()
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_TokenNotPresent); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 764, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 764, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":763
 *     elif rv == CKR_SLOT_ID_INVALID:
 *         exc = SlotIDInvalid()
 *     elif rv == CKR_TOKEN_NOT_PRESENT:             # <<<<<<<<<<<<<<
 *         exc = TokenNotPresent()
 *     elif rv == CKR_TOKEN_NOT_RECOGNIZED:
*/
    break;
    case CKR_TOKEN_NOT_RECOGNIZED:

    /* "pkcs11/_pkcs11.pxd":766
 *         exc = TokenNotPresent()
 *     elif rv == CKR_TOKEN_NOT_RECOGNIZED:
 *         exc = TokenNotRecognised()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_TOKEN_WRITE_PROTECTED:
 *         exc = TokenWriteProtected()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_TokenNotRecognised); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 766, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 766, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":765
 *     elif rv == CKR_TOKEN_NOT_PRESENT:
 *         exc = TokenNotPresent()
 *     elif rv == CKR_TOKEN_NOT_RECOGNIZED:             # <<<<<<<<<<<<<<
 *         exc = TokenNotRecognised()
 *     elif rv == CKR_TOKEN_WRITE_PROTECTED:
*/
    break;
    case CKR_TOKEN_WRITE_PROTECTED:

    /* "pkcs11/_pkcs11.pxd":768
 *         exc = TokenNotRecognised()
 *     elif rv == CKR_TOKEN_WRITE_PROTECTED:
 *         exc = TokenWriteProtected()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_UNWRAPPING_KEY_HANDLE_INVALID:
 *         exc = UnwrappingKeyHandleInvalid()
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_TokenWriteProtected); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 768, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 768, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":767
 *     elif rv == CKR_TOKEN_NOT_RECOGNIZED:
 *         exc = TokenNotRecognised()
 *     elif rv == CKR_TOKEN_WRITE_PROTECTED:             # <<<<<<<<<<<<<<
 *         exc = TokenWriteProtected()
 *     elif rv == CKR_UNWRAPPING_KEY_HANDLE_INVALID:
*/
    break;
    case CKR_UNWRAPPING_KEY_HANDLE_INVALID:

    /* "pkcs11/_pkcs11.pxd":770
 *         exc = TokenWriteProtected()
 *     elif rv == CKR_UNWRAPPING_KEY_HANDLE_INVALID:
 *         exc = UnwrappingKeyHandleInvalid()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_UNWRAPPING_KEY_SIZE_RANGE:
 *         exc = UnwrappingKeySizeRange()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_UnwrappingKeyHandleInvalid); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 770, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 770, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":769
 *     elif rv == CKR_TOKEN_WRITE_PROTECTED:
 *         exc = TokenWriteProtected()
 *     elif rv == CKR_UNWRAPPING_KEY_HANDLE_INVALID:             # <<<<<<<<<<<<<<
 *         exc = UnwrappingKeyHandleInvalid()
 *     elif rv == CKR_UNWRAPPING_KEY_SIZE_RANGE:
*/
    break;
    case CKR_UNWRAPPING_KEY_SIZE_RANGE:

    /* "pkcs11/_pkcs11.pxd":772
 *         exc = UnwrappingKeyHandleInvalid()
 *     elif rv == CKR_UNWRAPPING_KEY_SIZE_RANGE:
 *         exc = UnwrappingKeySizeRange()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT:
 *         exc = UnwrappingKeyTypeInconsistent()
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_UnwrappingKeySizeRange); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 772, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 772, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":771
 *     elif rv == CKR_UNWRAPPING_KEY_HANDLE_INVALID:
 *         exc = UnwrappingKeyHandleInvalid()
 *     elif rv == CKR_UNWRAPPING_KEY_SIZE_RANGE:             # <<<<<<<<<<<<<<
 *         exc = UnwrappingKeySizeRange()
 *     elif rv == CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT:
*/
    break;
    case CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT:

    /* "pkcs11/_pkcs11.pxd":774
 *         exc = UnwrappingKeySizeRange()
 *     elif rv == CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT:
 *         exc = UnwrappingKeyTypeInconsistent()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_USER_NOT_LOGGED_IN:
 *         exc = UserNotLoggedIn()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_UnwrappingKeyTypeInconsistent); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 774, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 774, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":773
 *     elif rv == CKR_UNWRAPPING_KEY_SIZE_RANGE:
 *         exc = UnwrappingKeySizeRange()
 *     elif rv == CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT:             # <<<<<<<<<<<<<<
 *         exc = UnwrappingKeyTypeInconsistent()
 *     elif rv == CKR_USER_NOT_LOGGED_IN:
*/
    break;
    case CKR_USER_NOT_LOGGED_IN:

    /* "pkcs11/_pkcs11.pxd":776
 *         exc = UnwrappingKeyTypeInconsistent()
 *     elif rv == CKR_USER_NOT_LOGGED_IN:
 *         exc = UserNotLoggedIn()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_USER_ALREADY_LOGGED_IN:
 *         exc = UserAlreadyLoggedIn()
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_UserNotLoggedIn); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 776, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 776, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":775
 *     elif rv == CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT:
 *         exc = UnwrappingKeyTypeInconsistent()
 *     elif rv == CKR_USER_NOT_LOGGED_IN:             # <<<<<<<<<<<<<<
 *         exc = UserNotLoggedIn()
 *     elif rv == CKR_USER_ALREADY_LOGGED_IN:
*/
    break;
    case CKR_USER_ALREADY_LOGGED_IN:

    /* "pkcs11/_pkcs11.pxd":778
 *         exc = UserNotLoggedIn()
 *     elif rv == CKR_USER_ALREADY_LOGGED_IN:
 *         exc = UserAlreadyLoggedIn()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_USER_ANOTHER_ALREADY_LOGGED_IN:
 *         exc = AnotherUserAlreadyLoggedIn()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_UserAlreadyLoggedIn); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 778, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 778, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":777
 *     elif rv == CKR_USER_NOT_LOGGED_IN:
 *         exc = UserNotLoggedIn()
 *     elif rv == CKR_USER_ALREADY_LOGGED_IN:             # <<<<<<<<<<<<<<
 *         exc = UserAlreadyLoggedIn()
 *     elif rv == CKR_USER_ANOTHER_ALREADY_LOGGED_IN:
*/
    break;
    case CKR_USER_ANOTHER_ALREADY_LOGGED_IN:

    /* "pkcs11/_pkcs11.pxd":780
 *         exc = UserAlreadyLoggedIn()
 *     elif rv == CKR_USER_ANOTHER_ALREADY_LOGGED_IN:
 *         exc = AnotherUserAlreadyLoggedIn()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_USER_PIN_NOT_INITIALIZED:
 *         exc = UserPinNotInitialized()
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_AnotherUserAlreadyLoggedIn); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 780, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 780, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":779
 *     elif rv == CKR_USER_ALREADY_LOGGED_IN:
 *         exc = UserAlreadyLoggedIn()
 *     elif rv == CKR_USER_ANOTHER_ALREADY_LOGGED_IN:             # <<<<<<<<<<<<<<
 *         exc = AnotherUserAlreadyLoggedIn()
 *     elif rv == CKR_USER_PIN_NOT_INITIALIZED:
*/
    break;
    case CKR_USER_PIN_NOT_INITIALIZED:

    /* "pkcs11/_pkcs11.pxd":782
 *         exc = AnotherUserAlreadyLoggedIn()
 *     elif rv == CKR_USER_PIN_NOT_INITIALIZED:
 *         exc = UserPinNotInitialized()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_USER_TOO_MANY_TYPES:
 *         exc = UserTooManyTypes()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_UserPinNotInitialized); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 782, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 782, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":781
 *     elif rv == CKR_USER_ANOTHER_ALREADY_LOGGED_IN:
 *         exc = AnotherUserAlreadyLoggedIn()
 *     elif rv == CKR_USER_PIN_NOT_INITIALIZED:             # <<<<<<<<<<<<<<
 *         exc = UserPinNotInitialized()
 *     elif rv == CKR_USER_TOO_MANY_TYPES:
*/
    break;
    case CKR_USER_TOO_MANY_TYPES:

    /* "pkcs11/_pkcs11.pxd":784
 *         exc = UserPinNotInitialized()
 *     elif rv == CKR_USER_TOO_MANY_TYPES:
 *         exc = UserTooManyTypes()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_USER_TYPE_INVALID:
 *         exc = PKCS11Error("User type invalid. Should never see this.")
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_UserTooManyTypes); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 784, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 784, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":783
 *     elif rv == CKR_USER_PIN_NOT_INITIALIZED:
 *         exc = UserPinNotInitialized()
 *     elif rv == CKR_USER_TOO_MANY_TYPES:             # <<<<<<<<<<<<<<
 *         exc = UserTooManyTypes()
 *     elif rv == CKR_USER_TYPE_INVALID:
*/
    break;
    case CKR_USER_TYPE_INVALID:

    /* "pkcs11/_pkcs11.pxd":786
 *         exc = UserTooManyTypes()
 *     elif rv == CKR_USER_TYPE_INVALID:
 *         exc = PKCS11Error("User type invalid. Should never see this.")             # <<<<<<<<<<<<<<
 *     elif rv == CKR_WRAPPED_KEY_INVALID:
 *         exc = WrappedKeyInvalid()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_PKCS11Error); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 786, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_User_type_invalid_Should_never_s};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 786, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":785
 *     elif rv == CKR_USER_TOO_MANY_TYPES:
 *         exc = UserTooManyTypes()
 *     elif rv == CKR_USER_TYPE_INVALID:             # <<<<<<<<<<<<<<
 *         exc = PKCS11Error("User type invalid. Should never see this.")
 *     elif rv == CKR_WRAPPED_KEY_INVALID:
*/
    break;
    case CKR_WRAPPED_KEY_INVALID:

    /* "pkcs11/_pkcs11.pxd":788
 *         exc = PKCS11Error("User type invalid. Should never see this.")
 *     elif rv == CKR_WRAPPED_KEY_INVALID:
 *         exc = WrappedKeyInvalid()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_WRAPPED_KEY_LEN_RANGE:
 *         exc = WrappedKeyLenRange()
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_WrappedKeyInvalid); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 788, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 788, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":787
 *     elif rv == CKR_USER_TYPE_INVALID:
 *         exc = PKCS11Error("User type invalid. Should never see this.")
 *     elif rv == CKR_WRAPPED_KEY_INVALID:             # <<<<<<<<<<<<<<
 *         exc = WrappedKeyInvalid()
 *     elif rv == CKR_WRAPPED_KEY_LEN_RANGE:
*/
    break;
    case CKR_WRAPPED_KEY_LEN_RANGE:

    /* "pkcs11/_pkcs11.pxd":790
 *         exc = WrappedKeyInvalid()
 *     elif rv == CKR_WRAPPED_KEY_LEN_RANGE:
 *         exc = WrappedKeyLenRange()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_WRAPPING_KEY_HANDLE_INVALID:
 *         exc = WrappingKeyHandleInvalid()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_WrappedKeyLenRange); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 790, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 790, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":789
 *     elif rv == CKR_WRAPPED_KEY_INVALID:
 *         exc = WrappedKeyInvalid()
 *     elif rv == CKR_WRAPPED_KEY_LEN_RANGE:             # <<<<<<<<<<<<<<
 *         exc = WrappedKeyLenRange()
 *     elif rv == CKR_WRAPPING_KEY_HANDLE_INVALID:
*/
    break;
    case CKR_WRAPPING_KEY_HANDLE_INVALID:

    /* "pkcs11/_pkcs11.pxd":792
 *         exc = WrappedKeyLenRange()
 *     elif rv == CKR_WRAPPING_KEY_HANDLE_INVALID:
 *         exc = WrappingKeyHandleInvalid()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_WRAPPING_KEY_SIZE_RANGE:
 *         exc = WrappingKeySizeRange()
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_WrappingKeyHandleInvalid); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 792, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 792, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":791
 *     elif rv == CKR_WRAPPED_KEY_LEN_RANGE:
 *         exc = WrappedKeyLenRange()
 *     elif rv == CKR_WRAPPING_KEY_HANDLE_INVALID:             # <<<<<<<<<<<<<<
 *         exc = WrappingKeyHandleInvalid()
 *     elif rv == CKR_WRAPPING_KEY_SIZE_RANGE:
*/
    break;
    case CKR_WRAPPING_KEY_SIZE_RANGE:

    /* "pkcs11/_pkcs11.pxd":794
 *         exc = WrappingKeyHandleInvalid()
 *     elif rv == CKR_WRAPPING_KEY_SIZE_RANGE:
 *         exc = WrappingKeySizeRange()             # <<<<<<<<<<<<<<
 *     elif rv == CKR_WRAPPING_KEY_TYPE_INCONSISTENT:
 *         exc = WrappingKeyTypeInconsistent()
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_WrappingKeySizeRange); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 794, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 794, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":793
 *     elif rv == CKR_WRAPPING_KEY_HANDLE_INVALID:
 *         exc = WrappingKeyHandleInvalid()
 *     elif rv == CKR_WRAPPING_KEY_SIZE_RANGE:             # <<<<<<<<<<<<<<
 *         exc = WrappingKeySizeRange()
 *     elif rv == CKR_WRAPPING_KEY_TYPE_INCONSISTENT:
*/
    break;
    case CKR_WRAPPING_KEY_TYPE_INCONSISTENT:

    /* "pkcs11/_pkcs11.pxd":796
 *         exc = WrappingKeySizeRange()
 *     elif rv == CKR_WRAPPING_KEY_TYPE_INCONSISTENT:
 *         exc = WrappingKeyTypeInconsistent()             # <<<<<<<<<<<<<<
 *     else:
 *         exc = PKCS11Error("Unmapped error code %s" % hex(rv))
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_WrappingKeyTypeInconsistent); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 796, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 796, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pxd":795
 *     elif rv == CKR_WRAPPING_KEY_SIZE_RANGE:
 *         exc = WrappingKeySizeRange()
 *     elif rv == CKR_WRAPPING_KEY_TYPE_INCONSISTENT:             # <<<<<<<<<<<<<<
 *         exc = WrappingKeyTypeInconsistent()
 *     else:
*/
    break;
    default:

    /* "pkcs11/_pkcs11.pxd":798
 *         exc = WrappingKeyTypeInconsistent()
 *     else:
 *         exc = PKCS11Error("Unmapped error code %s" % hex(rv))             # <<<<<<<<<<<<<<
 *     return exc
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_PKCS11Error); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 798, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyLong_From_CK_RV(__pyx_v_rv); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 798, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyNumber_Hex(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 798, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_Unmapped_error_code_s, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 798, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 798, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_exc = __pyx_t_1;
    __pyx_t_1 = 0;
    break;
  }

  /* "pkcs11/_pkcs11.pxd":799
 *     else:
 *         exc = PKCS11Error("Unmapped error code %s" % hex(rv))
 *     return exc             # <<<<<<<<<<<<<<
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_exc);
  __pyx_r = __pyx_v_exc;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pxd":644
 * # to avoid noise in the metrics.
 * 
 * cdef inline object map_rv_to_error(CK_RV rv):  # pragma: nocover             # <<<<<<<<<<<<<<
 *     if rv == CKR_ATTRIBUTE_TYPE_INVALID:
 *         exc = AttributeTypeInvalid()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pkcs11._pkcs11.map_rv_to_error", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_exc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":39
 *     cdef CK_FUNCTION_LIST *funclist
 * 
 *     def __cinit__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         self.funclist = NULL
 * 
*/

/* Python wrapper */
static int __pyx_pw_6pkcs11_7_pkcs11_11HasFuncList_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6pkcs11_7_pkcs11_11HasFuncList_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_args = 0;
  CYTHON_UNUSED PyObject *__pyx_v_kwargs = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (__pyx_kwds_len > 0) {
    if (unlikely(__Pyx_CheckKeywordStrings("__cinit__", __pyx_kwds) == -1)) return -1;
  }
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_11HasFuncList___cinit__(((struct __pyx_obj_6pkcs11_7_pkcs11_HasFuncList *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs);

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

static int __pyx_pf_6pkcs11_7_pkcs11_11HasFuncList___cinit__(struct __pyx_obj_6pkcs11_7_pkcs11_HasFuncList *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  int __pyx_r;

  /* "pkcs11/_pkcs11.pyx":40
 * 
 *     def __cinit__(self, *args, **kwargs):
 *         self.funclist = NULL             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_v_self->funclist = NULL;

  /* "pkcs11/_pkcs11.pyx":39
 *     cdef CK_FUNCTION_LIST *funclist
 * 
 *     def __cinit__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         self.funclist = NULL
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_11HasFuncList_3__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_11HasFuncList_3__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_11HasFuncList_3__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_11HasFuncList_3__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_11HasFuncList_2__reduce_cython__(((struct __pyx_obj_6pkcs11_7_pkcs11_HasFuncList *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_11HasFuncList_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_HasFuncList *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 2, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.HasFuncList.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_11HasFuncList_5__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_11HasFuncList_5__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_11HasFuncList_5__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_11HasFuncList_5__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.HasFuncList.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_11HasFuncList_4__setstate_cython__(((struct __pyx_obj_6pkcs11_7_pkcs11_HasFuncList *)__pyx_v_self), __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_11HasFuncList_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_HasFuncList *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 4, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.HasFuncList.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":43
 * 
 * 
 * cdef assertRV(rv) with gil:             # <<<<<<<<<<<<<<
 *     """Check for an acceptable RV value or thrown an exception."""
 *     if rv == CKR_OK:
*/

static PyObject *__pyx_f_6pkcs11_7_pkcs11_assertRV(PyObject *__pyx_v_rv) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  CK_RV __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("assertRV", 0);
  __Pyx_INCREF(__pyx_v_rv);

  /* "pkcs11/_pkcs11.pyx":45
 * cdef assertRV(rv) with gil:
 *     """Check for an acceptable RV value or thrown an exception."""
 *     if rv == CKR_OK:             # <<<<<<<<<<<<<<
 *         return
 *     raise map_rv_to_error(rv)
*/
  __pyx_t_1 = __Pyx_PyLong_From_CK_RV(CKR_OK); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_rv, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 45, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "pkcs11/_pkcs11.pyx":46
 *     """Check for an acceptable RV value or thrown an exception."""
 *     if rv == CKR_OK:
 *         return             # <<<<<<<<<<<<<<
 *     raise map_rv_to_error(rv)
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "pkcs11/_pkcs11.pyx":45
 * cdef assertRV(rv) with gil:
 *     """Check for an acceptable RV value or thrown an exception."""
 *     if rv == CKR_OK:             # <<<<<<<<<<<<<<
 *         return
 *     raise map_rv_to_error(rv)
*/
  }

  /* "pkcs11/_pkcs11.pyx":47
 *     if rv == CKR_OK:
 *         return
 *     raise map_rv_to_error(rv)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_4 = ((CK_RV)__Pyx_PyLong_As_CK_RV(__pyx_v_rv)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 47, __pyx_L1_error)
  __pyx_t_2 = __pyx_f_6pkcs11_7_pkcs11_map_rv_to_error(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_Raise(__pyx_t_2, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __PYX_ERR(0, 47, __pyx_L1_error)

  /* "pkcs11/_pkcs11.pyx":43
 * 
 * 
 * cdef assertRV(rv) with gil:             # <<<<<<<<<<<<<<
 *     """Check for an acceptable RV value or thrown an exception."""
 *     if rv == CKR_OK:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pkcs11._pkcs11.assertRV", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":60
 *     """Length of `data`."""
 * 
 *     def __cinit__(self, attrs):             # <<<<<<<<<<<<<<
 *         self.data = NULL
 *         self.count = 0
*/

/* Python wrapper */
static int __pyx_pw_6pkcs11_7_pkcs11_13AttributeList_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6pkcs11_7_pkcs11_13AttributeList_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_attrs = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_attrs,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 60, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 60, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(0, 60, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, i); __PYX_ERR(0, 60, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 60, __pyx_L3_error)
    }
    __pyx_v_attrs = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 60, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.AttributeList.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_13AttributeList___cinit__(((struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *)__pyx_v_self), __pyx_v_attrs);

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

static int __pyx_pf_6pkcs11_7_pkcs11_13AttributeList___cinit__(struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_attrs) {
  int __pyx_r;

  /* "pkcs11/_pkcs11.pyx":61
 * 
 *     def __cinit__(self, attrs):
 *         self.data = NULL             # <<<<<<<<<<<<<<
 *         self.count = 0
 * 
*/
  __pyx_v_self->data = NULL;

  /* "pkcs11/_pkcs11.pyx":62
 *     def __cinit__(self, attrs):
 *         self.data = NULL
 *         self.count = 0             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
*/
  __pyx_v_self->count = 0;

  /* "pkcs11/_pkcs11.pyx":60
 *     """Length of `data`."""
 * 
 *     def __cinit__(self, attrs):             # <<<<<<<<<<<<<<
 *         self.data = NULL
 *         self.count = 0
*/

  /* function exit code */
  __pyx_r = 0;
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":64
 *         self.count = 0
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef AttributeList from_owned_pointer(CK_ATTRIBUTE * data, CK_ULONG count):
 *         cdef AttributeList lst = AttributeList.__new__(AttributeList, ())
*/

static struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_f_6pkcs11_7_pkcs11_13AttributeList_from_owned_pointer(CK_ATTRIBUTE *__pyx_v_data, CK_ULONG __pyx_v_count) {
  struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_lst = 0;
  struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("from_owned_pointer", 0);

  /* "pkcs11/_pkcs11.pyx":66
 *     @staticmethod
 *     cdef AttributeList from_owned_pointer(CK_ATTRIBUTE * data, CK_ULONG count):
 *         cdef AttributeList lst = AttributeList.__new__(AttributeList, ())             # <<<<<<<<<<<<<<
 *         lst.data = data
 *         lst.count = count
*/
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_6pkcs11_7_pkcs11_AttributeList(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_AttributeList), __pyx_mstate_global->__pyx_tuple[1], NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_1);
  __pyx_v_lst = ((struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":67
 *     cdef AttributeList from_owned_pointer(CK_ATTRIBUTE * data, CK_ULONG count):
 *         cdef AttributeList lst = AttributeList.__new__(AttributeList, ())
 *         lst.data = data             # <<<<<<<<<<<<<<
 *         lst.count = count
 *         return lst
*/
  __pyx_v_lst->data = __pyx_v_data;

  /* "pkcs11/_pkcs11.pyx":68
 *         cdef AttributeList lst = AttributeList.__new__(AttributeList, ())
 *         lst.data = data
 *         lst.count = count             # <<<<<<<<<<<<<<
 *         return lst
 * 
*/
  __pyx_v_lst->count = __pyx_v_count;

  /* "pkcs11/_pkcs11.pyx":69
 *         lst.data = data
 *         lst.count = count
 *         return lst             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_lst);
  __pyx_r = __pyx_v_lst;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":64
 *         self.count = 0
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef AttributeList from_owned_pointer(CK_ATTRIBUTE * data, CK_ULONG count):
 *         cdef AttributeList lst = AttributeList.__new__(AttributeList, ())
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pkcs11._pkcs11.AttributeList.from_owned_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lst);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":71
 *         return lst
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef AttributeList from_template(dict template, object attribute_mapper):
 *         cdef AttributeList lst = AttributeList.__new__(AttributeList, ())
*/

static struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_f_6pkcs11_7_pkcs11_13AttributeList_from_template(PyObject *__pyx_v_template, PyObject *__pyx_v_attribute_mapper) {
  struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_lst = 0;
  PyObject *__pyx_v_count = NULL;
  PyObject *__pyx_v_value_bytes = 0;
  CK_CHAR *__pyx_v_value_ptr;
  Py_ssize_t __pyx_v_value_len;
  PyObject *__pyx_v_index = NULL;
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_value = NULL;
  struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  CK_ULONG __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  CK_ATTRIBUTE_TYPE __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  CK_CHAR *__pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("from_template", 0);

  /* "pkcs11/_pkcs11.pyx":73
 *     @staticmethod
 *     cdef AttributeList from_template(dict template, object attribute_mapper):
 *         cdef AttributeList lst = AttributeList.__new__(AttributeList, ())             # <<<<<<<<<<<<<<
 * 
 *         lst.count = count = <CK_ULONG> len(template)
*/
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_6pkcs11_7_pkcs11_AttributeList(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_AttributeList), __pyx_mstate_global->__pyx_tuple[1], NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_1);
  __pyx_v_lst = ((struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":75
 *         cdef AttributeList lst = AttributeList.__new__(AttributeList, ())
 * 
 *         lst.count = count = <CK_ULONG> len(template)             # <<<<<<<<<<<<<<
 * 
 *         lst.data = <CK_ATTRIBUTE *> PyMem_Malloc(count * sizeof(CK_ATTRIBUTE))
*/
  if (unlikely(__pyx_v_template == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 75, __pyx_L1_error)
  }
  __pyx_t_2 = PyDict_Size(__pyx_v_template); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 75, __pyx_L1_error)
  __pyx_t_3 = ((CK_ULONG)__pyx_t_2);
  __pyx_t_1 = __Pyx_PyLong_From_CK_ULONG(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_lst->count = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_count = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":77
 *         lst.count = count = <CK_ULONG> len(template)
 * 
 *         lst.data = <CK_ATTRIBUTE *> PyMem_Malloc(count * sizeof(CK_ATTRIBUTE))             # <<<<<<<<<<<<<<
 *         if lst.data is NULL:
 *             raise MemoryError()
*/
  __pyx_t_1 = __Pyx_PyLong_FromSize_t((sizeof(CK_ATTRIBUTE))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyNumber_Multiply(__pyx_v_count, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyLong_As_size_t(__pyx_t_4); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 77, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_lst->data = ((CK_ATTRIBUTE *)PyMem_Malloc(__pyx_t_5));

  /* "pkcs11/_pkcs11.pyx":78
 * 
 *         lst.data = <CK_ATTRIBUTE *> PyMem_Malloc(count * sizeof(CK_ATTRIBUTE))
 *         if lst.data is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
*/
  __pyx_t_6 = (__pyx_v_lst->data == NULL);
  if (unlikely(__pyx_t_6)) {

    /* "pkcs11/_pkcs11.pyx":79
 *         lst.data = <CK_ATTRIBUTE *> PyMem_Malloc(count * sizeof(CK_ATTRIBUTE))
 *         if lst.data is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *         cdef bytes value_bytes
*/
    PyErr_NoMemory(); __PYX_ERR(0, 79, __pyx_L1_error)

    /* "pkcs11/_pkcs11.pyx":78
 * 
 *         lst.data = <CK_ATTRIBUTE *> PyMem_Malloc(count * sizeof(CK_ATTRIBUTE))
 *         if lst.data is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
*/
  }

  /* "pkcs11/_pkcs11.pyx":84
 *         cdef CK_CHAR * value_ptr
 *         cdef Py_ssize_t value_len
 *         for index, (key, value) in enumerate(template.items()):             # <<<<<<<<<<<<<<
 *             lst.data[index].type = key
 *             value_bytes = attribute_mapper.pack_attribute(key, value)
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
  __pyx_t_4 = __pyx_mstate_global->__pyx_int_0;
  __pyx_t_2 = 0;
  if (unlikely(__pyx_v_template == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
    __PYX_ERR(0, 84, __pyx_L1_error)
  }
  __pyx_t_9 = __Pyx_dict_iterator(__pyx_v_template, 1, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_7), (&__pyx_t_8)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_9;
  __pyx_t_9 = 0;
  while (1) {
    __pyx_t_11 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_7, &__pyx_t_2, &__pyx_t_9, &__pyx_t_10, NULL, __pyx_t_8);
    if (unlikely(__pyx_t_11 == 0)) break;
    if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(0, 84, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_9);
    __pyx_t_9 = 0;
    __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_10);
    __pyx_t_10 = 0;
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_4);
    __pyx_t_10 = __Pyx_PyLong_AddObjC(__pyx_t_4, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 84, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_4);
    __pyx_t_4 = __pyx_t_10;
    __pyx_t_10 = 0;

    /* "pkcs11/_pkcs11.pyx":85
 *         cdef Py_ssize_t value_len
 *         for index, (key, value) in enumerate(template.items()):
 *             lst.data[index].type = key             # <<<<<<<<<<<<<<
 *             value_bytes = attribute_mapper.pack_attribute(key, value)
 *             value_len = len(value_bytes)
*/
    __pyx_t_12 = __Pyx_PyLong_As_CK_ULONG(__pyx_v_key); if (unlikely((__pyx_t_12 == ((CK_ATTRIBUTE_TYPE)-1)) && PyErr_Occurred())) __PYX_ERR(0, 85, __pyx_L1_error)
    __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 85, __pyx_L1_error)
    (__pyx_v_lst->data[__pyx_t_13]).type = __pyx_t_12;

    /* "pkcs11/_pkcs11.pyx":86
 *         for index, (key, value) in enumerate(template.items()):
 *             lst.data[index].type = key
 *             value_bytes = attribute_mapper.pack_attribute(key, value)             # <<<<<<<<<<<<<<
 *             value_len = len(value_bytes)
 *             # copy the result into a pointer that we manage, for consistency with the other init method
*/
    __pyx_t_9 = __pyx_v_attribute_mapper;
    __Pyx_INCREF(__pyx_t_9);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_9, __pyx_v_key, __pyx_v_value};
      __pyx_t_10 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_pack_attribute, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 86, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
    }
    if (!(likely(PyBytes_CheckExact(__pyx_t_10))||((__pyx_t_10) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_10))) __PYX_ERR(0, 86, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_value_bytes, ((PyObject*)__pyx_t_10));
    __pyx_t_10 = 0;

    /* "pkcs11/_pkcs11.pyx":87
 *             lst.data[index].type = key
 *             value_bytes = attribute_mapper.pack_attribute(key, value)
 *             value_len = len(value_bytes)             # <<<<<<<<<<<<<<
 *             # copy the result into a pointer that we manage, for consistency with the other init method
 *             value_ptr = <CK_CHAR *> PyMem_Malloc(value_len)
*/
    if (unlikely(__pyx_v_value_bytes == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      __PYX_ERR(0, 87, __pyx_L1_error)
    }
    __pyx_t_13 = __Pyx_PyBytes_GET_SIZE(__pyx_v_value_bytes); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 87, __pyx_L1_error)
    __pyx_v_value_len = __pyx_t_13;

    /* "pkcs11/_pkcs11.pyx":89
 *             value_len = len(value_bytes)
 *             # copy the result into a pointer that we manage, for consistency with the other init method
 *             value_ptr = <CK_CHAR *> PyMem_Malloc(value_len)             # <<<<<<<<<<<<<<
 *             if value_ptr is NULL:
 *                 raise MemoryError()
*/
    __pyx_v_value_ptr = ((CK_CHAR *)PyMem_Malloc(__pyx_v_value_len));

    /* "pkcs11/_pkcs11.pyx":90
 *             # copy the result into a pointer that we manage, for consistency with the other init method
 *             value_ptr = <CK_CHAR *> PyMem_Malloc(value_len)
 *             if value_ptr is NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *             memcpy(value_ptr, <CK_CHAR *> value_bytes, <size_t> value_len)
*/
    __pyx_t_6 = (__pyx_v_value_ptr == NULL);
    if (unlikely(__pyx_t_6)) {

      /* "pkcs11/_pkcs11.pyx":91
 *             value_ptr = <CK_CHAR *> PyMem_Malloc(value_len)
 *             if value_ptr is NULL:
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *             memcpy(value_ptr, <CK_CHAR *> value_bytes, <size_t> value_len)
 *             lst.data[index].pValue = <CK_CHAR *> value_ptr
*/
      PyErr_NoMemory(); __PYX_ERR(0, 91, __pyx_L1_error)

      /* "pkcs11/_pkcs11.pyx":90
 *             # copy the result into a pointer that we manage, for consistency with the other init method
 *             value_ptr = <CK_CHAR *> PyMem_Malloc(value_len)
 *             if value_ptr is NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *             memcpy(value_ptr, <CK_CHAR *> value_bytes, <size_t> value_len)
*/
    }

    /* "pkcs11/_pkcs11.pyx":92
 *             if value_ptr is NULL:
 *                 raise MemoryError()
 *             memcpy(value_ptr, <CK_CHAR *> value_bytes, <size_t> value_len)             # <<<<<<<<<<<<<<
 *             lst.data[index].pValue = <CK_CHAR *> value_ptr
 *             lst.data[index].ulValueLen = <CK_ULONG> value_len
*/
    if (unlikely(__pyx_v_value_bytes == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
      __PYX_ERR(0, 92, __pyx_L1_error)
    }
    __pyx_t_14 = __Pyx_PyBytes_AsWritableUString(__pyx_v_value_bytes); if (unlikely((!__pyx_t_14) && PyErr_Occurred())) __PYX_ERR(0, 92, __pyx_L1_error)
    (void)(memcpy(__pyx_v_value_ptr, ((CK_CHAR *)__pyx_t_14), ((size_t)__pyx_v_value_len)));

    /* "pkcs11/_pkcs11.pyx":93
 *                 raise MemoryError()
 *             memcpy(value_ptr, <CK_CHAR *> value_bytes, <size_t> value_len)
 *             lst.data[index].pValue = <CK_CHAR *> value_ptr             # <<<<<<<<<<<<<<
 *             lst.data[index].ulValueLen = <CK_ULONG> value_len
 * 
*/
    __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 93, __pyx_L1_error)
    (__pyx_v_lst->data[__pyx_t_13]).pValue = ((CK_CHAR *)__pyx_v_value_ptr);

    /* "pkcs11/_pkcs11.pyx":94
 *             memcpy(value_ptr, <CK_CHAR *> value_bytes, <size_t> value_len)
 *             lst.data[index].pValue = <CK_CHAR *> value_ptr
 *             lst.data[index].ulValueLen = <CK_ULONG> value_len             # <<<<<<<<<<<<<<
 * 
 *         return lst
*/
    __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 94, __pyx_L1_error)
    (__pyx_v_lst->data[__pyx_t_13]).ulValueLen = ((CK_ULONG)__pyx_v_value_len);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":96
 *             lst.data[index].ulValueLen = <CK_ULONG> value_len
 * 
 *         return lst             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, attrs):
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_lst);
  __pyx_r = __pyx_v_lst;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":71
 *         return lst
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef AttributeList from_template(dict template, object attribute_mapper):
 *         cdef AttributeList lst = AttributeList.__new__(AttributeList, ())
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("pkcs11._pkcs11.AttributeList.from_template", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lst);
  __Pyx_XDECREF(__pyx_v_count);
  __Pyx_XDECREF(__pyx_v_value_bytes);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":98
 *         return lst
 * 
 *     def __init__(self, attrs):             # <<<<<<<<<<<<<<
 *         raise TypeError
 * 
*/

/* Python wrapper */
static int __pyx_pw_6pkcs11_7_pkcs11_13AttributeList_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6pkcs11_7_pkcs11_13AttributeList_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_attrs = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_attrs,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 98, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 98, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 98, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, i); __PYX_ERR(0, 98, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 98, __pyx_L3_error)
    }
    __pyx_v_attrs = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 98, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.AttributeList.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_13AttributeList_2__init__(((struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *)__pyx_v_self), __pyx_v_attrs);

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

static int __pyx_pf_6pkcs11_7_pkcs11_13AttributeList_2__init__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_attrs) {
  int __pyx_r;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "pkcs11/_pkcs11.pyx":99
 * 
 *     def __init__(self, attrs):
 *         raise TypeError             # <<<<<<<<<<<<<<
 * 
 *     cdef at_index(self, CK_ULONG index, object attribute_mapper):
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), 0, 0, 0);
  __PYX_ERR(0, 99, __pyx_L1_error)

  /* "pkcs11/_pkcs11.pyx":98
 *         return lst
 * 
 *     def __init__(self, attrs):             # <<<<<<<<<<<<<<
 *         raise TypeError
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.AttributeList.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":101
 *         raise TypeError
 * 
 *     cdef at_index(self, CK_ULONG index, object attribute_mapper):             # <<<<<<<<<<<<<<
 *         cdef CK_ATTRIBUTE * attr
 *         if index < self.count:
*/

static PyObject *__pyx_f_6pkcs11_7_pkcs11_13AttributeList_at_index(struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_self, CK_ULONG __pyx_v_index, PyObject *__pyx_v_attribute_mapper) {
  CK_ATTRIBUTE *__pyx_v_attr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("at_index", 0);

  /* "pkcs11/_pkcs11.pyx":103
 *     cdef at_index(self, CK_ULONG index, object attribute_mapper):
 *         cdef CK_ATTRIBUTE * attr
 *         if index < self.count:             # <<<<<<<<<<<<<<
 *             attr = &self.data[index]
 *             return attribute_mapper.unpack_attributes(
*/
  __pyx_t_1 = (__pyx_v_index < __pyx_v_self->count);
  if (likely(__pyx_t_1)) {

    /* "pkcs11/_pkcs11.pyx":104
 *         cdef CK_ATTRIBUTE * attr
 *         if index < self.count:
 *             attr = &self.data[index]             # <<<<<<<<<<<<<<
 *             return attribute_mapper.unpack_attributes(
 *                 attr.type,
*/
    __pyx_v_attr = (&(__pyx_v_self->data[__pyx_v_index]));

    /* "pkcs11/_pkcs11.pyx":105
 *         if index < self.count:
 *             attr = &self.data[index]
 *             return attribute_mapper.unpack_attributes(             # <<<<<<<<<<<<<<
 *                 attr.type,
 *                 PyBytes_FromStringAndSize(<char *> attr.pValue, <Py_ssize_t> attr.ulValueLen)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_v_attribute_mapper;
    __Pyx_INCREF(__pyx_t_3);

    /* "pkcs11/_pkcs11.pyx":106
 *             attr = &self.data[index]
 *             return attribute_mapper.unpack_attributes(
 *                 attr.type,             # <<<<<<<<<<<<<<
 *                 PyBytes_FromStringAndSize(<char *> attr.pValue, <Py_ssize_t> attr.ulValueLen)
 *             )
*/
    __pyx_t_4 = __Pyx_PyLong_From_CK_ULONG(__pyx_v_attr->type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 106, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "pkcs11/_pkcs11.pyx":107
 *             return attribute_mapper.unpack_attributes(
 *                 attr.type,
 *                 PyBytes_FromStringAndSize(<char *> attr.pValue, <Py_ssize_t> attr.ulValueLen)             # <<<<<<<<<<<<<<
 *             )
 *         else:
*/
    __pyx_t_5 = PyBytes_FromStringAndSize(((char *)__pyx_v_attr->pValue), ((Py_ssize_t)__pyx_v_attr->ulValueLen)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_t_4, __pyx_t_5};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_unpack_attributes, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 105, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "pkcs11/_pkcs11.pyx":103
 *     cdef at_index(self, CK_ULONG index, object attribute_mapper):
 *         cdef CK_ATTRIBUTE * attr
 *         if index < self.count:             # <<<<<<<<<<<<<<
 *             attr = &self.data[index]
 *             return attribute_mapper.unpack_attributes(
*/
  }

  /* "pkcs11/_pkcs11.pyx":110
 *             )
 *         else:
 *             raise IndexError()             # <<<<<<<<<<<<<<
 * 
 *     def as_dict(self, attribute_mapper):
*/
  /*else*/ {
    __pyx_t_5 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_IndexError)), __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 110, __pyx_L1_error)
  }

  /* "pkcs11/_pkcs11.pyx":101
 *         raise TypeError
 * 
 *     cdef at_index(self, CK_ULONG index, object attribute_mapper):             # <<<<<<<<<<<<<<
 *         cdef CK_ATTRIBUTE * attr
 *         if index < self.count:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pkcs11._pkcs11.AttributeList.at_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":112
 *             raise IndexError()
 * 
 *     def as_dict(self, attribute_mapper):             # <<<<<<<<<<<<<<
 *         cdef CK_ATTRIBUTE * attr
 *         result = {}
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_13AttributeList_5as_dict(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_13AttributeList_5as_dict = {"as_dict", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_13AttributeList_5as_dict, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_13AttributeList_5as_dict(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_attribute_mapper = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("as_dict (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_attribute_mapper,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 112, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 112, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "as_dict", 0) < (0)) __PYX_ERR(0, 112, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("as_dict", 1, 1, 1, i); __PYX_ERR(0, 112, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 112, __pyx_L3_error)
    }
    __pyx_v_attribute_mapper = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("as_dict", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 112, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.AttributeList.as_dict", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_13AttributeList_4as_dict(((struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *)__pyx_v_self), __pyx_v_attribute_mapper);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_13AttributeList_4as_dict(struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_self, PyObject *__pyx_v_attribute_mapper) {
  CK_ATTRIBUTE *__pyx_v_attr;
  PyObject *__pyx_v_result = NULL;
  CK_ULONG __pyx_v_index;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  CK_ULONG __pyx_t_2;
  CK_ULONG __pyx_t_3;
  CK_ULONG __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("as_dict", 0);

  /* "pkcs11/_pkcs11.pyx":114
 *     def as_dict(self, attribute_mapper):
 *         cdef CK_ATTRIBUTE * attr
 *         result = {}             # <<<<<<<<<<<<<<
 *         for index in range(self.count):
 *             attr = &self.data[index]
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_result = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":115
 *         cdef CK_ATTRIBUTE * attr
 *         result = {}
 *         for index in range(self.count):             # <<<<<<<<<<<<<<
 *             attr = &self.data[index]
 *             result[attr.type] = self.at_index(index, attribute_mapper)
*/
  __pyx_t_2 = __pyx_v_self->count;
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_index = __pyx_t_4;

    /* "pkcs11/_pkcs11.pyx":116
 *         result = {}
 *         for index in range(self.count):
 *             attr = &self.data[index]             # <<<<<<<<<<<<<<
 *             result[attr.type] = self.at_index(index, attribute_mapper)
 *         return result
*/
    __pyx_v_attr = (&(__pyx_v_self->data[__pyx_v_index]));

    /* "pkcs11/_pkcs11.pyx":117
 *         for index in range(self.count):
 *             attr = &self.data[index]
 *             result[attr.type] = self.at_index(index, attribute_mapper)             # <<<<<<<<<<<<<<
 *         return result
 * 
*/
    __pyx_t_1 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_AttributeList *)__pyx_v_self->__pyx_vtab)->at_index(__pyx_v_self, __pyx_v_index, __pyx_v_attribute_mapper); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyLong_From_CK_ULONG(__pyx_v_attr->type); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 117, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely((PyDict_SetItem(__pyx_v_result, __pyx_t_5, __pyx_t_1) < 0))) __PYX_ERR(0, 117, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pkcs11/_pkcs11.pyx":118
 *             attr = &self.data[index]
 *             result[attr.type] = self.at_index(index, attribute_mapper)
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def get(self, item, attribute_mapper):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":112
 *             raise IndexError()
 * 
 *     def as_dict(self, attribute_mapper):             # <<<<<<<<<<<<<<
 *         cdef CK_ATTRIBUTE * attr
 *         result = {}
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pkcs11._pkcs11.AttributeList.as_dict", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":120
 *         return result
 * 
 *     def get(self, item, attribute_mapper):             # <<<<<<<<<<<<<<
 *         cdef CK_ULONG index = 0
 *         cdef CK_ATTRIBUTE_TYPE key = item
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_13AttributeList_7get(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_13AttributeList_7get = {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_13AttributeList_7get, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_13AttributeList_7get(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_item = 0;
  PyObject *__pyx_v_attribute_mapper = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_item,&__pyx_mstate_global->__pyx_n_u_attribute_mapper,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 120, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 120, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 120, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get", 0) < (0)) __PYX_ERR(0, 120, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get", 1, 2, 2, i); __PYX_ERR(0, 120, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 120, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 120, __pyx_L3_error)
    }
    __pyx_v_item = values[0];
    __pyx_v_attribute_mapper = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 120, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.AttributeList.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_13AttributeList_6get(((struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *)__pyx_v_self), __pyx_v_item, __pyx_v_attribute_mapper);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_13AttributeList_6get(struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_attribute_mapper) {
  CK_ULONG __pyx_v_index;
  CK_ATTRIBUTE_TYPE __pyx_v_key;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  CK_ATTRIBUTE_TYPE __pyx_t_1;
  CK_ULONG __pyx_t_2;
  CK_ULONG __pyx_t_3;
  CK_ULONG __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get", 0);

  /* "pkcs11/_pkcs11.pyx":121
 * 
 *     def get(self, item, attribute_mapper):
 *         cdef CK_ULONG index = 0             # <<<<<<<<<<<<<<
 *         cdef CK_ATTRIBUTE_TYPE key = item
 *         for index in range(self.count):
*/
  __pyx_v_index = 0;

  /* "pkcs11/_pkcs11.pyx":122
 *     def get(self, item, attribute_mapper):
 *         cdef CK_ULONG index = 0
 *         cdef CK_ATTRIBUTE_TYPE key = item             # <<<<<<<<<<<<<<
 *         for index in range(self.count):
 *             if self.data[index].type == key:
*/
  __pyx_t_1 = __Pyx_PyLong_As_CK_ULONG(__pyx_v_item); if (unlikely((__pyx_t_1 == ((CK_ATTRIBUTE_TYPE)-1)) && PyErr_Occurred())) __PYX_ERR(0, 122, __pyx_L1_error)
  __pyx_v_key = __pyx_t_1;

  /* "pkcs11/_pkcs11.pyx":123
 *         cdef CK_ULONG index = 0
 *         cdef CK_ATTRIBUTE_TYPE key = item
 *         for index in range(self.count):             # <<<<<<<<<<<<<<
 *             if self.data[index].type == key:
 *                 return self.at_index(index, attribute_mapper)
*/
  __pyx_t_2 = __pyx_v_self->count;
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_index = __pyx_t_4;

    /* "pkcs11/_pkcs11.pyx":124
 *         cdef CK_ATTRIBUTE_TYPE key = item
 *         for index in range(self.count):
 *             if self.data[index].type == key:             # <<<<<<<<<<<<<<
 *                 return self.at_index(index, attribute_mapper)
 *         raise KeyError(item)
*/
    __pyx_t_5 = ((__pyx_v_self->data[__pyx_v_index]).type == __pyx_v_key);
    if (__pyx_t_5) {

      /* "pkcs11/_pkcs11.pyx":125
 *         for index in range(self.count):
 *             if self.data[index].type == key:
 *                 return self.at_index(index, attribute_mapper)             # <<<<<<<<<<<<<<
 *         raise KeyError(item)
 * 
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_6 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_AttributeList *)__pyx_v_self->__pyx_vtab)->at_index(__pyx_v_self, __pyx_v_index, __pyx_v_attribute_mapper); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 125, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_r = __pyx_t_6;
      __pyx_t_6 = 0;
      goto __pyx_L0;

      /* "pkcs11/_pkcs11.pyx":124
 *         cdef CK_ATTRIBUTE_TYPE key = item
 *         for index in range(self.count):
 *             if self.data[index].type == key:             # <<<<<<<<<<<<<<
 *                 return self.at_index(index, attribute_mapper)
 *         raise KeyError(item)
*/
    }
  }

  /* "pkcs11/_pkcs11.pyx":126
 *             if self.data[index].type == key:
 *                 return self.at_index(index, attribute_mapper)
 *         raise KeyError(item)             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
  __pyx_t_7 = NULL;
  __pyx_t_8 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_item};
    __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_KeyError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 126, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  }
  __Pyx_Raise(__pyx_t_6, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __PYX_ERR(0, 126, __pyx_L1_error)

  /* "pkcs11/_pkcs11.pyx":120
 *         return result
 * 
 *     def get(self, item, attribute_mapper):             # <<<<<<<<<<<<<<
 *         cdef CK_ULONG index = 0
 *         cdef CK_ATTRIBUTE_TYPE key = item
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pkcs11._pkcs11.AttributeList.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":128
 *         raise KeyError(item)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         cdef CK_ULONG index = 0
 *         if self.data is not NULL:
*/

/* Python wrapper */
static void __pyx_pw_6pkcs11_7_pkcs11_13AttributeList_9__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_6pkcs11_7_pkcs11_13AttributeList_9__dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_6pkcs11_7_pkcs11_13AttributeList_8__dealloc__(((struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *)__pyx_v_self));

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

static void __pyx_pf_6pkcs11_7_pkcs11_13AttributeList_8__dealloc__(struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_self) {
  CK_ULONG __pyx_v_index;
  int __pyx_t_1;
  CK_ULONG __pyx_t_2;
  CK_ULONG __pyx_t_3;
  CK_ULONG __pyx_t_4;

  /* "pkcs11/_pkcs11.pyx":129
 * 
 *     def __dealloc__(self):
 *         cdef CK_ULONG index = 0             # <<<<<<<<<<<<<<
 *         if self.data is not NULL:
 *             for index in range(self.count):
*/
  __pyx_v_index = 0;

  /* "pkcs11/_pkcs11.pyx":130
 *     def __dealloc__(self):
 *         cdef CK_ULONG index = 0
 *         if self.data is not NULL:             # <<<<<<<<<<<<<<
 *             for index in range(self.count):
 *                 PyMem_Free(self.data[index].pValue)
*/
  __pyx_t_1 = (__pyx_v_self->data != NULL);
  if (__pyx_t_1) {

    /* "pkcs11/_pkcs11.pyx":131
 *         cdef CK_ULONG index = 0
 *         if self.data is not NULL:
 *             for index in range(self.count):             # <<<<<<<<<<<<<<
 *                 PyMem_Free(self.data[index].pValue)
 *             PyMem_Free(self.data)
*/
    __pyx_t_2 = __pyx_v_self->count;
    __pyx_t_3 = __pyx_t_2;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_index = __pyx_t_4;

      /* "pkcs11/_pkcs11.pyx":132
 *         if self.data is not NULL:
 *             for index in range(self.count):
 *                 PyMem_Free(self.data[index].pValue)             # <<<<<<<<<<<<<<
 *             PyMem_Free(self.data)
 * 
*/
      PyMem_Free((__pyx_v_self->data[__pyx_v_index]).pValue);
    }

    /* "pkcs11/_pkcs11.pyx":133
 *             for index in range(self.count):
 *                 PyMem_Free(self.data[index].pValue)
 *             PyMem_Free(self.data)             # <<<<<<<<<<<<<<
 * 
 * 
*/
    PyMem_Free(__pyx_v_self->data);

    /* "pkcs11/_pkcs11.pyx":130
 *     def __dealloc__(self):
 *         cdef CK_ULONG index = 0
 *         if self.data is not NULL:             # <<<<<<<<<<<<<<
 *             for index in range(self.count):
 *                 PyMem_Free(self.data[index].pValue)
*/
  }

  /* "pkcs11/_pkcs11.pyx":128
 *         raise KeyError(item)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         cdef CK_ULONG index = 0
 *         if self.data is not NULL:
*/

  /* function exit code */
}

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

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_13AttributeList_11__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_13AttributeList_11__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_13AttributeList_11__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_13AttributeList_11__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_13AttributeList_10__reduce_cython__(((struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_13AttributeList_10__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 2, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.AttributeList.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_13AttributeList_13__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_13AttributeList_13__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_13AttributeList_13__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_13AttributeList_13__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.AttributeList.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_13AttributeList_12__setstate_cython__(((struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *)__pyx_v_self), __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_13AttributeList_12__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 4, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.AttributeList.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":151
 *     """
 * 
 *     def __cinit__(self, *args):             # <<<<<<<<<<<<<<
 *         self.data = <CK_MECHANISM *> PyMem_Malloc(sizeof(CK_MECHANISM))
 *         self.param = NULL
*/

/* Python wrapper */
static int __pyx_pw_6pkcs11_7_pkcs11_18MechanismWithParam_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6pkcs11_7_pkcs11_18MechanismWithParam_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_args = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__cinit__", __pyx_kwds); return -1;}
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_18MechanismWithParam___cinit__(((struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *)__pyx_v_self), __pyx_v_args);

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

static int __pyx_pf_6pkcs11_7_pkcs11_18MechanismWithParam___cinit__(struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "pkcs11/_pkcs11.pyx":152
 * 
 *     def __cinit__(self, *args):
 *         self.data = <CK_MECHANISM *> PyMem_Malloc(sizeof(CK_MECHANISM))             # <<<<<<<<<<<<<<
 *         self.param = NULL
 *         self._python_param = None
*/
  __pyx_v_self->data = ((CK_MECHANISM *)PyMem_Malloc((sizeof(CK_MECHANISM))));

  /* "pkcs11/_pkcs11.pyx":153
 *     def __cinit__(self, *args):
 *         self.data = <CK_MECHANISM *> PyMem_Malloc(sizeof(CK_MECHANISM))
 *         self.param = NULL             # <<<<<<<<<<<<<<
 *         self._python_param = None
 * 
*/
  __pyx_v_self->param = NULL;

  /* "pkcs11/_pkcs11.pyx":154
 *         self.data = <CK_MECHANISM *> PyMem_Malloc(sizeof(CK_MECHANISM))
 *         self.param = NULL
 *         self._python_param = None             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, key_type, mapping, mechanism=None, param=None):
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_python_param);
  __Pyx_DECREF(__pyx_v_self->_python_param);
  __pyx_v_self->_python_param = Py_None;

  /* "pkcs11/_pkcs11.pyx":151
 *     """
 * 
 *     def __cinit__(self, *args):             # <<<<<<<<<<<<<<
 *         self.data = <CK_MECHANISM *> PyMem_Malloc(sizeof(CK_MECHANISM))
 *         self.param = NULL
*/

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

/* "pkcs11/_pkcs11.pyx":156
 *         self._python_param = None
 * 
 *     def __init__(self, key_type, mapping, mechanism=None, param=None):             # <<<<<<<<<<<<<<
 *         self._python_param = param
 *         if mechanism is None:
*/

/* Python wrapper */
static int __pyx_pw_6pkcs11_7_pkcs11_18MechanismWithParam_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6pkcs11_7_pkcs11_18MechanismWithParam_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key_type = 0;
  PyObject *__pyx_v_mapping = 0;
  PyObject *__pyx_v_mechanism = 0;
  PyObject *__pyx_v_param = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_key_type,&__pyx_mstate_global->__pyx_n_u_mapping,&__pyx_mstate_global->__pyx_n_u_mechanism,&__pyx_mstate_global->__pyx_n_u_param,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 156, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 156, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 156, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 156, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 156, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 156, __pyx_L3_error)
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, i); __PYX_ERR(0, 156, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 156, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 156, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 156, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 156, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_key_type = values[0];
    __pyx_v_mapping = values[1];
    __pyx_v_mechanism = values[2];
    __pyx_v_param = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, __pyx_nargs); __PYX_ERR(0, 156, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.MechanismWithParam.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_18MechanismWithParam_2__init__(((struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *)__pyx_v_self), __pyx_v_key_type, __pyx_v_mapping, __pyx_v_mechanism, __pyx_v_param);

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

static int __pyx_pf_6pkcs11_7_pkcs11_18MechanismWithParam_2__init__(struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_self, PyObject *__pyx_v_key_type, PyObject *__pyx_v_mapping, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_param) {
  CK_RSA_PKCS_OAEP_PARAMS *__pyx_v_oaep_params;
  CK_RSA_PKCS_PSS_PARAMS *__pyx_v_pss_params;
  CK_EDDSA_PARAMS *__pyx_v_eddsa_params;
  CK_ECDH1_DERIVE_PARAMS *__pyx_v_ecdh1_params;
  CK_KEY_DERIVATION_STRING_DATA *__pyx_v_aes_ecb_params;
  CK_AES_CBC_ENCRYPT_DATA_PARAMS *__pyx_v_aes_cbc_params;
  CK_GCM_PARAMS *__pyx_v_gcm_params;
  CK_AES_CTR_PARAMS *__pyx_v_aes_ctr_params;
  size_t __pyx_v_paramlen;
  PyObject *__pyx_v_source_data = NULL;
  PyObject *__pyx_v_context_data = NULL;
  PyObject *__pyx_v_shared_data = NULL;
  PyObject *__pyx_v_public_data = NULL;
  PyObject *__pyx_v_iv = NULL;
  PyObject *__pyx_v_data = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  size_t __pyx_t_12;
  int __pyx_t_13;
  CK_KEY_DERIVATION_STRING_DATA *__pyx_t_14;
  CK_BYTE *__pyx_t_15;
  Py_ssize_t __pyx_t_16;
  CK_RSA_PKCS_OAEP_PARAMS *__pyx_t_17;
  PyObject *(*__pyx_t_18)(PyObject *);
  CK_MECHANISM_TYPE __pyx_t_19;
  CK_RSA_PKCS_MGF_TYPE __pyx_t_20;
  CK_RSA_PKCS_PSS_PARAMS *__pyx_t_21;
  CK_ULONG __pyx_t_22;
  CK_EDDSA_PARAMS *__pyx_t_23;
  CK_BBOOL __pyx_t_24;
  CK_ECDH1_DERIVE_PARAMS *__pyx_t_25;
  CK_EC_KDF_TYPE __pyx_t_26;
  CK_AES_CBC_ENCRYPT_DATA_PARAMS *__pyx_t_27;
  CK_BYTE __pyx_t_28[16];
  CK_GCM_PARAMS *__pyx_t_29;
  CK_AES_CTR_PARAMS *__pyx_t_30;
  void *__pyx_t_31;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_mechanism);
  __Pyx_INCREF(__pyx_v_param);

  /* "pkcs11/_pkcs11.pyx":157
 * 
 *     def __init__(self, key_type, mapping, mechanism=None, param=None):
 *         self._python_param = param             # <<<<<<<<<<<<<<
 *         if mechanism is None:
 *             try:
*/
  __Pyx_INCREF(__pyx_v_param);
  __Pyx_GIVEREF(__pyx_v_param);
  __Pyx_GOTREF(__pyx_v_self->_python_param);
  __Pyx_DECREF(__pyx_v_self->_python_param);
  __pyx_v_self->_python_param = __pyx_v_param;

  /* "pkcs11/_pkcs11.pyx":158
 *     def __init__(self, key_type, mapping, mechanism=None, param=None):
 *         self._python_param = param
 *         if mechanism is None:             # <<<<<<<<<<<<<<
 *             try:
 *                 mechanism = mapping[key_type]
*/
  __pyx_t_1 = (__pyx_v_mechanism == Py_None);
  if (__pyx_t_1) {

    /* "pkcs11/_pkcs11.pyx":159
 *         self._python_param = param
 *         if mechanism is None:
 *             try:             # <<<<<<<<<<<<<<
 *                 mechanism = mapping[key_type]
 *             except KeyError:
*/
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":160
 *         if mechanism is None:
 *             try:
 *                 mechanism = mapping[key_type]             # <<<<<<<<<<<<<<
 *             except KeyError:
 *                 raise ArgumentsBad("No default mechanism for this key type. "
*/
        __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_mapping, __pyx_v_key_type); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 160, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF_SET(__pyx_v_mechanism, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "pkcs11/_pkcs11.pyx":159
 *         self._python_param = param
 *         if mechanism is None:
 *             try:             # <<<<<<<<<<<<<<
 *                 mechanism = mapping[key_type]
 *             except KeyError:
*/
      }
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L9_try_end;
      __pyx_L4_error:;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "pkcs11/_pkcs11.pyx":161
 *             try:
 *                 mechanism = mapping[key_type]
 *             except KeyError:             # <<<<<<<<<<<<<<
 *                 raise ArgumentsBad("No default mechanism for this key type. "
 *                                     "Please specify `mechanism`.")
*/
      __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_KeyError))));
      if (__pyx_t_6) {
        __Pyx_AddTraceback("pkcs11._pkcs11.MechanismWithParam.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(0, 161, __pyx_L6_except_error)
        __Pyx_XGOTREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);

        /* "pkcs11/_pkcs11.pyx":162
 *                 mechanism = mapping[key_type]
 *             except KeyError:
 *                 raise ArgumentsBad("No default mechanism for this key type. "             # <<<<<<<<<<<<<<
 *                                     "Please specify `mechanism`.")
 * 
*/
        __pyx_t_10 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_ArgumentsBad); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 162, __pyx_L6_except_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_12 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_11))) {
          __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_11);
          assert(__pyx_t_10);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_11);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_11, __pyx__function);
          __pyx_t_12 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_No_default_mechanism_for_this_ke};
          __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 162, __pyx_L6_except_error)
          __Pyx_GOTREF(__pyx_t_9);
        }
        __Pyx_Raise(__pyx_t_9, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __PYX_ERR(0, 162, __pyx_L6_except_error)
      }
      goto __pyx_L6_except_error;

      /* "pkcs11/_pkcs11.pyx":159
 *         self._python_param = param
 *         if mechanism is None:
 *             try:             # <<<<<<<<<<<<<<
 *                 mechanism = mapping[key_type]
 *             except KeyError:
*/
      __pyx_L6_except_error:;
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      goto __pyx_L1_error;
      __pyx_L9_try_end:;
    }

    /* "pkcs11/_pkcs11.pyx":158
 *     def __init__(self, key_type, mapping, mechanism=None, param=None):
 *         self._python_param = param
 *         if mechanism is None:             # <<<<<<<<<<<<<<
 *             try:
 *                 mechanism = mapping[key_type]
*/
  }

  /* "pkcs11/_pkcs11.pyx":165
 *                                     "Please specify `mechanism`.")
 * 
 *         if not isinstance(mechanism, Mechanism):             # <<<<<<<<<<<<<<
 *             raise ArgumentsBad("`mechanism` must be a Mechanism.")
 *         # Possible types of parameters we might need to allocate
*/
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_Mechanism); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 165, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_1 = PyObject_IsInstance(__pyx_v_mechanism, __pyx_t_8); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 165, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_13 = (!__pyx_t_1);
  if (unlikely(__pyx_t_13)) {

    /* "pkcs11/_pkcs11.pyx":166
 * 
 *         if not isinstance(mechanism, Mechanism):
 *             raise ArgumentsBad("`mechanism` must be a Mechanism.")             # <<<<<<<<<<<<<<
 *         # Possible types of parameters we might need to allocate
 *         # These are used to make assigning to the object we malloc() easier
*/
    __pyx_t_7 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ArgumentsBad); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 166, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_12 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_7);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_12 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_mechanism_must_be_a_Mechanism};
      __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 166, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
    }
    __Pyx_Raise(__pyx_t_8, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __PYX_ERR(0, 166, __pyx_L1_error)

    /* "pkcs11/_pkcs11.pyx":165
 *                                     "Please specify `mechanism`.")
 * 
 *         if not isinstance(mechanism, Mechanism):             # <<<<<<<<<<<<<<
 *             raise ArgumentsBad("`mechanism` must be a Mechanism.")
 *         # Possible types of parameters we might need to allocate
*/
  }

  /* "pkcs11/_pkcs11.pyx":181
 *         # Unpack mechanism parameters
 * 
 *         if mechanism == Mechanism.AES_ECB_ENCRYPT_DATA:             # <<<<<<<<<<<<<<
 *             paramlen = sizeof(CK_KEY_DERIVATION_STRING_DATA)
 *             self.param = aes_ecb_params = \
*/
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_Mechanism); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_AES_ECB_ENCRYPT_DATA); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyObject_RichCompare(__pyx_v_mechanism, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 181, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 181, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__pyx_t_13) {

    /* "pkcs11/_pkcs11.pyx":182
 * 
 *         if mechanism == Mechanism.AES_ECB_ENCRYPT_DATA:
 *             paramlen = sizeof(CK_KEY_DERIVATION_STRING_DATA)             # <<<<<<<<<<<<<<
 *             self.param = aes_ecb_params = \
 *                 <CK_KEY_DERIVATION_STRING_DATA *> PyMem_Malloc(paramlen)
*/
    __pyx_v_paramlen = (sizeof(CK_KEY_DERIVATION_STRING_DATA));

    /* "pkcs11/_pkcs11.pyx":184
 *             paramlen = sizeof(CK_KEY_DERIVATION_STRING_DATA)
 *             self.param = aes_ecb_params = \
 *                 <CK_KEY_DERIVATION_STRING_DATA *> PyMem_Malloc(paramlen)             # <<<<<<<<<<<<<<
 *             aes_ecb_params.pData = <CK_BYTE *> param
 *             aes_ecb_params.ulLen = <CK_ULONG> len(param)
*/
    __pyx_t_14 = ((CK_KEY_DERIVATION_STRING_DATA *)PyMem_Malloc(__pyx_v_paramlen));

    /* "pkcs11/_pkcs11.pyx":183
 *         if mechanism == Mechanism.AES_ECB_ENCRYPT_DATA:
 *             paramlen = sizeof(CK_KEY_DERIVATION_STRING_DATA)
 *             self.param = aes_ecb_params = \             # <<<<<<<<<<<<<<
 *                 <CK_KEY_DERIVATION_STRING_DATA *> PyMem_Malloc(paramlen)
 *             aes_ecb_params.pData = <CK_BYTE *> param
*/
    __pyx_v_self->param = __pyx_t_14;
    __pyx_v_aes_ecb_params = __pyx_t_14;

    /* "pkcs11/_pkcs11.pyx":185
 *             self.param = aes_ecb_params = \
 *                 <CK_KEY_DERIVATION_STRING_DATA *> PyMem_Malloc(paramlen)
 *             aes_ecb_params.pData = <CK_BYTE *> param             # <<<<<<<<<<<<<<
 *             aes_ecb_params.ulLen = <CK_ULONG> len(param)
 * 
*/
    __pyx_t_15 = __Pyx_PyObject_AsWritableUString(__pyx_v_param); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) __PYX_ERR(0, 185, __pyx_L1_error)
    __pyx_v_aes_ecb_params->pData = ((CK_BYTE *)__pyx_t_15);

    /* "pkcs11/_pkcs11.pyx":186
 *                 <CK_KEY_DERIVATION_STRING_DATA *> PyMem_Malloc(paramlen)
 *             aes_ecb_params.pData = <CK_BYTE *> param
 *             aes_ecb_params.ulLen = <CK_ULONG> len(param)             # <<<<<<<<<<<<<<
 * 
 *         elif isinstance(param, bytes):
*/
    __pyx_t_16 = PyObject_Length(__pyx_v_param); if (unlikely(__pyx_t_16 == ((Py_ssize_t)-1))) __PYX_ERR(0, 186, __pyx_L1_error)
    __pyx_v_aes_ecb_params->ulLen = ((CK_ULONG)__pyx_t_16);

    /* "pkcs11/_pkcs11.pyx":181
 *         # Unpack mechanism parameters
 * 
 *         if mechanism == Mechanism.AES_ECB_ENCRYPT_DATA:             # <<<<<<<<<<<<<<
 *             paramlen = sizeof(CK_KEY_DERIVATION_STRING_DATA)
 *             self.param = aes_ecb_params = \
*/
    goto __pyx_L13;
  }

  /* "pkcs11/_pkcs11.pyx":188
 *             aes_ecb_params.ulLen = <CK_ULONG> len(param)
 * 
 *         elif isinstance(param, bytes):             # <<<<<<<<<<<<<<
 *             # Note: this is an escape hatch of sorts that can be used to provide parameters for
 *             #  unsupported algorithms in raw binary form.
*/
  __pyx_t_13 = PyBytes_Check(__pyx_v_param); 
  if (__pyx_t_13) {

    /* "pkcs11/_pkcs11.pyx":198
 *             # The parameter convention for AES_ECB_ENCRYPT_DATA predates this ordering decision,
 *             #  so it takes precedence over this branch for backwards compatibility.
 *             self.data.pParameter = <CK_BYTE *> param             # <<<<<<<<<<<<<<
 *             paramlen =  len(param)
 * 
*/
    __pyx_t_15 = __Pyx_PyObject_AsWritableUString(__pyx_v_param); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) __PYX_ERR(0, 198, __pyx_L1_error)
    __pyx_v_self->data->pParameter = ((CK_BYTE *)__pyx_t_15);

    /* "pkcs11/_pkcs11.pyx":199
 *             #  so it takes precedence over this branch for backwards compatibility.
 *             self.data.pParameter = <CK_BYTE *> param
 *             paramlen =  len(param)             # <<<<<<<<<<<<<<
 * 
 *         elif mechanism == Mechanism.RSA_PKCS_OAEP:
*/
    __pyx_t_16 = PyObject_Length(__pyx_v_param); if (unlikely(__pyx_t_16 == ((Py_ssize_t)-1))) __PYX_ERR(0, 199, __pyx_L1_error)
    __pyx_v_paramlen = __pyx_t_16;

    /* "pkcs11/_pkcs11.pyx":188
 *             aes_ecb_params.ulLen = <CK_ULONG> len(param)
 * 
 *         elif isinstance(param, bytes):             # <<<<<<<<<<<<<<
 *             # Note: this is an escape hatch of sorts that can be used to provide parameters for
 *             #  unsupported algorithms in raw binary form.
*/
    goto __pyx_L13;
  }

  /* "pkcs11/_pkcs11.pyx":201
 *             paramlen =  len(param)
 * 
 *         elif mechanism == Mechanism.RSA_PKCS_OAEP:             # <<<<<<<<<<<<<<
 *             paramlen = sizeof(CK_RSA_PKCS_OAEP_PARAMS)
 *             self.param = oaep_params = \
*/
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_Mechanism); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_RSA_PKCS_OAEP); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyObject_RichCompare(__pyx_v_mechanism, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__pyx_t_13) {

    /* "pkcs11/_pkcs11.pyx":202
 * 
 *         elif mechanism == Mechanism.RSA_PKCS_OAEP:
 *             paramlen = sizeof(CK_RSA_PKCS_OAEP_PARAMS)             # <<<<<<<<<<<<<<
 *             self.param = oaep_params = \
 *                 <CK_RSA_PKCS_OAEP_PARAMS *> PyMem_Malloc(paramlen)
*/
    __pyx_v_paramlen = (sizeof(CK_RSA_PKCS_OAEP_PARAMS));

    /* "pkcs11/_pkcs11.pyx":204
 *             paramlen = sizeof(CK_RSA_PKCS_OAEP_PARAMS)
 *             self.param = oaep_params = \
 *                 <CK_RSA_PKCS_OAEP_PARAMS *> PyMem_Malloc(paramlen)             # <<<<<<<<<<<<<<
 * 
 *             oaep_params.source = CKZ_DATA_SPECIFIED
*/
    __pyx_t_17 = ((CK_RSA_PKCS_OAEP_PARAMS *)PyMem_Malloc(__pyx_v_paramlen));

    /* "pkcs11/_pkcs11.pyx":203
 *         elif mechanism == Mechanism.RSA_PKCS_OAEP:
 *             paramlen = sizeof(CK_RSA_PKCS_OAEP_PARAMS)
 *             self.param = oaep_params = \             # <<<<<<<<<<<<<<
 *                 <CK_RSA_PKCS_OAEP_PARAMS *> PyMem_Malloc(paramlen)
 * 
*/
    __pyx_v_self->param = __pyx_t_17;
    __pyx_v_oaep_params = __pyx_t_17;

    /* "pkcs11/_pkcs11.pyx":206
 *                 <CK_RSA_PKCS_OAEP_PARAMS *> PyMem_Malloc(paramlen)
 * 
 *             oaep_params.source = CKZ_DATA_SPECIFIED             # <<<<<<<<<<<<<<
 * 
 *             if param is None:
*/
    __pyx_v_oaep_params->source = CKZ_DATA_SPECIFIED;

    /* "pkcs11/_pkcs11.pyx":208
 *             oaep_params.source = CKZ_DATA_SPECIFIED
 * 
 *             if param is None:             # <<<<<<<<<<<<<<
 *                 param = DEFAULT_MECHANISM_PARAMS[mechanism]
 * 
*/
    __pyx_t_13 = (__pyx_v_param == Py_None);
    if (__pyx_t_13) {

      /* "pkcs11/_pkcs11.pyx":209
 * 
 *             if param is None:
 *                 param = DEFAULT_MECHANISM_PARAMS[mechanism]             # <<<<<<<<<<<<<<
 * 
 *             (oaep_params.hashAlg, oaep_params.mgf, source_data) = param
*/
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_DEFAULT_MECHANISM_PARAMS); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 209, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_8, __pyx_v_mechanism); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 209, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF_SET(__pyx_v_param, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "pkcs11/_pkcs11.pyx":208
 *             oaep_params.source = CKZ_DATA_SPECIFIED
 * 
 *             if param is None:             # <<<<<<<<<<<<<<
 *                 param = DEFAULT_MECHANISM_PARAMS[mechanism]
 * 
*/
    }

    /* "pkcs11/_pkcs11.pyx":211
 *                 param = DEFAULT_MECHANISM_PARAMS[mechanism]
 * 
 *             (oaep_params.hashAlg, oaep_params.mgf, source_data) = param             # <<<<<<<<<<<<<<
 * 
 *             if source_data is None:
*/
    if ((likely(PyTuple_CheckExact(__pyx_v_param))) || (PyList_CheckExact(__pyx_v_param))) {
      PyObject* sequence = __pyx_v_param;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 211, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_8);
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2);
        __Pyx_INCREF(__pyx_t_7);
      } else {
        __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 211, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_5);
        __pyx_t_8 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 211, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_8);
        __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 211, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_7);
      }
      #else
      __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 211, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 211, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 211, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
    } else {
      Py_ssize_t index = -1;
      __pyx_t_9 = PyObject_GetIter(__pyx_v_param); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 211, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_18 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_9);
      index = 0; __pyx_t_5 = __pyx_t_18(__pyx_t_9); if (unlikely(!__pyx_t_5)) goto __pyx_L15_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_8 = __pyx_t_18(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L15_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      index = 2; __pyx_t_7 = __pyx_t_18(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L15_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_18(__pyx_t_9), 3) < (0)) __PYX_ERR(0, 211, __pyx_L1_error)
      __pyx_t_18 = NULL;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L16_unpacking_done;
      __pyx_L15_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_18 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 211, __pyx_L1_error)
      __pyx_L16_unpacking_done:;
    }
    __pyx_t_19 = __Pyx_PyLong_As_CK_ULONG(__pyx_t_5); if (unlikely((__pyx_t_19 == ((CK_MECHANISM_TYPE)-1)) && PyErr_Occurred())) __PYX_ERR(0, 211, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_20 = __Pyx_PyLong_As_CK_ULONG(__pyx_t_8); if (unlikely((__pyx_t_20 == ((CK_RSA_PKCS_MGF_TYPE)-1)) && PyErr_Occurred())) __PYX_ERR(0, 211, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_v_oaep_params->hashAlg = __pyx_t_19;
    __pyx_v_oaep_params->mgf = __pyx_t_20;
    __pyx_v_source_data = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pkcs11/_pkcs11.pyx":213
 *             (oaep_params.hashAlg, oaep_params.mgf, source_data) = param
 * 
 *             if source_data is None:             # <<<<<<<<<<<<<<
 *                 oaep_params.pSourceData = NULL
 *                 oaep_params.ulSourceDataLen = <CK_ULONG> 0
*/
    __pyx_t_13 = (__pyx_v_source_data == Py_None);
    if (__pyx_t_13) {

      /* "pkcs11/_pkcs11.pyx":214
 * 
 *             if source_data is None:
 *                 oaep_params.pSourceData = NULL             # <<<<<<<<<<<<<<
 *                 oaep_params.ulSourceDataLen = <CK_ULONG> 0
 *             else:
*/
      __pyx_v_oaep_params->pSourceData = NULL;

      /* "pkcs11/_pkcs11.pyx":215
 *             if source_data is None:
 *                 oaep_params.pSourceData = NULL
 *                 oaep_params.ulSourceDataLen = <CK_ULONG> 0             # <<<<<<<<<<<<<<
 *             else:
 *                 oaep_params.pSourceData = <CK_BYTE *> source_data
*/
      __pyx_v_oaep_params->ulSourceDataLen = ((CK_ULONG)0);

      /* "pkcs11/_pkcs11.pyx":213
 *             (oaep_params.hashAlg, oaep_params.mgf, source_data) = param
 * 
 *             if source_data is None:             # <<<<<<<<<<<<<<
 *                 oaep_params.pSourceData = NULL
 *                 oaep_params.ulSourceDataLen = <CK_ULONG> 0
*/
      goto __pyx_L17;
    }

    /* "pkcs11/_pkcs11.pyx":217
 *                 oaep_params.ulSourceDataLen = <CK_ULONG> 0
 *             else:
 *                 oaep_params.pSourceData = <CK_BYTE *> source_data             # <<<<<<<<<<<<<<
 *                 oaep_params.ulSourceDataLen = <CK_ULONG> len(source_data)
 * 
*/
    /*else*/ {
      __pyx_t_15 = __Pyx_PyObject_AsWritableUString(__pyx_v_source_data); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) __PYX_ERR(0, 217, __pyx_L1_error)
      __pyx_v_oaep_params->pSourceData = ((CK_BYTE *)__pyx_t_15);

      /* "pkcs11/_pkcs11.pyx":218
 *             else:
 *                 oaep_params.pSourceData = <CK_BYTE *> source_data
 *                 oaep_params.ulSourceDataLen = <CK_ULONG> len(source_data)             # <<<<<<<<<<<<<<
 * 
 *         elif mechanism in (Mechanism.RSA_PKCS_PSS,
*/
      __pyx_t_16 = PyObject_Length(__pyx_v_source_data); if (unlikely(__pyx_t_16 == ((Py_ssize_t)-1))) __PYX_ERR(0, 218, __pyx_L1_error)
      __pyx_v_oaep_params->ulSourceDataLen = ((CK_ULONG)__pyx_t_16);
    }
    __pyx_L17:;

    /* "pkcs11/_pkcs11.pyx":201
 *             paramlen =  len(param)
 * 
 *         elif mechanism == Mechanism.RSA_PKCS_OAEP:             # <<<<<<<<<<<<<<
 *             paramlen = sizeof(CK_RSA_PKCS_OAEP_PARAMS)
 *             self.param = oaep_params = \
*/
    goto __pyx_L13;
  }

  /* "pkcs11/_pkcs11.pyx":220
 *                 oaep_params.ulSourceDataLen = <CK_ULONG> len(source_data)
 * 
 *         elif mechanism in (Mechanism.RSA_PKCS_PSS,             # <<<<<<<<<<<<<<
 *                            Mechanism.SHA1_RSA_PKCS_PSS,
 *                            Mechanism.SHA224_RSA_PKCS_PSS,
*/
  __Pyx_INCREF(__pyx_v_mechanism);
  __pyx_t_7 = __pyx_v_mechanism;
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_Mechanism); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_RSA_PKCS_PSS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyObject_RichCompare(__pyx_t_7, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 220, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 220, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (!__pyx_t_1) {
  } else {
    __pyx_t_13 = __pyx_t_1;
    goto __pyx_L18_bool_binop_done;
  }

  /* "pkcs11/_pkcs11.pyx":221
 * 
 *         elif mechanism in (Mechanism.RSA_PKCS_PSS,
 *                            Mechanism.SHA1_RSA_PKCS_PSS,             # <<<<<<<<<<<<<<
 *                            Mechanism.SHA224_RSA_PKCS_PSS,
 *                            Mechanism.SHA256_RSA_PKCS_PSS,
*/
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_Mechanism); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_SHA1_RSA_PKCS_PSS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyObject_RichCompare(__pyx_t_7, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 220, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":220
 *                 oaep_params.ulSourceDataLen = <CK_ULONG> len(source_data)
 * 
 *         elif mechanism in (Mechanism.RSA_PKCS_PSS,             # <<<<<<<<<<<<<<
 *                            Mechanism.SHA1_RSA_PKCS_PSS,
 *                            Mechanism.SHA224_RSA_PKCS_PSS,
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 220, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (!__pyx_t_1) {
  } else {
    __pyx_t_13 = __pyx_t_1;
    goto __pyx_L18_bool_binop_done;
  }

  /* "pkcs11/_pkcs11.pyx":222
 *         elif mechanism in (Mechanism.RSA_PKCS_PSS,
 *                            Mechanism.SHA1_RSA_PKCS_PSS,
 *                            Mechanism.SHA224_RSA_PKCS_PSS,             # <<<<<<<<<<<<<<
 *                            Mechanism.SHA256_RSA_PKCS_PSS,
 *                            Mechanism.SHA384_RSA_PKCS_PSS,
*/
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_Mechanism); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_SHA224_RSA_PKCS_PSS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyObject_RichCompare(__pyx_t_7, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 220, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":220
 *                 oaep_params.ulSourceDataLen = <CK_ULONG> len(source_data)
 * 
 *         elif mechanism in (Mechanism.RSA_PKCS_PSS,             # <<<<<<<<<<<<<<
 *                            Mechanism.SHA1_RSA_PKCS_PSS,
 *                            Mechanism.SHA224_RSA_PKCS_PSS,
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 220, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (!__pyx_t_1) {
  } else {
    __pyx_t_13 = __pyx_t_1;
    goto __pyx_L18_bool_binop_done;
  }

  /* "pkcs11/_pkcs11.pyx":223
 *                            Mechanism.SHA1_RSA_PKCS_PSS,
 *                            Mechanism.SHA224_RSA_PKCS_PSS,
 *                            Mechanism.SHA256_RSA_PKCS_PSS,             # <<<<<<<<<<<<<<
 *                            Mechanism.SHA384_RSA_PKCS_PSS,
 *                            Mechanism.SHA512_RSA_PKCS_PSS):
*/
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_Mechanism); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_SHA256_RSA_PKCS_PSS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyObject_RichCompare(__pyx_t_7, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 220, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":220
 *                 oaep_params.ulSourceDataLen = <CK_ULONG> len(source_data)
 * 
 *         elif mechanism in (Mechanism.RSA_PKCS_PSS,             # <<<<<<<<<<<<<<
 *                            Mechanism.SHA1_RSA_PKCS_PSS,
 *                            Mechanism.SHA224_RSA_PKCS_PSS,
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 220, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (!__pyx_t_1) {
  } else {
    __pyx_t_13 = __pyx_t_1;
    goto __pyx_L18_bool_binop_done;
  }

  /* "pkcs11/_pkcs11.pyx":224
 *                            Mechanism.SHA224_RSA_PKCS_PSS,
 *                            Mechanism.SHA256_RSA_PKCS_PSS,
 *                            Mechanism.SHA384_RSA_PKCS_PSS,             # <<<<<<<<<<<<<<
 *                            Mechanism.SHA512_RSA_PKCS_PSS):
 *             paramlen = sizeof(CK_RSA_PKCS_PSS_PARAMS)
*/
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_Mechanism); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_SHA384_RSA_PKCS_PSS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyObject_RichCompare(__pyx_t_7, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 220, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":220
 *                 oaep_params.ulSourceDataLen = <CK_ULONG> len(source_data)
 * 
 *         elif mechanism in (Mechanism.RSA_PKCS_PSS,             # <<<<<<<<<<<<<<
 *                            Mechanism.SHA1_RSA_PKCS_PSS,
 *                            Mechanism.SHA224_RSA_PKCS_PSS,
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 220, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (!__pyx_t_1) {
  } else {
    __pyx_t_13 = __pyx_t_1;
    goto __pyx_L18_bool_binop_done;
  }

  /* "pkcs11/_pkcs11.pyx":225
 *                            Mechanism.SHA256_RSA_PKCS_PSS,
 *                            Mechanism.SHA384_RSA_PKCS_PSS,
 *                            Mechanism.SHA512_RSA_PKCS_PSS):             # <<<<<<<<<<<<<<
 *             paramlen = sizeof(CK_RSA_PKCS_PSS_PARAMS)
 *             self.param = pss_params = \
*/
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_Mechanism); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_SHA512_RSA_PKCS_PSS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyObject_RichCompare(__pyx_t_7, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 220, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":220
 *                 oaep_params.ulSourceDataLen = <CK_ULONG> len(source_data)
 * 
 *         elif mechanism in (Mechanism.RSA_PKCS_PSS,             # <<<<<<<<<<<<<<
 *                            Mechanism.SHA1_RSA_PKCS_PSS,
 *                            Mechanism.SHA224_RSA_PKCS_PSS,
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 220, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_13 = __pyx_t_1;
  __pyx_L18_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_1 = __pyx_t_13;
  if (__pyx_t_1) {

    /* "pkcs11/_pkcs11.pyx":226
 *                            Mechanism.SHA384_RSA_PKCS_PSS,
 *                            Mechanism.SHA512_RSA_PKCS_PSS):
 *             paramlen = sizeof(CK_RSA_PKCS_PSS_PARAMS)             # <<<<<<<<<<<<<<
 *             self.param = pss_params = \
 *                 <CK_RSA_PKCS_PSS_PARAMS *> PyMem_Malloc(paramlen)
*/
    __pyx_v_paramlen = (sizeof(CK_RSA_PKCS_PSS_PARAMS));

    /* "pkcs11/_pkcs11.pyx":228
 *             paramlen = sizeof(CK_RSA_PKCS_PSS_PARAMS)
 *             self.param = pss_params = \
 *                 <CK_RSA_PKCS_PSS_PARAMS *> PyMem_Malloc(paramlen)             # <<<<<<<<<<<<<<
 * 
 *             if param is None:
*/
    __pyx_t_21 = ((CK_RSA_PKCS_PSS_PARAMS *)PyMem_Malloc(__pyx_v_paramlen));

    /* "pkcs11/_pkcs11.pyx":227
 *                            Mechanism.SHA512_RSA_PKCS_PSS):
 *             paramlen = sizeof(CK_RSA_PKCS_PSS_PARAMS)
 *             self.param = pss_params = \             # <<<<<<<<<<<<<<
 *                 <CK_RSA_PKCS_PSS_PARAMS *> PyMem_Malloc(paramlen)
 * 
*/
    __pyx_v_self->param = __pyx_t_21;
    __pyx_v_pss_params = __pyx_t_21;

    /* "pkcs11/_pkcs11.pyx":230
 *                 <CK_RSA_PKCS_PSS_PARAMS *> PyMem_Malloc(paramlen)
 * 
 *             if param is None:             # <<<<<<<<<<<<<<
 *                 # All PSS mechanisms have the same defaults
 *                 param = DEFAULT_MECHANISM_PARAMS[Mechanism.RSA_PKCS_PSS]
*/
    __pyx_t_1 = (__pyx_v_param == Py_None);
    if (__pyx_t_1) {

      /* "pkcs11/_pkcs11.pyx":232
 *             if param is None:
 *                 # All PSS mechanisms have the same defaults
 *                 param = DEFAULT_MECHANISM_PARAMS[Mechanism.RSA_PKCS_PSS]             # <<<<<<<<<<<<<<
 * 
 *             (pss_params.hashAlg, pss_params.mgf, pss_params.sLen) = param
*/
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_DEFAULT_MECHANISM_PARAMS); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 232, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_Mechanism); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 232, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_RSA_PKCS_PSS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 232, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 232, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF_SET(__pyx_v_param, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "pkcs11/_pkcs11.pyx":230
 *                 <CK_RSA_PKCS_PSS_PARAMS *> PyMem_Malloc(paramlen)
 * 
 *             if param is None:             # <<<<<<<<<<<<<<
 *                 # All PSS mechanisms have the same defaults
 *                 param = DEFAULT_MECHANISM_PARAMS[Mechanism.RSA_PKCS_PSS]
*/
    }

    /* "pkcs11/_pkcs11.pyx":234
 *                 param = DEFAULT_MECHANISM_PARAMS[Mechanism.RSA_PKCS_PSS]
 * 
 *             (pss_params.hashAlg, pss_params.mgf, pss_params.sLen) = param             # <<<<<<<<<<<<<<
 * 
 *         elif mechanism == Mechanism.EDDSA and param is not None:
*/
    if ((likely(PyTuple_CheckExact(__pyx_v_param))) || (PyList_CheckExact(__pyx_v_param))) {
      PyObject* sequence = __pyx_v_param;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 234, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0);
        __Pyx_INCREF(__pyx_t_8);
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2);
        __Pyx_INCREF(__pyx_t_7);
      } else {
        __pyx_t_8 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 234, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_8);
        __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 234, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_5);
        __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 234, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_7);
      }
      #else
      __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 234, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 234, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 234, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
    } else {
      Py_ssize_t index = -1;
      __pyx_t_9 = PyObject_GetIter(__pyx_v_param); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 234, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_18 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_9);
      index = 0; __pyx_t_8 = __pyx_t_18(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L25_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      index = 1; __pyx_t_5 = __pyx_t_18(__pyx_t_9); if (unlikely(!__pyx_t_5)) goto __pyx_L25_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 2; __pyx_t_7 = __pyx_t_18(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L25_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_18(__pyx_t_9), 3) < (0)) __PYX_ERR(0, 234, __pyx_L1_error)
      __pyx_t_18 = NULL;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L26_unpacking_done;
      __pyx_L25_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_18 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 234, __pyx_L1_error)
      __pyx_L26_unpacking_done:;
    }
    __pyx_t_19 = __Pyx_PyLong_As_CK_ULONG(__pyx_t_8); if (unlikely((__pyx_t_19 == ((CK_MECHANISM_TYPE)-1)) && PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_20 = __Pyx_PyLong_As_CK_ULONG(__pyx_t_5); if (unlikely((__pyx_t_20 == ((CK_RSA_PKCS_MGF_TYPE)-1)) && PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_22 = __Pyx_PyLong_As_CK_ULONG(__pyx_t_7); if (unlikely((__pyx_t_22 == ((CK_ULONG)-1)) && PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_pss_params->hashAlg = __pyx_t_19;
    __pyx_v_pss_params->mgf = __pyx_t_20;
    __pyx_v_pss_params->sLen = __pyx_t_22;

    /* "pkcs11/_pkcs11.pyx":220
 *                 oaep_params.ulSourceDataLen = <CK_ULONG> len(source_data)
 * 
 *         elif mechanism in (Mechanism.RSA_PKCS_PSS,             # <<<<<<<<<<<<<<
 *                            Mechanism.SHA1_RSA_PKCS_PSS,
 *                            Mechanism.SHA224_RSA_PKCS_PSS,
*/
    goto __pyx_L13;
  }

  /* "pkcs11/_pkcs11.pyx":236
 *             (pss_params.hashAlg, pss_params.mgf, pss_params.sLen) = param
 * 
 *         elif mechanism == Mechanism.EDDSA and param is not None:             # <<<<<<<<<<<<<<
 *             paramlen = sizeof(CK_EDDSA_PARAMS)
 *             self.param = eddsa_params = \
*/
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Mechanism); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_EDDSA); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyObject_RichCompare(__pyx_v_mechanism, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 236, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 236, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_13) {
  } else {
    __pyx_t_1 = __pyx_t_13;
    goto __pyx_L27_bool_binop_done;
  }
  __pyx_t_13 = (__pyx_v_param != Py_None);
  __pyx_t_1 = __pyx_t_13;
  __pyx_L27_bool_binop_done:;
  if (__pyx_t_1) {

    /* "pkcs11/_pkcs11.pyx":237
 * 
 *         elif mechanism == Mechanism.EDDSA and param is not None:
 *             paramlen = sizeof(CK_EDDSA_PARAMS)             # <<<<<<<<<<<<<<
 *             self.param = eddsa_params = \
 *                 <CK_EDDSA_PARAMS *> PyMem_Malloc(paramlen)
*/
    __pyx_v_paramlen = (sizeof(CK_EDDSA_PARAMS));

    /* "pkcs11/_pkcs11.pyx":239
 *             paramlen = sizeof(CK_EDDSA_PARAMS)
 *             self.param = eddsa_params = \
 *                 <CK_EDDSA_PARAMS *> PyMem_Malloc(paramlen)             # <<<<<<<<<<<<<<
 *             (eddsa_params.phFlag, context_data) = param
 *             if context_data is None:
*/
    __pyx_t_23 = ((CK_EDDSA_PARAMS *)PyMem_Malloc(__pyx_v_paramlen));

    /* "pkcs11/_pkcs11.pyx":238
 *         elif mechanism == Mechanism.EDDSA and param is not None:
 *             paramlen = sizeof(CK_EDDSA_PARAMS)
 *             self.param = eddsa_params = \             # <<<<<<<<<<<<<<
 *                 <CK_EDDSA_PARAMS *> PyMem_Malloc(paramlen)
 *             (eddsa_params.phFlag, context_data) = param
*/
    __pyx_v_self->param = __pyx_t_23;
    __pyx_v_eddsa_params = __pyx_t_23;

    /* "pkcs11/_pkcs11.pyx":240
 *             self.param = eddsa_params = \
 *                 <CK_EDDSA_PARAMS *> PyMem_Malloc(paramlen)
 *             (eddsa_params.phFlag, context_data) = param             # <<<<<<<<<<<<<<
 *             if context_data is None:
 *                 eddsa_params.pContextData = NULL
*/
    if ((likely(PyTuple_CheckExact(__pyx_v_param))) || (PyList_CheckExact(__pyx_v_param))) {
      PyObject* sequence = __pyx_v_param;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 240, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0);
        __Pyx_INCREF(__pyx_t_7);
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_5);
      } else {
        __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 240, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_7);
        __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 240, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_5);
      }
      #else
      __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 240, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 240, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
    } else {
      Py_ssize_t index = -1;
      __pyx_t_8 = PyObject_GetIter(__pyx_v_param); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 240, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_18 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_8);
      index = 0; __pyx_t_7 = __pyx_t_18(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L29_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_5 = __pyx_t_18(__pyx_t_8); if (unlikely(!__pyx_t_5)) goto __pyx_L29_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_18(__pyx_t_8), 2) < (0)) __PYX_ERR(0, 240, __pyx_L1_error)
      __pyx_t_18 = NULL;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L30_unpacking_done;
      __pyx_L29_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_18 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 240, __pyx_L1_error)
      __pyx_L30_unpacking_done:;
    }
    __pyx_t_24 = __Pyx_PyLong_As_CK_BYTE(__pyx_t_7); if (unlikely((__pyx_t_24 == ((CK_BBOOL)-1)) && PyErr_Occurred())) __PYX_ERR(0, 240, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_eddsa_params->phFlag = __pyx_t_24;
    __pyx_v_context_data = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pkcs11/_pkcs11.pyx":241
 *                 <CK_EDDSA_PARAMS *> PyMem_Malloc(paramlen)
 *             (eddsa_params.phFlag, context_data) = param
 *             if context_data is None:             # <<<<<<<<<<<<<<
 *                 eddsa_params.pContextData = NULL
 *                 eddsa_params.ulContextDataLen = 0
*/
    __pyx_t_1 = (__pyx_v_context_data == Py_None);
    if (__pyx_t_1) {

      /* "pkcs11/_pkcs11.pyx":242
 *             (eddsa_params.phFlag, context_data) = param
 *             if context_data is None:
 *                 eddsa_params.pContextData = NULL             # <<<<<<<<<<<<<<
 *                 eddsa_params.ulContextDataLen = 0
 *             else:
*/
      __pyx_v_eddsa_params->pContextData = NULL;

      /* "pkcs11/_pkcs11.pyx":243
 *             if context_data is None:
 *                 eddsa_params.pContextData = NULL
 *                 eddsa_params.ulContextDataLen = 0             # <<<<<<<<<<<<<<
 *             else:
 *                 eddsa_params.pContextData = context_data
*/
      __pyx_v_eddsa_params->ulContextDataLen = 0;

      /* "pkcs11/_pkcs11.pyx":241
 *                 <CK_EDDSA_PARAMS *> PyMem_Malloc(paramlen)
 *             (eddsa_params.phFlag, context_data) = param
 *             if context_data is None:             # <<<<<<<<<<<<<<
 *                 eddsa_params.pContextData = NULL
 *                 eddsa_params.ulContextDataLen = 0
*/
      goto __pyx_L31;
    }

    /* "pkcs11/_pkcs11.pyx":245
 *                 eddsa_params.ulContextDataLen = 0
 *             else:
 *                 eddsa_params.pContextData = context_data             # <<<<<<<<<<<<<<
 *                 eddsa_params.ulContextDataLen = <CK_ULONG> len(context_data)
 * 
*/
    /*else*/ {
      __pyx_t_15 = __Pyx_PyObject_AsWritableUString(__pyx_v_context_data); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) __PYX_ERR(0, 245, __pyx_L1_error)
      __pyx_v_eddsa_params->pContextData = __pyx_t_15;

      /* "pkcs11/_pkcs11.pyx":246
 *             else:
 *                 eddsa_params.pContextData = context_data
 *                 eddsa_params.ulContextDataLen = <CK_ULONG> len(context_data)             # <<<<<<<<<<<<<<
 * 
 *         elif mechanism in (
*/
      __pyx_t_16 = PyObject_Length(__pyx_v_context_data); if (unlikely(__pyx_t_16 == ((Py_ssize_t)-1))) __PYX_ERR(0, 246, __pyx_L1_error)
      __pyx_v_eddsa_params->ulContextDataLen = ((CK_ULONG)__pyx_t_16);
    }
    __pyx_L31:;

    /* "pkcs11/_pkcs11.pyx":236
 *             (pss_params.hashAlg, pss_params.mgf, pss_params.sLen) = param
 * 
 *         elif mechanism == Mechanism.EDDSA and param is not None:             # <<<<<<<<<<<<<<
 *             paramlen = sizeof(CK_EDDSA_PARAMS)
 *             self.param = eddsa_params = \
*/
    goto __pyx_L13;
  }

  /* "pkcs11/_pkcs11.pyx":248
 *                 eddsa_params.ulContextDataLen = <CK_ULONG> len(context_data)
 * 
 *         elif mechanism in (             # <<<<<<<<<<<<<<
 *                 Mechanism.ECDH1_DERIVE,
 *                 Mechanism.ECDH1_COFACTOR_DERIVE):
*/
  __Pyx_INCREF(__pyx_v_mechanism);
  __pyx_t_5 = __pyx_v_mechanism;

  /* "pkcs11/_pkcs11.pyx":249
 * 
 *         elif mechanism in (
 *                 Mechanism.ECDH1_DERIVE,             # <<<<<<<<<<<<<<
 *                 Mechanism.ECDH1_COFACTOR_DERIVE):
 *             paramlen = sizeof(CK_ECDH1_DERIVE_PARAMS)
*/
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Mechanism); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_ECDH1_DERIVE); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyObject_RichCompare(__pyx_t_5, __pyx_t_8, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 248, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "pkcs11/_pkcs11.pyx":248
 *                 eddsa_params.ulContextDataLen = <CK_ULONG> len(context_data)
 * 
 *         elif mechanism in (             # <<<<<<<<<<<<<<
 *                 Mechanism.ECDH1_DERIVE,
 *                 Mechanism.ECDH1_COFACTOR_DERIVE):
*/
  __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 248, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (!__pyx_t_13) {
  } else {
    __pyx_t_1 = __pyx_t_13;
    goto __pyx_L32_bool_binop_done;
  }

  /* "pkcs11/_pkcs11.pyx":250
 *         elif mechanism in (
 *                 Mechanism.ECDH1_DERIVE,
 *                 Mechanism.ECDH1_COFACTOR_DERIVE):             # <<<<<<<<<<<<<<
 *             paramlen = sizeof(CK_ECDH1_DERIVE_PARAMS)
 *             self.param = ecdh1_params = \
*/
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Mechanism); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_ECDH1_COFACTOR_DERIVE); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyObject_RichCompare(__pyx_t_5, __pyx_t_8, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 248, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "pkcs11/_pkcs11.pyx":248
 *                 eddsa_params.ulContextDataLen = <CK_ULONG> len(context_data)
 * 
 *         elif mechanism in (             # <<<<<<<<<<<<<<
 *                 Mechanism.ECDH1_DERIVE,
 *                 Mechanism.ECDH1_COFACTOR_DERIVE):
*/
  __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 248, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_1 = __pyx_t_13;
  __pyx_L32_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_13 = __pyx_t_1;
  if (__pyx_t_13) {

    /* "pkcs11/_pkcs11.pyx":251
 *                 Mechanism.ECDH1_DERIVE,
 *                 Mechanism.ECDH1_COFACTOR_DERIVE):
 *             paramlen = sizeof(CK_ECDH1_DERIVE_PARAMS)             # <<<<<<<<<<<<<<
 *             self.param = ecdh1_params = \
 *                 <CK_ECDH1_DERIVE_PARAMS *> PyMem_Malloc(paramlen)
*/
    __pyx_v_paramlen = (sizeof(CK_ECDH1_DERIVE_PARAMS));

    /* "pkcs11/_pkcs11.pyx":253
 *             paramlen = sizeof(CK_ECDH1_DERIVE_PARAMS)
 *             self.param = ecdh1_params = \
 *                 <CK_ECDH1_DERIVE_PARAMS *> PyMem_Malloc(paramlen)             # <<<<<<<<<<<<<<
 * 
 *             (ecdh1_params.kdf, shared_data, public_data) = param
*/
    __pyx_t_25 = ((CK_ECDH1_DERIVE_PARAMS *)PyMem_Malloc(__pyx_v_paramlen));

    /* "pkcs11/_pkcs11.pyx":252
 *                 Mechanism.ECDH1_COFACTOR_DERIVE):
 *             paramlen = sizeof(CK_ECDH1_DERIVE_PARAMS)
 *             self.param = ecdh1_params = \             # <<<<<<<<<<<<<<
 *                 <CK_ECDH1_DERIVE_PARAMS *> PyMem_Malloc(paramlen)
 * 
*/
    __pyx_v_self->param = __pyx_t_25;
    __pyx_v_ecdh1_params = __pyx_t_25;

    /* "pkcs11/_pkcs11.pyx":255
 *                 <CK_ECDH1_DERIVE_PARAMS *> PyMem_Malloc(paramlen)
 * 
 *             (ecdh1_params.kdf, shared_data, public_data) = param             # <<<<<<<<<<<<<<
 * 
 *             if shared_data is None:
*/
    if ((likely(PyTuple_CheckExact(__pyx_v_param))) || (PyList_CheckExact(__pyx_v_param))) {
      PyObject* sequence = __pyx_v_param;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 255, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_7);
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 2);
        __Pyx_INCREF(__pyx_t_8);
      } else {
        __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 255, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_5);
        __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 255, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_7);
        __pyx_t_8 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 255, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_8);
      }
      #else
      __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 255, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 255, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 255, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      #endif
    } else {
      Py_ssize_t index = -1;
      __pyx_t_9 = PyObject_GetIter(__pyx_v_param); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 255, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_18 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_9);
      index = 0; __pyx_t_5 = __pyx_t_18(__pyx_t_9); if (unlikely(!__pyx_t_5)) goto __pyx_L34_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_7 = __pyx_t_18(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L34_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 2; __pyx_t_8 = __pyx_t_18(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L34_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_18(__pyx_t_9), 3) < (0)) __PYX_ERR(0, 255, __pyx_L1_error)
      __pyx_t_18 = NULL;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L35_unpacking_done;
      __pyx_L34_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_18 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 255, __pyx_L1_error)
      __pyx_L35_unpacking_done:;
    }
    __pyx_t_26 = __Pyx_PyLong_As_CK_ULONG(__pyx_t_5); if (unlikely((__pyx_t_26 == ((CK_EC_KDF_TYPE)-1)) && PyErr_Occurred())) __PYX_ERR(0, 255, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_ecdh1_params->kdf = __pyx_t_26;
    __pyx_v_shared_data = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_public_data = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "pkcs11/_pkcs11.pyx":257
 *             (ecdh1_params.kdf, shared_data, public_data) = param
 * 
 *             if shared_data is None:             # <<<<<<<<<<<<<<
 *                 ecdh1_params.pSharedData = NULL
 *                 ecdh1_params.ulSharedDataLen = 0
*/
    __pyx_t_13 = (__pyx_v_shared_data == Py_None);
    if (__pyx_t_13) {

      /* "pkcs11/_pkcs11.pyx":258
 * 
 *             if shared_data is None:
 *                 ecdh1_params.pSharedData = NULL             # <<<<<<<<<<<<<<
 *                 ecdh1_params.ulSharedDataLen = 0
 *             else:
*/
      __pyx_v_ecdh1_params->pSharedData = NULL;

      /* "pkcs11/_pkcs11.pyx":259
 *             if shared_data is None:
 *                 ecdh1_params.pSharedData = NULL
 *                 ecdh1_params.ulSharedDataLen = 0             # <<<<<<<<<<<<<<
 *             else:
 *                 ecdh1_params.pSharedData = shared_data
*/
      __pyx_v_ecdh1_params->ulSharedDataLen = 0;

      /* "pkcs11/_pkcs11.pyx":257
 *             (ecdh1_params.kdf, shared_data, public_data) = param
 * 
 *             if shared_data is None:             # <<<<<<<<<<<<<<
 *                 ecdh1_params.pSharedData = NULL
 *                 ecdh1_params.ulSharedDataLen = 0
*/
      goto __pyx_L36;
    }

    /* "pkcs11/_pkcs11.pyx":261
 *                 ecdh1_params.ulSharedDataLen = 0
 *             else:
 *                 ecdh1_params.pSharedData = shared_data             # <<<<<<<<<<<<<<
 *                 ecdh1_params.ulSharedDataLen = <CK_ULONG> len(shared_data)
 * 
*/
    /*else*/ {
      __pyx_t_15 = __Pyx_PyObject_AsWritableUString(__pyx_v_shared_data); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) __PYX_ERR(0, 261, __pyx_L1_error)
      __pyx_v_ecdh1_params->pSharedData = __pyx_t_15;

      /* "pkcs11/_pkcs11.pyx":262
 *             else:
 *                 ecdh1_params.pSharedData = shared_data
 *                 ecdh1_params.ulSharedDataLen = <CK_ULONG> len(shared_data)             # <<<<<<<<<<<<<<
 * 
 *             ecdh1_params.pPublicData = public_data
*/
      __pyx_t_16 = PyObject_Length(__pyx_v_shared_data); if (unlikely(__pyx_t_16 == ((Py_ssize_t)-1))) __PYX_ERR(0, 262, __pyx_L1_error)
      __pyx_v_ecdh1_params->ulSharedDataLen = ((CK_ULONG)__pyx_t_16);
    }
    __pyx_L36:;

    /* "pkcs11/_pkcs11.pyx":264
 *                 ecdh1_params.ulSharedDataLen = <CK_ULONG> len(shared_data)
 * 
 *             ecdh1_params.pPublicData = public_data             # <<<<<<<<<<<<<<
 *             ecdh1_params.ulPublicDataLen = <CK_ULONG> len(public_data)
 * 
*/
    __pyx_t_15 = __Pyx_PyObject_AsWritableUString(__pyx_v_public_data); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) __PYX_ERR(0, 264, __pyx_L1_error)
    __pyx_v_ecdh1_params->pPublicData = __pyx_t_15;

    /* "pkcs11/_pkcs11.pyx":265
 * 
 *             ecdh1_params.pPublicData = public_data
 *             ecdh1_params.ulPublicDataLen = <CK_ULONG> len(public_data)             # <<<<<<<<<<<<<<
 * 
 *         elif mechanism == Mechanism.AES_CBC_ENCRYPT_DATA:
*/
    __pyx_t_16 = PyObject_Length(__pyx_v_public_data); if (unlikely(__pyx_t_16 == ((Py_ssize_t)-1))) __PYX_ERR(0, 265, __pyx_L1_error)
    __pyx_v_ecdh1_params->ulPublicDataLen = ((CK_ULONG)__pyx_t_16);

    /* "pkcs11/_pkcs11.pyx":248
 *                 eddsa_params.ulContextDataLen = <CK_ULONG> len(context_data)
 * 
 *         elif mechanism in (             # <<<<<<<<<<<<<<
 *                 Mechanism.ECDH1_DERIVE,
 *                 Mechanism.ECDH1_COFACTOR_DERIVE):
*/
    goto __pyx_L13;
  }

  /* "pkcs11/_pkcs11.pyx":267
 *             ecdh1_params.ulPublicDataLen = <CK_ULONG> len(public_data)
 * 
 *         elif mechanism == Mechanism.AES_CBC_ENCRYPT_DATA:             # <<<<<<<<<<<<<<
 *             paramlen = sizeof(CK_AES_CBC_ENCRYPT_DATA_PARAMS)
 *             self.param = aes_cbc_params = \
*/
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_Mechanism); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_AES_CBC_ENCRYPT_DATA); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyObject_RichCompare(__pyx_v_mechanism, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 267, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 267, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__pyx_t_13) {

    /* "pkcs11/_pkcs11.pyx":268
 * 
 *         elif mechanism == Mechanism.AES_CBC_ENCRYPT_DATA:
 *             paramlen = sizeof(CK_AES_CBC_ENCRYPT_DATA_PARAMS)             # <<<<<<<<<<<<<<
 *             self.param = aes_cbc_params = \
 *                     <CK_AES_CBC_ENCRYPT_DATA_PARAMS *> PyMem_Malloc(paramlen)
*/
    __pyx_v_paramlen = (sizeof(CK_AES_CBC_ENCRYPT_DATA_PARAMS));

    /* "pkcs11/_pkcs11.pyx":270
 *             paramlen = sizeof(CK_AES_CBC_ENCRYPT_DATA_PARAMS)
 *             self.param = aes_cbc_params = \
 *                     <CK_AES_CBC_ENCRYPT_DATA_PARAMS *> PyMem_Malloc(paramlen)             # <<<<<<<<<<<<<<
 *             (iv, data) = param
 *             aes_cbc_params.iv = iv[:16]
*/
    __pyx_t_27 = ((CK_AES_CBC_ENCRYPT_DATA_PARAMS *)PyMem_Malloc(__pyx_v_paramlen));

    /* "pkcs11/_pkcs11.pyx":269
 *         elif mechanism == Mechanism.AES_CBC_ENCRYPT_DATA:
 *             paramlen = sizeof(CK_AES_CBC_ENCRYPT_DATA_PARAMS)
 *             self.param = aes_cbc_params = \             # <<<<<<<<<<<<<<
 *                     <CK_AES_CBC_ENCRYPT_DATA_PARAMS *> PyMem_Malloc(paramlen)
 *             (iv, data) = param
*/
    __pyx_v_self->param = __pyx_t_27;
    __pyx_v_aes_cbc_params = __pyx_t_27;

    /* "pkcs11/_pkcs11.pyx":271
 *             self.param = aes_cbc_params = \
 *                     <CK_AES_CBC_ENCRYPT_DATA_PARAMS *> PyMem_Malloc(paramlen)
 *             (iv, data) = param             # <<<<<<<<<<<<<<
 *             aes_cbc_params.iv = iv[:16]
 *             aes_cbc_params.pData = <CK_BYTE *> data
*/
    if ((likely(PyTuple_CheckExact(__pyx_v_param))) || (PyList_CheckExact(__pyx_v_param))) {
      PyObject* sequence = __pyx_v_param;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 271, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0);
        __Pyx_INCREF(__pyx_t_8);
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_7);
      } else {
        __pyx_t_8 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 271, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_8);
        __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 271, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_7);
      }
      #else
      __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 271, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 271, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
    } else {
      Py_ssize_t index = -1;
      __pyx_t_5 = PyObject_GetIter(__pyx_v_param); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 271, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_18 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5);
      index = 0; __pyx_t_8 = __pyx_t_18(__pyx_t_5); if (unlikely(!__pyx_t_8)) goto __pyx_L37_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      index = 1; __pyx_t_7 = __pyx_t_18(__pyx_t_5); if (unlikely(!__pyx_t_7)) goto __pyx_L37_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_18(__pyx_t_5), 2) < (0)) __PYX_ERR(0, 271, __pyx_L1_error)
      __pyx_t_18 = NULL;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L38_unpacking_done;
      __pyx_L37_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_18 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 271, __pyx_L1_error)
      __pyx_L38_unpacking_done:;
    }
    __pyx_v_iv = __pyx_t_8;
    __pyx_t_8 = 0;
    __pyx_v_data = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pkcs11/_pkcs11.pyx":272
 *                     <CK_AES_CBC_ENCRYPT_DATA_PARAMS *> PyMem_Malloc(paramlen)
 *             (iv, data) = param
 *             aes_cbc_params.iv = iv[:16]             # <<<<<<<<<<<<<<
 *             aes_cbc_params.pData = <CK_BYTE *> data
 *             aes_cbc_params.length = <CK_ULONG> len(data)
*/
    __pyx_t_7 = __Pyx_PyObject_GetSlice(__pyx_v_iv, 0, 16, NULL, NULL, &__pyx_mstate_global->__pyx_slice[1], 0, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 272, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (unlikely((__Pyx_carray_from_py_CK_BYTE(__pyx_t_7, __pyx_t_28, 16) < 0))) __PYX_ERR(0, 272, __pyx_L1_error)
    memcpy(&(__pyx_v_aes_cbc_params->iv[0]), __pyx_t_28, sizeof(__pyx_v_aes_cbc_params->iv[0]) * (16));
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "pkcs11/_pkcs11.pyx":273
 *             (iv, data) = param
 *             aes_cbc_params.iv = iv[:16]
 *             aes_cbc_params.pData = <CK_BYTE *> data             # <<<<<<<<<<<<<<
 *             aes_cbc_params.length = <CK_ULONG> len(data)
 * 
*/
    __pyx_t_15 = __Pyx_PyObject_AsWritableUString(__pyx_v_data); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) __PYX_ERR(0, 273, __pyx_L1_error)
    __pyx_v_aes_cbc_params->pData = ((CK_BYTE *)__pyx_t_15);

    /* "pkcs11/_pkcs11.pyx":274
 *             aes_cbc_params.iv = iv[:16]
 *             aes_cbc_params.pData = <CK_BYTE *> data
 *             aes_cbc_params.length = <CK_ULONG> len(data)             # <<<<<<<<<<<<<<
 * 
 *         elif mechanism == Mechanism.AES_GCM:
*/
    __pyx_t_16 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_16 == ((Py_ssize_t)-1))) __PYX_ERR(0, 274, __pyx_L1_error)
    __pyx_v_aes_cbc_params->length = ((CK_ULONG)__pyx_t_16);

    /* "pkcs11/_pkcs11.pyx":267
 *             ecdh1_params.ulPublicDataLen = <CK_ULONG> len(public_data)
 * 
 *         elif mechanism == Mechanism.AES_CBC_ENCRYPT_DATA:             # <<<<<<<<<<<<<<
 *             paramlen = sizeof(CK_AES_CBC_ENCRYPT_DATA_PARAMS)
 *             self.param = aes_cbc_params = \
*/
    goto __pyx_L13;
  }

  /* "pkcs11/_pkcs11.pyx":276
 *             aes_cbc_params.length = <CK_ULONG> len(data)
 * 
 *         elif mechanism == Mechanism.AES_GCM:             # <<<<<<<<<<<<<<
 *             paramlen = sizeof(CK_GCM_PARAMS)
 *             if not isinstance(param, GCMParams):
*/
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Mechanism); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_AES_GCM); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyObject_RichCompare(__pyx_v_mechanism, __pyx_t_8, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 276, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 276, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_13) {

    /* "pkcs11/_pkcs11.pyx":277
 * 
 *         elif mechanism == Mechanism.AES_GCM:
 *             paramlen = sizeof(CK_GCM_PARAMS)             # <<<<<<<<<<<<<<
 *             if not isinstance(param, GCMParams):
 *                 raise TypeError
*/
    __pyx_v_paramlen = (sizeof(CK_GCM_PARAMS));

    /* "pkcs11/_pkcs11.pyx":278
 *         elif mechanism == Mechanism.AES_GCM:
 *             paramlen = sizeof(CK_GCM_PARAMS)
 *             if not isinstance(param, GCMParams):             # <<<<<<<<<<<<<<
 *                 raise TypeError
 *             self.param = gcm_params = <CK_GCM_PARAMS *> PyMem_Malloc(paramlen)
*/
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_GCMParams); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 278, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_13 = PyObject_IsInstance(__pyx_v_param, __pyx_t_7); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 278, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_1 = (!__pyx_t_13);
    if (unlikely(__pyx_t_1)) {

      /* "pkcs11/_pkcs11.pyx":279
 *             paramlen = sizeof(CK_GCM_PARAMS)
 *             if not isinstance(param, GCMParams):
 *                 raise TypeError             # <<<<<<<<<<<<<<
 *             self.param = gcm_params = <CK_GCM_PARAMS *> PyMem_Malloc(paramlen)
 *             gcm_params.pIv = <CK_BYTE *> param.nonce
*/
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), 0, 0, 0);
      __PYX_ERR(0, 279, __pyx_L1_error)

      /* "pkcs11/_pkcs11.pyx":278
 *         elif mechanism == Mechanism.AES_GCM:
 *             paramlen = sizeof(CK_GCM_PARAMS)
 *             if not isinstance(param, GCMParams):             # <<<<<<<<<<<<<<
 *                 raise TypeError
 *             self.param = gcm_params = <CK_GCM_PARAMS *> PyMem_Malloc(paramlen)
*/
    }

    /* "pkcs11/_pkcs11.pyx":280
 *             if not isinstance(param, GCMParams):
 *                 raise TypeError
 *             self.param = gcm_params = <CK_GCM_PARAMS *> PyMem_Malloc(paramlen)             # <<<<<<<<<<<<<<
 *             gcm_params.pIv = <CK_BYTE *> param.nonce
 *             gcm_params.ulIvLen = <CK_ULONG> len(param.nonce)
*/
    __pyx_t_29 = ((CK_GCM_PARAMS *)PyMem_Malloc(__pyx_v_paramlen));
    __pyx_v_self->param = __pyx_t_29;
    __pyx_v_gcm_params = __pyx_t_29;

    /* "pkcs11/_pkcs11.pyx":281
 *                 raise TypeError
 *             self.param = gcm_params = <CK_GCM_PARAMS *> PyMem_Malloc(paramlen)
 *             gcm_params.pIv = <CK_BYTE *> param.nonce             # <<<<<<<<<<<<<<
 *             gcm_params.ulIvLen = <CK_ULONG> len(param.nonce)
 *             gcm_params.ulIvBits = <CK_ULONG> len(param.nonce) * 8
*/
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_param, __pyx_mstate_global->__pyx_n_u_nonce); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 281, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_15 = __Pyx_PyObject_AsWritableUString(__pyx_t_7); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) __PYX_ERR(0, 281, __pyx_L1_error)
    __pyx_v_gcm_params->pIv = ((CK_BYTE *)__pyx_t_15);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "pkcs11/_pkcs11.pyx":282
 *             self.param = gcm_params = <CK_GCM_PARAMS *> PyMem_Malloc(paramlen)
 *             gcm_params.pIv = <CK_BYTE *> param.nonce
 *             gcm_params.ulIvLen = <CK_ULONG> len(param.nonce)             # <<<<<<<<<<<<<<
 *             gcm_params.ulIvBits = <CK_ULONG> len(param.nonce) * 8
 *             if param.aad is not None:
*/
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_param, __pyx_mstate_global->__pyx_n_u_nonce); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_16 = PyObject_Length(__pyx_t_7); if (unlikely(__pyx_t_16 == ((Py_ssize_t)-1))) __PYX_ERR(0, 282, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_gcm_params->ulIvLen = ((CK_ULONG)__pyx_t_16);

    /* "pkcs11/_pkcs11.pyx":283
 *             gcm_params.pIv = <CK_BYTE *> param.nonce
 *             gcm_params.ulIvLen = <CK_ULONG> len(param.nonce)
 *             gcm_params.ulIvBits = <CK_ULONG> len(param.nonce) * 8             # <<<<<<<<<<<<<<
 *             if param.aad is not None:
 *                 gcm_params.pAAD = <CK_BYTE *> param.aad
*/
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_param, __pyx_mstate_global->__pyx_n_u_nonce); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 283, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_16 = PyObject_Length(__pyx_t_7); if (unlikely(__pyx_t_16 == ((Py_ssize_t)-1))) __PYX_ERR(0, 283, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_gcm_params->ulIvBits = (((CK_ULONG)__pyx_t_16) * 8);

    /* "pkcs11/_pkcs11.pyx":284
 *             gcm_params.ulIvLen = <CK_ULONG> len(param.nonce)
 *             gcm_params.ulIvBits = <CK_ULONG> len(param.nonce) * 8
 *             if param.aad is not None:             # <<<<<<<<<<<<<<
 *                 gcm_params.pAAD = <CK_BYTE *> param.aad
 *                 gcm_params.ulAADLen = <CK_ULONG> len(param.aad)
*/
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_param, __pyx_mstate_global->__pyx_n_u_aad); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = (__pyx_t_7 != Py_None);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_1) {

      /* "pkcs11/_pkcs11.pyx":285
 *             gcm_params.ulIvBits = <CK_ULONG> len(param.nonce) * 8
 *             if param.aad is not None:
 *                 gcm_params.pAAD = <CK_BYTE *> param.aad             # <<<<<<<<<<<<<<
 *                 gcm_params.ulAADLen = <CK_ULONG> len(param.aad)
 *             else:
*/
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_param, __pyx_mstate_global->__pyx_n_u_aad); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 285, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_15 = __Pyx_PyObject_AsWritableUString(__pyx_t_7); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) __PYX_ERR(0, 285, __pyx_L1_error)
      __pyx_v_gcm_params->pAAD = ((CK_BYTE *)__pyx_t_15);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "pkcs11/_pkcs11.pyx":286
 *             if param.aad is not None:
 *                 gcm_params.pAAD = <CK_BYTE *> param.aad
 *                 gcm_params.ulAADLen = <CK_ULONG> len(param.aad)             # <<<<<<<<<<<<<<
 *             else:
 *                 gcm_params.pAAD = NULL
*/
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_param, __pyx_mstate_global->__pyx_n_u_aad); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 286, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_16 = PyObject_Length(__pyx_t_7); if (unlikely(__pyx_t_16 == ((Py_ssize_t)-1))) __PYX_ERR(0, 286, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_gcm_params->ulAADLen = ((CK_ULONG)__pyx_t_16);

      /* "pkcs11/_pkcs11.pyx":284
 *             gcm_params.ulIvLen = <CK_ULONG> len(param.nonce)
 *             gcm_params.ulIvBits = <CK_ULONG> len(param.nonce) * 8
 *             if param.aad is not None:             # <<<<<<<<<<<<<<
 *                 gcm_params.pAAD = <CK_BYTE *> param.aad
 *                 gcm_params.ulAADLen = <CK_ULONG> len(param.aad)
*/
      goto __pyx_L40;
    }

    /* "pkcs11/_pkcs11.pyx":288
 *                 gcm_params.ulAADLen = <CK_ULONG> len(param.aad)
 *             else:
 *                 gcm_params.pAAD = NULL             # <<<<<<<<<<<<<<
 *                 gcm_params.ulAADLen = 0
 *             gcm_params.ulTagBits = <CK_ULONG> param.tag_bits
*/
    /*else*/ {
      __pyx_v_gcm_params->pAAD = NULL;

      /* "pkcs11/_pkcs11.pyx":289
 *             else:
 *                 gcm_params.pAAD = NULL
 *                 gcm_params.ulAADLen = 0             # <<<<<<<<<<<<<<
 *             gcm_params.ulTagBits = <CK_ULONG> param.tag_bits
 * 
*/
      __pyx_v_gcm_params->ulAADLen = 0;
    }
    __pyx_L40:;

    /* "pkcs11/_pkcs11.pyx":290
 *                 gcm_params.pAAD = NULL
 *                 gcm_params.ulAADLen = 0
 *             gcm_params.ulTagBits = <CK_ULONG> param.tag_bits             # <<<<<<<<<<<<<<
 * 
 *         elif mechanism == Mechanism.AES_CTR:
*/
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_param, __pyx_mstate_global->__pyx_n_u_tag_bits); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 290, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_22 = __Pyx_PyLong_As_CK_ULONG(__pyx_t_7); if (unlikely((__pyx_t_22 == ((CK_ULONG)-1)) && PyErr_Occurred())) __PYX_ERR(0, 290, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_gcm_params->ulTagBits = ((CK_ULONG)__pyx_t_22);

    /* "pkcs11/_pkcs11.pyx":276
 *             aes_cbc_params.length = <CK_ULONG> len(data)
 * 
 *         elif mechanism == Mechanism.AES_GCM:             # <<<<<<<<<<<<<<
 *             paramlen = sizeof(CK_GCM_PARAMS)
 *             if not isinstance(param, GCMParams):
*/
    goto __pyx_L13;
  }

  /* "pkcs11/_pkcs11.pyx":292
 *             gcm_params.ulTagBits = <CK_ULONG> param.tag_bits
 * 
 *         elif mechanism == Mechanism.AES_CTR:             # <<<<<<<<<<<<<<
 *             paramlen = sizeof(CK_AES_CTR_PARAMS)
 *             self.param = aes_ctr_params = <CK_AES_CTR_PARAMS *> PyMem_Malloc(paramlen)
*/
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Mechanism); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_AES_CTR); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyObject_RichCompare(__pyx_v_mechanism, __pyx_t_8, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 292, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 292, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_1) {

    /* "pkcs11/_pkcs11.pyx":293
 * 
 *         elif mechanism == Mechanism.AES_CTR:
 *             paramlen = sizeof(CK_AES_CTR_PARAMS)             # <<<<<<<<<<<<<<
 *             self.param = aes_ctr_params = <CK_AES_CTR_PARAMS *> PyMem_Malloc(paramlen)
 *             # use a wrapper type to not break the forwards compat rule for params specified as `bytes`
*/
    __pyx_v_paramlen = (sizeof(CK_AES_CTR_PARAMS));

    /* "pkcs11/_pkcs11.pyx":294
 *         elif mechanism == Mechanism.AES_CTR:
 *             paramlen = sizeof(CK_AES_CTR_PARAMS)
 *             self.param = aes_ctr_params = <CK_AES_CTR_PARAMS *> PyMem_Malloc(paramlen)             # <<<<<<<<<<<<<<
 *             # use a wrapper type to not break the forwards compat rule for params specified as `bytes`
 *             if not isinstance(param, CTRParams):
*/
    __pyx_t_30 = ((CK_AES_CTR_PARAMS *)PyMem_Malloc(__pyx_v_paramlen));
    __pyx_v_self->param = __pyx_t_30;
    __pyx_v_aes_ctr_params = __pyx_t_30;

    /* "pkcs11/_pkcs11.pyx":296
 *             self.param = aes_ctr_params = <CK_AES_CTR_PARAMS *> PyMem_Malloc(paramlen)
 *             # use a wrapper type to not break the forwards compat rule for params specified as `bytes`
 *             if not isinstance(param, CTRParams):             # <<<<<<<<<<<<<<
 *                 raise TypeError
 *             aes_ctr_params.ulCounterBits = (16 - len(param.nonce)) * 8
*/
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_CTRParams); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 296, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = PyObject_IsInstance(__pyx_v_param, __pyx_t_7); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 296, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_13 = (!__pyx_t_1);
    if (unlikely(__pyx_t_13)) {

      /* "pkcs11/_pkcs11.pyx":297
 *             # use a wrapper type to not break the forwards compat rule for params specified as `bytes`
 *             if not isinstance(param, CTRParams):
 *                 raise TypeError             # <<<<<<<<<<<<<<
 *             aes_ctr_params.ulCounterBits = (16 - len(param.nonce)) * 8
 *             aes_ctr_params.cb = param.nonce + b"\x00" * (15 - len(param.nonce)) + b"\x01"
*/
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), 0, 0, 0);
      __PYX_ERR(0, 297, __pyx_L1_error)

      /* "pkcs11/_pkcs11.pyx":296
 *             self.param = aes_ctr_params = <CK_AES_CTR_PARAMS *> PyMem_Malloc(paramlen)
 *             # use a wrapper type to not break the forwards compat rule for params specified as `bytes`
 *             if not isinstance(param, CTRParams):             # <<<<<<<<<<<<<<
 *                 raise TypeError
 *             aes_ctr_params.ulCounterBits = (16 - len(param.nonce)) * 8
*/
    }

    /* "pkcs11/_pkcs11.pyx":298
 *             if not isinstance(param, CTRParams):
 *                 raise TypeError
 *             aes_ctr_params.ulCounterBits = (16 - len(param.nonce)) * 8             # <<<<<<<<<<<<<<
 *             aes_ctr_params.cb = param.nonce + b"\x00" * (15 - len(param.nonce)) + b"\x01"
 * 
*/
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_param, __pyx_mstate_global->__pyx_n_u_nonce); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 298, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_16 = PyObject_Length(__pyx_t_7); if (unlikely(__pyx_t_16 == ((Py_ssize_t)-1))) __PYX_ERR(0, 298, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_aes_ctr_params->ulCounterBits = ((16 - __pyx_t_16) * 8);

    /* "pkcs11/_pkcs11.pyx":299
 *                 raise TypeError
 *             aes_ctr_params.ulCounterBits = (16 - len(param.nonce)) * 8
 *             aes_ctr_params.cb = param.nonce + b"\x00" * (15 - len(param.nonce)) + b"\x01"             # <<<<<<<<<<<<<<
 * 
 *         elif param is None:
*/
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_param, __pyx_mstate_global->__pyx_n_u_nonce); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 299, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_param, __pyx_mstate_global->__pyx_n_u_nonce); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 299, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_16 = PyObject_Length(__pyx_t_8); if (unlikely(__pyx_t_16 == ((Py_ssize_t)-1))) __PYX_ERR(0, 299, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PySequence_Multiply(__pyx_mstate_global->__pyx_kp_b__6, (15 - __pyx_t_16)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 299, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_5 = PyNumber_Add(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 299, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyNumber_Add(__pyx_t_5, __pyx_mstate_global->__pyx_kp_b__7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 299, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely((__Pyx_carray_from_py_CK_BYTE(__pyx_t_8, __pyx_t_28, 16) < 0))) __PYX_ERR(0, 299, __pyx_L1_error)
    memcpy(&(__pyx_v_aes_ctr_params->cb[0]), __pyx_t_28, sizeof(__pyx_v_aes_ctr_params->cb[0]) * (16));
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "pkcs11/_pkcs11.pyx":292
 *             gcm_params.ulTagBits = <CK_ULONG> param.tag_bits
 * 
 *         elif mechanism == Mechanism.AES_CTR:             # <<<<<<<<<<<<<<
 *             paramlen = sizeof(CK_AES_CTR_PARAMS)
 *             self.param = aes_ctr_params = <CK_AES_CTR_PARAMS *> PyMem_Malloc(paramlen)
*/
    goto __pyx_L13;
  }

  /* "pkcs11/_pkcs11.pyx":301
 *             aes_ctr_params.cb = param.nonce + b"\x00" * (15 - len(param.nonce)) + b"\x01"
 * 
 *         elif param is None:             # <<<<<<<<<<<<<<
 *             self.data.pParameter = NULL
 *             paramlen = 0
*/
  __pyx_t_13 = (__pyx_v_param == Py_None);
  if (likely(__pyx_t_13)) {

    /* "pkcs11/_pkcs11.pyx":302
 * 
 *         elif param is None:
 *             self.data.pParameter = NULL             # <<<<<<<<<<<<<<
 *             paramlen = 0
 * 
*/
    __pyx_v_self->data->pParameter = NULL;

    /* "pkcs11/_pkcs11.pyx":303
 *         elif param is None:
 *             self.data.pParameter = NULL
 *             paramlen = 0             # <<<<<<<<<<<<<<
 * 
 *         else:
*/
    __pyx_v_paramlen = 0;

    /* "pkcs11/_pkcs11.pyx":301
 *             aes_ctr_params.cb = param.nonce + b"\x00" * (15 - len(param.nonce)) + b"\x01"
 * 
 *         elif param is None:             # <<<<<<<<<<<<<<
 *             self.data.pParameter = NULL
 *             paramlen = 0
*/
    goto __pyx_L13;
  }

  /* "pkcs11/_pkcs11.pyx":306
 * 
 *         else:
 *             raise ArgumentsBad("Unexpected argument to mechanism_param")             # <<<<<<<<<<<<<<
 * 
 *         self.data.mechanism = mechanism
*/
  /*else*/ {
    __pyx_t_5 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_ArgumentsBad); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 306, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_12 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
      assert(__pyx_t_5);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
      __pyx_t_12 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Unexpected_argument_to_mechanism};
      __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 306, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
    }
    __Pyx_Raise(__pyx_t_8, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __PYX_ERR(0, 306, __pyx_L1_error)
  }
  __pyx_L13:;

  /* "pkcs11/_pkcs11.pyx":308
 *             raise ArgumentsBad("Unexpected argument to mechanism_param")
 * 
 *         self.data.mechanism = mechanism             # <<<<<<<<<<<<<<
 *         self.data.ulParameterLen = <CK_ULONG> paramlen
 * 
*/
  __pyx_t_19 = __Pyx_PyLong_As_CK_ULONG(__pyx_v_mechanism); if (unlikely((__pyx_t_19 == ((CK_MECHANISM_TYPE)-1)) && PyErr_Occurred())) __PYX_ERR(0, 308, __pyx_L1_error)
  __pyx_v_self->data->mechanism = __pyx_t_19;

  /* "pkcs11/_pkcs11.pyx":309
 * 
 *         self.data.mechanism = mechanism
 *         self.data.ulParameterLen = <CK_ULONG> paramlen             # <<<<<<<<<<<<<<
 * 
 *         if self.param != NULL:
*/
  __pyx_v_self->data->ulParameterLen = ((CK_ULONG)__pyx_v_paramlen);

  /* "pkcs11/_pkcs11.pyx":311
 *         self.data.ulParameterLen = <CK_ULONG> paramlen
 * 
 *         if self.param != NULL:             # <<<<<<<<<<<<<<
 *             self.data.pParameter = self.param
 * 
*/
  __pyx_t_13 = (__pyx_v_self->param != NULL);
  if (__pyx_t_13) {

    /* "pkcs11/_pkcs11.pyx":312
 * 
 *         if self.param != NULL:
 *             self.data.pParameter = self.param             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
    __pyx_t_31 = __pyx_v_self->param;
    __pyx_v_self->data->pParameter = __pyx_t_31;

    /* "pkcs11/_pkcs11.pyx":311
 *         self.data.ulParameterLen = <CK_ULONG> paramlen
 * 
 *         if self.param != NULL:             # <<<<<<<<<<<<<<
 *             self.data.pParameter = self.param
 * 
*/
  }

  /* "pkcs11/_pkcs11.pyx":156
 *         self._python_param = None
 * 
 *     def __init__(self, key_type, mapping, mechanism=None, param=None):             # <<<<<<<<<<<<<<
 *         self._python_param = param
 *         if mechanism is None:
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("pkcs11._pkcs11.MechanismWithParam.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_source_data);
  __Pyx_XDECREF(__pyx_v_context_data);
  __Pyx_XDECREF(__pyx_v_shared_data);
  __Pyx_XDECREF(__pyx_v_public_data);
  __Pyx_XDECREF(__pyx_v_iv);
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_XDECREF(__pyx_v_mechanism);
  __Pyx_XDECREF(__pyx_v_param);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":314
 *             self.data.pParameter = self.param
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         PyMem_Free(self.data)
 *         PyMem_Free(self.param)
*/

/* Python wrapper */
static void __pyx_pw_6pkcs11_7_pkcs11_18MechanismWithParam_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_6pkcs11_7_pkcs11_18MechanismWithParam_5__dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_6pkcs11_7_pkcs11_18MechanismWithParam_4__dealloc__(((struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *)__pyx_v_self));

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

static void __pyx_pf_6pkcs11_7_pkcs11_18MechanismWithParam_4__dealloc__(struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_self) {

  /* "pkcs11/_pkcs11.pyx":315
 * 
 *     def __dealloc__(self):
 *         PyMem_Free(self.data)             # <<<<<<<<<<<<<<
 *         PyMem_Free(self.param)
 * 
*/
  PyMem_Free(__pyx_v_self->data);

  /* "pkcs11/_pkcs11.pyx":316
 *     def __dealloc__(self):
 *         PyMem_Free(self.data)
 *         PyMem_Free(self.param)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  PyMem_Free(__pyx_v_self->param);

  /* "pkcs11/_pkcs11.pyx":314
 *             self.data.pParameter = self.param
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         PyMem_Free(self.data)
 *         PyMem_Free(self.param)
*/

  /* function exit code */
}

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

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_18MechanismWithParam_7__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_18MechanismWithParam_7__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_18MechanismWithParam_7__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_18MechanismWithParam_7__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_18MechanismWithParam_6__reduce_cython__(((struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_18MechanismWithParam_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 2, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.MechanismWithParam.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_18MechanismWithParam_9__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_18MechanismWithParam_9__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_18MechanismWithParam_9__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_18MechanismWithParam_9__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.MechanismWithParam.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_18MechanismWithParam_8__setstate_cython__(((struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *)__pyx_v_self), __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_18MechanismWithParam_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 4, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.MechanismWithParam.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":330
 *     cdef CK_VERSION _cryptoki_version
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef Slot make(CK_FUNCTION_LIST *funclist, CK_SLOT_ID slot_id, CK_SLOT_INFO info, CK_VERSION cryptoki_version):
 *         description = info.slotDescription[:sizeof(info.slotDescription)]
*/

static struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_f_6pkcs11_7_pkcs11_4Slot_make(struct CK_FUNCTION_LIST *__pyx_v_funclist, CK_SLOT_ID __pyx_v_slot_id, CK_SLOT_INFO __pyx_v_info, CK_VERSION __pyx_v_cryptoki_version) {
  PyObject *__pyx_v_description = NULL;
  PyObject *__pyx_v_manufacturer_id = NULL;
  struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_slot = 0;
  struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  CK_VERSION __pyx_t_5;
  CK_FLAGS __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("make", 0);

  /* "pkcs11/_pkcs11.pyx":332
 *     @staticmethod
 *     cdef Slot make(CK_FUNCTION_LIST *funclist, CK_SLOT_ID slot_id, CK_SLOT_INFO info, CK_VERSION cryptoki_version):
 *         description = info.slotDescription[:sizeof(info.slotDescription)]             # <<<<<<<<<<<<<<
 *         manufacturer_id = info.manufacturerID[:sizeof(info.manufacturerID)]
 * 
*/
  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(((char const *)__pyx_v_info.slotDescription) + 0, (sizeof(__pyx_v_info.slotDescription)) - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 332, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_description = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":333
 *     cdef Slot make(CK_FUNCTION_LIST *funclist, CK_SLOT_ID slot_id, CK_SLOT_INFO info, CK_VERSION cryptoki_version):
 *         description = info.slotDescription[:sizeof(info.slotDescription)]
 *         manufacturer_id = info.manufacturerID[:sizeof(info.manufacturerID)]             # <<<<<<<<<<<<<<
 * 
 *         cdef Slot slot = Slot.__new__(Slot)
*/
  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(((char const *)__pyx_v_info.manufacturerID) + 0, (sizeof(__pyx_v_info.manufacturerID)) - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_manufacturer_id = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":335
 *         manufacturer_id = info.manufacturerID[:sizeof(info.manufacturerID)]
 * 
 *         cdef Slot slot = Slot.__new__(Slot)             # <<<<<<<<<<<<<<
 *         slot.funclist = funclist
 * 
*/
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_6pkcs11_7_pkcs11_Slot(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Slot), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 335, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_1);
  __pyx_v_slot = ((struct __pyx_obj_6pkcs11_7_pkcs11_Slot *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":336
 * 
 *         cdef Slot slot = Slot.__new__(Slot)
 *         slot.funclist = funclist             # <<<<<<<<<<<<<<
 * 
 *         slot.slot_id = slot_id
*/
  __pyx_v_slot->__pyx_base.funclist = __pyx_v_funclist;

  /* "pkcs11/_pkcs11.pyx":338
 *         slot.funclist = funclist
 * 
 *         slot.slot_id = slot_id             # <<<<<<<<<<<<<<
 *         slot.slot_description = _CK_UTF8CHAR_to_str(description)
 *         slot.manufacturer_id = _CK_UTF8CHAR_to_str(manufacturer_id)
*/
  __pyx_v_slot->slot_id = __pyx_v_slot_id;

  /* "pkcs11/_pkcs11.pyx":339
 * 
 *         slot.slot_id = slot_id
 *         slot.slot_description = _CK_UTF8CHAR_to_str(description)             # <<<<<<<<<<<<<<
 *         slot.manufacturer_id = _CK_UTF8CHAR_to_str(manufacturer_id)
 *         slot._hw_version = info.hardwareVersion
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_CK_UTF8CHAR_to_str); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 339, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_description};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 339, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_1))) __PYX_ERR(0, 339, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_slot->slot_description);
  __Pyx_DECREF(__pyx_v_slot->slot_description);
  __pyx_v_slot->slot_description = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":340
 *         slot.slot_id = slot_id
 *         slot.slot_description = _CK_UTF8CHAR_to_str(description)
 *         slot.manufacturer_id = _CK_UTF8CHAR_to_str(manufacturer_id)             # <<<<<<<<<<<<<<
 *         slot._hw_version = info.hardwareVersion
 *         slot._fw_version = info.firmwareVersion
*/
  __pyx_t_3 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_CK_UTF8CHAR_to_str); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 340, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    assert(__pyx_t_3);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_manufacturer_id};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 340, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_1))) __PYX_ERR(0, 340, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_slot->manufacturer_id);
  __Pyx_DECREF(__pyx_v_slot->manufacturer_id);
  __pyx_v_slot->manufacturer_id = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":341
 *         slot.slot_description = _CK_UTF8CHAR_to_str(description)
 *         slot.manufacturer_id = _CK_UTF8CHAR_to_str(manufacturer_id)
 *         slot._hw_version = info.hardwareVersion             # <<<<<<<<<<<<<<
 *         slot._fw_version = info.firmwareVersion
 *         slot._cryptoki_version = cryptoki_version
*/
  __pyx_t_5 = __pyx_v_info.hardwareVersion;
  __pyx_v_slot->_hw_version = __pyx_t_5;

  /* "pkcs11/_pkcs11.pyx":342
 *         slot.manufacturer_id = _CK_UTF8CHAR_to_str(manufacturer_id)
 *         slot._hw_version = info.hardwareVersion
 *         slot._fw_version = info.firmwareVersion             # <<<<<<<<<<<<<<
 *         slot._cryptoki_version = cryptoki_version
 *         slot.slot_flags = info.flags
*/
  __pyx_t_5 = __pyx_v_info.firmwareVersion;
  __pyx_v_slot->_fw_version = __pyx_t_5;

  /* "pkcs11/_pkcs11.pyx":343
 *         slot._hw_version = info.hardwareVersion
 *         slot._fw_version = info.firmwareVersion
 *         slot._cryptoki_version = cryptoki_version             # <<<<<<<<<<<<<<
 *         slot.slot_flags = info.flags
 *         return slot
*/
  __pyx_v_slot->_cryptoki_version = __pyx_v_cryptoki_version;

  /* "pkcs11/_pkcs11.pyx":344
 *         slot._fw_version = info.firmwareVersion
 *         slot._cryptoki_version = cryptoki_version
 *         slot.slot_flags = info.flags             # <<<<<<<<<<<<<<
 *         return slot
 * 
*/
  __pyx_t_6 = __pyx_v_info.flags;
  __pyx_v_slot->slot_flags = __pyx_t_6;

  /* "pkcs11/_pkcs11.pyx":345
 *         slot._cryptoki_version = cryptoki_version
 *         slot.slot_flags = info.flags
 *         return slot             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self):
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_slot);
  __pyx_r = __pyx_v_slot;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":330
 *     cdef CK_VERSION _cryptoki_version
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef Slot make(CK_FUNCTION_LIST *funclist, CK_SLOT_ID slot_id, CK_SLOT_INFO info, CK_VERSION cryptoki_version):
 *         description = info.slotDescription[:sizeof(info.slotDescription)]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pkcs11._pkcs11.Slot.make", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_description);
  __Pyx_XDECREF(__pyx_v_manufacturer_id);
  __Pyx_XDECREF((PyObject *)__pyx_v_slot);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":347
 *         return slot
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         raise TypeError
 * 
*/

/* Python wrapper */
static int __pyx_pw_6pkcs11_7_pkcs11_4Slot_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6pkcs11_7_pkcs11_4Slot_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, __pyx_nargs); return -1; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__init__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_4Slot___init__(((struct __pyx_obj_6pkcs11_7_pkcs11_Slot *)__pyx_v_self));

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

static int __pyx_pf_6pkcs11_7_pkcs11_4Slot___init__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_self) {
  int __pyx_r;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "pkcs11/_pkcs11.pyx":348
 * 
 *     def __init__(self):
 *         raise TypeError             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), 0, 0, 0);
  __PYX_ERR(0, 348, __pyx_L1_error)

  /* "pkcs11/_pkcs11.pyx":347
 *         return slot
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         raise TypeError
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.Slot.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":350
 *         raise TypeError
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def flags(self):
 *         """Capabilities of this slot (:class:`SlotFlag`)."""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_4Slot_5flags_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_4Slot_5flags_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_4Slot_5flags___get__(((struct __pyx_obj_6pkcs11_7_pkcs11_Slot *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_4Slot_5flags___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "pkcs11/_pkcs11.pyx":353
 *     def flags(self):
 *         """Capabilities of this slot (:class:`SlotFlag`)."""
 *         return SlotFlag(self.slot_flags)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_SlotFlag); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 353, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyLong_From_CK_ULONG(__pyx_v_self->slot_flags); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 353, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 353, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":350
 *         raise TypeError
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def flags(self):
 *         """Capabilities of this slot (:class:`SlotFlag`)."""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pkcs11._pkcs11.Slot.flags.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":355
 *         return SlotFlag(self.slot_flags)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def hardware_version(self):
 *         """Hardware version (:class:`tuple`)."""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_4Slot_16hardware_version_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_4Slot_16hardware_version_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_4Slot_16hardware_version___get__(((struct __pyx_obj_6pkcs11_7_pkcs11_Slot *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_4Slot_16hardware_version___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "pkcs11/_pkcs11.pyx":358
 *     def hardware_version(self):
 *         """Hardware version (:class:`tuple`)."""
 *         return _CK_VERSION_to_tuple(self._hw_version)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_CK_VERSION_to_tuple); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 358, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_convert__to_py_CK_VERSION(__pyx_v_self->_hw_version); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 358, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 358, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":355
 *         return SlotFlag(self.slot_flags)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def hardware_version(self):
 *         """Hardware version (:class:`tuple`)."""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pkcs11._pkcs11.Slot.hardware_version.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":360
 *         return _CK_VERSION_to_tuple(self._hw_version)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def firmware_version(self):
 *         """Firmware version (:class:`tuple`)."""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_4Slot_16firmware_version_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_4Slot_16firmware_version_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_4Slot_16firmware_version___get__(((struct __pyx_obj_6pkcs11_7_pkcs11_Slot *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_4Slot_16firmware_version___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "pkcs11/_pkcs11.pyx":363
 *     def firmware_version(self):
 *         """Firmware version (:class:`tuple`)."""
 *         return _CK_VERSION_to_tuple(self._fw_version)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_CK_VERSION_to_tuple); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_convert__to_py_CK_VERSION(__pyx_v_self->_fw_version); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 363, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":360
 *         return _CK_VERSION_to_tuple(self._hw_version)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def firmware_version(self):
 *         """Firmware version (:class:`tuple`)."""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pkcs11._pkcs11.Slot.firmware_version.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":365
 *         return _CK_VERSION_to_tuple(self._fw_version)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def cryptoki_version(self):
 *         """PKCS#11 (cryptoki) API version (:class:`tuple`)."""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_4Slot_16cryptoki_version_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_4Slot_16cryptoki_version_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_4Slot_16cryptoki_version___get__(((struct __pyx_obj_6pkcs11_7_pkcs11_Slot *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_4Slot_16cryptoki_version___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "pkcs11/_pkcs11.pyx":368
 *     def cryptoki_version(self):
 *         """PKCS#11 (cryptoki) API version (:class:`tuple`)."""
 *         return _CK_VERSION_to_tuple(self._cryptoki_version)             # <<<<<<<<<<<<<<
 * 
 *     def get_token(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_CK_VERSION_to_tuple); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 368, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_convert__to_py_CK_VERSION(__pyx_v_self->_cryptoki_version); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 368, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 368, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":365
 *         return _CK_VERSION_to_tuple(self._fw_version)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def cryptoki_version(self):
 *         """PKCS#11 (cryptoki) API version (:class:`tuple`)."""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pkcs11._pkcs11.Slot.cryptoki_version.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":370
 *         return _CK_VERSION_to_tuple(self._cryptoki_version)
 * 
 *     def get_token(self):             # <<<<<<<<<<<<<<
 *         cdef CK_SLOT_ID slot_id = self.slot_id
 *         cdef CK_TOKEN_INFO info
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_4Slot_3get_token(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_4Slot_3get_token = {"get_token", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_4Slot_3get_token, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_4Slot_3get_token(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_token (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("get_token", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("get_token", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_4Slot_2get_token(((struct __pyx_obj_6pkcs11_7_pkcs11_Slot *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_4Slot_2get_token(struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_self) {
  CK_SLOT_ID __pyx_v_slot_id;
  CK_TOKEN_INFO __pyx_v_info;
  CK_RV __pyx_v_retval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  CK_SLOT_ID __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_token", 0);

  /* "pkcs11/_pkcs11.pyx":371
 * 
 *     def get_token(self):
 *         cdef CK_SLOT_ID slot_id = self.slot_id             # <<<<<<<<<<<<<<
 *         cdef CK_TOKEN_INFO info
 *         cdef CK_RV retval
*/
  __pyx_t_1 = __pyx_v_self->slot_id;
  __pyx_v_slot_id = __pyx_t_1;

  /* "pkcs11/_pkcs11.pyx":375
 *         cdef CK_RV retval
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_GetTokenInfo(slot_id, &info)
 *         assertRV(retval)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":376
 * 
 *         with nogil:
 *             retval = self.funclist.C_GetTokenInfo(slot_id, &info)             # <<<<<<<<<<<<<<
 *         assertRV(retval)
 * 
*/
        __pyx_v_retval = __pyx_v_self->__pyx_base.funclist->C_GetTokenInfo(__pyx_v_slot_id, (&__pyx_v_info));
      }

      /* "pkcs11/_pkcs11.pyx":375
 *         cdef CK_RV retval
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_GetTokenInfo(slot_id, &info)
 *         assertRV(retval)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":377
 *         with nogil:
 *             retval = self.funclist.C_GetTokenInfo(slot_id, &info)
 *         assertRV(retval)             # <<<<<<<<<<<<<<
 * 
 *         return Token.make(self, info)
*/
  __pyx_t_2 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pkcs11/_pkcs11.pyx":379
 *         assertRV(retval)
 * 
 *         return Token.make(self, info)             # <<<<<<<<<<<<<<
 * 
 *     def get_mechanisms(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6pkcs11_7_pkcs11_5Token_make(__pyx_v_self, __pyx_v_info)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 379, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":370
 *         return _CK_VERSION_to_tuple(self._cryptoki_version)
 * 
 *     def get_token(self):             # <<<<<<<<<<<<<<
 *         cdef CK_SLOT_ID slot_id = self.slot_id
 *         cdef CK_TOKEN_INFO info
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pkcs11._pkcs11.Slot.get_token", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":381
 *         return Token.make(self, info)
 * 
 *     def get_mechanisms(self):             # <<<<<<<<<<<<<<
 *         cdef CK_SLOT_ID slot_id = self.slot_id
 *         cdef CK_ULONG count
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_4Slot_5get_mechanisms(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_4Slot_5get_mechanisms = {"get_mechanisms", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_4Slot_5get_mechanisms, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_4Slot_5get_mechanisms(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_mechanisms (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("get_mechanisms", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("get_mechanisms", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_4Slot_4get_mechanisms(((struct __pyx_obj_6pkcs11_7_pkcs11_Slot *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_4Slot_4get_mechanisms(struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_self) {
  CK_SLOT_ID __pyx_v_slot_id;
  CK_ULONG __pyx_v_count;
  CK_RV __pyx_v_retval;
  __Pyx_memviewslice __pyx_v_mechanisms = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  CK_SLOT_ID __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  size_t __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_mechanisms", 0);

  /* "pkcs11/_pkcs11.pyx":382
 * 
 *     def get_mechanisms(self):
 *         cdef CK_SLOT_ID slot_id = self.slot_id             # <<<<<<<<<<<<<<
 *         cdef CK_ULONG count
 *         cdef CK_RV retval
*/
  __pyx_t_1 = __pyx_v_self->slot_id;
  __pyx_v_slot_id = __pyx_t_1;

  /* "pkcs11/_pkcs11.pyx":386
 *         cdef CK_RV retval
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_GetMechanismList(slot_id, NULL, &count)
 *         assertRV(retval)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":387
 * 
 *         with nogil:
 *             retval = self.funclist.C_GetMechanismList(slot_id, NULL, &count)             # <<<<<<<<<<<<<<
 *         assertRV(retval)
 * 
*/
        __pyx_v_retval = __pyx_v_self->__pyx_base.funclist->C_GetMechanismList(__pyx_v_slot_id, NULL, (&__pyx_v_count));
      }

      /* "pkcs11/_pkcs11.pyx":386
 *         cdef CK_RV retval
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_GetMechanismList(slot_id, NULL, &count)
 *         assertRV(retval)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":388
 *         with nogil:
 *             retval = self.funclist.C_GetMechanismList(slot_id, NULL, &count)
 *         assertRV(retval)             # <<<<<<<<<<<<<<
 * 
 *         if count == 0:
*/
  __pyx_t_2 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pkcs11/_pkcs11.pyx":390
 *         assertRV(retval)
 * 
 *         if count == 0:             # <<<<<<<<<<<<<<
 *             return set()
 * 
*/
  __pyx_t_4 = (__pyx_v_count == 0);
  if (__pyx_t_4) {

    /* "pkcs11/_pkcs11.pyx":391
 * 
 *         if count == 0:
 *             return set()             # <<<<<<<<<<<<<<
 * 
 *         cdef CK_MECHANISM_TYPE [:] mechanisms = CK_ULONG_buffer(count)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PySet_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 391, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "pkcs11/_pkcs11.pyx":390
 *         assertRV(retval)
 * 
 *         if count == 0:             # <<<<<<<<<<<<<<
 *             return set()
 * 
*/
  }

  /* "pkcs11/_pkcs11.pyx":393
 *             return set()
 * 
 *         cdef CK_MECHANISM_TYPE [:] mechanisms = CK_ULONG_buffer(count)             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
*/
  __pyx_t_3 = __Pyx_PyLong_From_CK_ULONG(__pyx_v_count); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __pyx_f_6pkcs11_7_pkcs11_CK_ULONG_buffer(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn_CK_MECHANISM_TYPE(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 393, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_mechanisms = __pyx_t_5;
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "pkcs11/_pkcs11.pyx":395
 *         cdef CK_MECHANISM_TYPE [:] mechanisms = CK_ULONG_buffer(count)
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_GetMechanismList(slot_id, &mechanisms[0], &count)
 *         assertRV(retval)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":396
 * 
 *         with nogil:
 *             retval = self.funclist.C_GetMechanismList(slot_id, &mechanisms[0], &count)             # <<<<<<<<<<<<<<
 *         assertRV(retval)
 * 
*/
        __pyx_t_6 = 0;
        __pyx_t_7 = -1;
        if (__pyx_t_6 < 0) {
          __pyx_t_6 += __pyx_v_mechanisms.shape[0];
          if (unlikely(__pyx_t_6 < 0)) __pyx_t_7 = 0;
        } else if (unlikely(__pyx_t_6 >= __pyx_v_mechanisms.shape[0])) __pyx_t_7 = 0;
        if (unlikely(__pyx_t_7 != -1)) {
          __Pyx_RaiseBufferIndexErrorNogil(__pyx_t_7);
          __PYX_ERR(0, 396, __pyx_L8_error)
        }
        __pyx_v_retval = __pyx_v_self->__pyx_base.funclist->C_GetMechanismList(__pyx_v_slot_id, (&(*((CK_MECHANISM_TYPE *) ( /* dim=0 */ (__pyx_v_mechanisms.data + __pyx_t_6 * __pyx_v_mechanisms.strides[0]) )))), (&__pyx_v_count));
      }

      /* "pkcs11/_pkcs11.pyx":395
 *         cdef CK_MECHANISM_TYPE [:] mechanisms = CK_ULONG_buffer(count)
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_GetMechanismList(slot_id, &mechanisms[0], &count)
 *         assertRV(retval)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L9;
        }
        __pyx_L8_error: {
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L1_error;
        }
        __pyx_L9:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":397
 *         with nogil:
 *             retval = self.funclist.C_GetMechanismList(slot_id, &mechanisms[0], &count)
 *         assertRV(retval)             # <<<<<<<<<<<<<<
 * 
 *         return set(map(_CK_MECHANISM_TYPE_to_enum, mechanisms))
*/
  __pyx_t_2 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pkcs11/_pkcs11.pyx":399
 *         assertRV(retval)
 * 
 *         return set(map(_CK_MECHANISM_TYPE_to_enum, mechanisms))             # <<<<<<<<<<<<<<
 * 
 *     def get_mechanism_info(self, mechanism):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_CK_MECHANISM_TYPE_to_enum); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = __pyx_memoryview_fromslice(__pyx_v_mechanisms, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn_CK_MECHANISM_TYPE, (int (*)(char *, PyObject *)) __pyx_memview_set_nn_CK_MECHANISM_TYPE, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_8, __pyx_t_9};
    __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_map, __pyx_callargs+__pyx_t_10, (3-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 399, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_t_9 = PySet_New(__pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_9;
  __pyx_t_9 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":381
 *         return Token.make(self, info)
 * 
 *     def get_mechanisms(self):             # <<<<<<<<<<<<<<
 *         cdef CK_SLOT_ID slot_id = self.slot_id
 *         cdef CK_ULONG count
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pkcs11._pkcs11.Slot.get_mechanisms", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_mechanisms, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":401
 *         return set(map(_CK_MECHANISM_TYPE_to_enum, mechanisms))
 * 
 *     def get_mechanism_info(self, mechanism):             # <<<<<<<<<<<<<<
 *         cdef CK_SLOT_ID slot_id = self.slot_id
 *         cdef CK_MECHANISM_TYPE mech_type = mechanism
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_4Slot_7get_mechanism_info(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_4Slot_7get_mechanism_info = {"get_mechanism_info", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_4Slot_7get_mechanism_info, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_4Slot_7get_mechanism_info(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_mechanism = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_mechanism_info (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_mechanism,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 401, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 401, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_mechanism_info", 0) < (0)) __PYX_ERR(0, 401, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_mechanism_info", 1, 1, 1, i); __PYX_ERR(0, 401, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 401, __pyx_L3_error)
    }
    __pyx_v_mechanism = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_mechanism_info", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 401, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.Slot.get_mechanism_info", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_4Slot_6get_mechanism_info(((struct __pyx_obj_6pkcs11_7_pkcs11_Slot *)__pyx_v_self), __pyx_v_mechanism);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_4Slot_6get_mechanism_info(struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_self, PyObject *__pyx_v_mechanism) {
  CK_SLOT_ID __pyx_v_slot_id;
  CK_MECHANISM_TYPE __pyx_v_mech_type;
  CK_MECHANISM_INFO __pyx_v_info;
  CK_RV __pyx_v_retval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  CK_SLOT_ID __pyx_t_1;
  CK_MECHANISM_TYPE __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_mechanism_info", 0);

  /* "pkcs11/_pkcs11.pyx":402
 * 
 *     def get_mechanism_info(self, mechanism):
 *         cdef CK_SLOT_ID slot_id = self.slot_id             # <<<<<<<<<<<<<<
 *         cdef CK_MECHANISM_TYPE mech_type = mechanism
 *         cdef CK_MECHANISM_INFO info
*/
  __pyx_t_1 = __pyx_v_self->slot_id;
  __pyx_v_slot_id = __pyx_t_1;

  /* "pkcs11/_pkcs11.pyx":403
 *     def get_mechanism_info(self, mechanism):
 *         cdef CK_SLOT_ID slot_id = self.slot_id
 *         cdef CK_MECHANISM_TYPE mech_type = mechanism             # <<<<<<<<<<<<<<
 *         cdef CK_MECHANISM_INFO info
 *         cdef CK_RV retval
*/
  __pyx_t_2 = __Pyx_PyLong_As_CK_ULONG(__pyx_v_mechanism); if (unlikely((__pyx_t_2 == ((CK_MECHANISM_TYPE)-1)) && PyErr_Occurred())) __PYX_ERR(0, 403, __pyx_L1_error)
  __pyx_v_mech_type = __pyx_t_2;

  /* "pkcs11/_pkcs11.pyx":407
 *         cdef CK_RV retval
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_GetMechanismInfo(slot_id, mech_type, &info)
 *         assertRV(retval)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":408
 * 
 *         with nogil:
 *             retval = self.funclist.C_GetMechanismInfo(slot_id, mech_type, &info)             # <<<<<<<<<<<<<<
 *         assertRV(retval)
 * 
*/
        __pyx_v_retval = __pyx_v_self->__pyx_base.funclist->C_GetMechanismInfo(__pyx_v_slot_id, __pyx_v_mech_type, (&__pyx_v_info));
      }

      /* "pkcs11/_pkcs11.pyx":407
 *         cdef CK_RV retval
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_GetMechanismInfo(slot_id, mech_type, &info)
 *         assertRV(retval)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":409
 *         with nogil:
 *             retval = self.funclist.C_GetMechanismInfo(slot_id, mech_type, &info)
 *         assertRV(retval)             # <<<<<<<<<<<<<<
 * 
 *         return types.MechanismInfo(self, mechanism, **info)
*/
  __pyx_t_3 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":411
 *         assertRV(retval)
 * 
 *         return types.MechanismInfo(self, mechanism, **info)             # <<<<<<<<<<<<<<
 * 
 *     def _identity(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_types); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_MechanismInfo); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_7 = __pyx_convert__to_py_CK_MECHANISM_INFO(__pyx_v_info); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (likely(PyDict_CheckExact(__pyx_t_7))) {
    #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API
    if (__Pyx_IS_UNIQUELY_REFERENCED(__pyx_t_7, __Pyx_ReferenceSharing_OwnStrongReference)) {
      __pyx_t_5 = __pyx_t_7;
      __pyx_t_7 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyDict_Copy(__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 411, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
  } else {
    __pyx_t_5 = __Pyx_PyObject_CallOneArg((PyObject*)&PyDict_Type, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 411, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __pyx_t_8 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
    assert(__pyx_t_3);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
    __pyx_t_8 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_3, ((PyObject *)__pyx_v_self), __pyx_v_mechanism};
    __pyx_t_4 = __Pyx_PyObject_FastCallDict((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 411, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":401
 *         return set(map(_CK_MECHANISM_TYPE_to_enum, mechanisms))
 * 
 *     def get_mechanism_info(self, mechanism):             # <<<<<<<<<<<<<<
 *         cdef CK_SLOT_ID slot_id = self.slot_id
 *         cdef CK_MECHANISM_TYPE mech_type = mechanism
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pkcs11._pkcs11.Slot.get_mechanism_info", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":413
 *         return types.MechanismInfo(self, mechanism, **info)
 * 
 *     def _identity(self):             # <<<<<<<<<<<<<<
 *         return Slot.__name__, self.slot_id
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_4Slot_9_identity(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_4Slot_9_identity = {"_identity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_4Slot_9_identity, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_4Slot_9_identity(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_identity (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("_identity", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("_identity", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_4Slot_8_identity(((struct __pyx_obj_6pkcs11_7_pkcs11_Slot *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_4Slot_8_identity(struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_identity", 0);

  /* "pkcs11/_pkcs11.pyx":414
 * 
 *     def _identity(self):
 *         return Slot.__name__, self.slot_id             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Slot), __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyLong_From_CK_ULONG(__pyx_v_self->slot_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 414, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 414, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":413
 *         return types.MechanismInfo(self, mechanism, **info)
 * 
 *     def _identity(self):             # <<<<<<<<<<<<<<
 *         return Slot.__name__, self.slot_id
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pkcs11._pkcs11.Slot._identity", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":416
 *         return Slot.__name__, self.slot_id
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "\n".join(
 *             (
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_4Slot_11__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_4Slot_11__str__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_4Slot_10__str__(((struct __pyx_obj_6pkcs11_7_pkcs11_Slot *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_4Slot_10__str__(struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "pkcs11/_pkcs11.pyx":417
 * 
 *     def __str__(self):
 *         return "\n".join(             # <<<<<<<<<<<<<<
 *             (
 *                 "Slot Description: %s" % self.slot_description,
*/
  __Pyx_XDECREF(__pyx_r);

  /* "pkcs11/_pkcs11.pyx":419
 *         return "\n".join(
 *             (
 *                 "Slot Description: %s" % self.slot_description,             # <<<<<<<<<<<<<<
 *                 "Manufacturer ID: %s" % self.manufacturer_id,
 *                 "Hardware Version: %s.%s" % self.hardware_version,
*/
  __pyx_t_1 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_Slot_Description_s, __pyx_v_self->slot_description); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "pkcs11/_pkcs11.pyx":420
 *             (
 *                 "Slot Description: %s" % self.slot_description,
 *                 "Manufacturer ID: %s" % self.manufacturer_id,             # <<<<<<<<<<<<<<
 *                 "Hardware Version: %s.%s" % self.hardware_version,
 *                 "Firmware Version: %s.%s" % self.firmware_version,
*/
  __pyx_t_2 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_Manufacturer_ID_s, __pyx_v_self->manufacturer_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "pkcs11/_pkcs11.pyx":421
 *                 "Slot Description: %s" % self.slot_description,
 *                 "Manufacturer ID: %s" % self.manufacturer_id,
 *                 "Hardware Version: %s.%s" % self.hardware_version,             # <<<<<<<<<<<<<<
 *                 "Firmware Version: %s.%s" % self.firmware_version,
 *                 "Flags: %s" % self.flags,
*/
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_hardware_version); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_Hardware_Version_s_s, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pkcs11/_pkcs11.pyx":422
 *                 "Manufacturer ID: %s" % self.manufacturer_id,
 *                 "Hardware Version: %s.%s" % self.hardware_version,
 *                 "Firmware Version: %s.%s" % self.firmware_version,             # <<<<<<<<<<<<<<
 *                 "Flags: %s" % self.flags,
 *             )
*/
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_firmware_version); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_Firmware_Version_s_s, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pkcs11/_pkcs11.pyx":423
 *                 "Hardware Version: %s.%s" % self.hardware_version,
 *                 "Firmware Version: %s.%s" % self.firmware_version,
 *                 "Flags: %s" % self.flags,             # <<<<<<<<<<<<<<
 *             )
 *         )
*/
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_flags); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_Flags_s, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pkcs11/_pkcs11.pyx":419
 *         return "\n".join(
 *             (
 *                 "Slot Description: %s" % self.slot_description,             # <<<<<<<<<<<<<<
 *                 "Manufacturer ID: %s" % self.manufacturer_id,
 *                 "Hardware Version: %s.%s" % self.hardware_version,
*/
  __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 419, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 419, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_4);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_4) != (0)) __PYX_ERR(0, 419, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_5);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_5) != (0)) __PYX_ERR(0, 419, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_6);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_t_6) != (0)) __PYX_ERR(0, 419, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;

  /* "pkcs11/_pkcs11.pyx":417
 * 
 *     def __str__(self):
 *         return "\n".join(             # <<<<<<<<<<<<<<
 *             (
 *                 "Slot Description: %s" % self.slot_description,
*/
  __pyx_t_6 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__8, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 417, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":416
 *         return Slot.__name__, self.slot_id
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "\n".join(
 *             (
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pkcs11._pkcs11.Slot.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":427
 *         )
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<{klass} (slotID={slot_id} flags={flags})>".format(
 *             klass=type(self).__name__, slot_id=self.slot_id, flags=str(self.flags)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_4Slot_13__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_4Slot_13__repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_4Slot_12__repr__(((struct __pyx_obj_6pkcs11_7_pkcs11_Slot *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_4Slot_12__repr__(struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "pkcs11/_pkcs11.pyx":428
 * 
 *     def __repr__(self):
 *         return "<{klass} (slotID={slot_id} flags={flags})>".format(             # <<<<<<<<<<<<<<
 *             klass=type(self).__name__, slot_id=self.slot_id, flags=str(self.flags)
 *         )
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_mstate_global->__pyx_kp_u_klass_slotID_slot_id_flags_flag;
  __Pyx_INCREF(__pyx_t_2);

  /* "pkcs11/_pkcs11.pyx":429
 *     def __repr__(self):
 *         return "<{klass} (slotID={slot_id} flags={flags})>".format(
 *             klass=type(self).__name__, slot_id=self.slot_id, flags=str(self.flags)             # <<<<<<<<<<<<<<
 *         )
 * 
*/
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))), __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 429, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyLong_From_CK_ULONG(__pyx_v_self->slot_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 429, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_flags); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 429, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_Unicode(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 429, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_7 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_2, NULL};
    __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 428, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_klass, __pyx_t_3, __pyx_t_5, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 428, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_slot_id, __pyx_t_4, __pyx_t_5, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 428, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_flags, __pyx_t_6, __pyx_t_5, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 428, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_7, (1-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 428, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":427
 *         )
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<{klass} (slotID={slot_id} flags={flags})>".format(
 *             klass=type(self).__name__, slot_id=self.slot_id, flags=str(self.flags)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pkcs11._pkcs11.Slot.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":322
 *     """Extend Slot with implementation."""
 * 
 *     cdef readonly CK_SLOT_ID slot_id             # <<<<<<<<<<<<<<
 *     cdef readonly str slot_description
 *     cdef readonly str manufacturer_id
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_4Slot_7slot_id_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_4Slot_7slot_id_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_4Slot_7slot_id___get__(((struct __pyx_obj_6pkcs11_7_pkcs11_Slot *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_4Slot_7slot_id___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_CK_ULONG(__pyx_v_self->slot_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 322, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pkcs11._pkcs11.Slot.slot_id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":323
 * 
 *     cdef readonly CK_SLOT_ID slot_id
 *     cdef readonly str slot_description             # <<<<<<<<<<<<<<
 *     cdef readonly str manufacturer_id
 *     cdef CK_FLAGS slot_flags
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_4Slot_16slot_description_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_4Slot_16slot_description_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_4Slot_16slot_description___get__(((struct __pyx_obj_6pkcs11_7_pkcs11_Slot *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_4Slot_16slot_description___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->slot_description);
  __pyx_r = __pyx_v_self->slot_description;
  goto __pyx_L0;

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

/* "pkcs11/_pkcs11.pyx":324
 *     cdef readonly CK_SLOT_ID slot_id
 *     cdef readonly str slot_description
 *     cdef readonly str manufacturer_id             # <<<<<<<<<<<<<<
 *     cdef CK_FLAGS slot_flags
 *     cdef CK_VERSION _hw_version
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_4Slot_15manufacturer_id_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_4Slot_15manufacturer_id_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_4Slot_15manufacturer_id___get__(((struct __pyx_obj_6pkcs11_7_pkcs11_Slot *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_4Slot_15manufacturer_id___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->manufacturer_id);
  __pyx_r = __pyx_v_self->manufacturer_id;
  goto __pyx_L0;

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

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

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_4Slot_15__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_4Slot_15__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_4Slot_15__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_4Slot_15__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_4Slot_14__reduce_cython__(((struct __pyx_obj_6pkcs11_7_pkcs11_Slot *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_4Slot_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 2, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.Slot.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_4Slot_17__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_4Slot_17__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_4Slot_17__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_4Slot_17__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.Slot.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_4Slot_16__setstate_cython__(((struct __pyx_obj_6pkcs11_7_pkcs11_Slot *)__pyx_v_self), __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_4Slot_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 4, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.Slot.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":445
 *     cdef CK_VERSION _fw_version
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef Token make(Slot slot, CK_TOKEN_INFO info):
 *         label = info.label[:sizeof(info.label)]
*/

static struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_f_6pkcs11_7_pkcs11_5Token_make(struct __pyx_obj_6pkcs11_7_pkcs11_Slot *__pyx_v_slot, CK_TOKEN_INFO __pyx_v_info) {
  PyObject *__pyx_v_label = NULL;
  PyObject *__pyx_v_serial_number = NULL;
  PyObject *__pyx_v_model = NULL;
  PyObject *__pyx_v_manufacturer_id = NULL;
  struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_v_token = 0;
  struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct CK_FUNCTION_LIST *__pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  CK_VERSION __pyx_t_6;
  CK_FLAGS __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("make", 0);

  /* "pkcs11/_pkcs11.pyx":447
 *     @staticmethod
 *     cdef Token make(Slot slot, CK_TOKEN_INFO info):
 *         label = info.label[:sizeof(info.label)]             # <<<<<<<<<<<<<<
 *         serial_number = info.serialNumber[:sizeof(info.serialNumber)]
 *         model = info.model[:sizeof(info.model)]
*/
  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(((char const *)__pyx_v_info.label) + 0, (sizeof(__pyx_v_info.label)) - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_label = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":448
 *     cdef Token make(Slot slot, CK_TOKEN_INFO info):
 *         label = info.label[:sizeof(info.label)]
 *         serial_number = info.serialNumber[:sizeof(info.serialNumber)]             # <<<<<<<<<<<<<<
 *         model = info.model[:sizeof(info.model)]
 *         manufacturer_id = info.manufacturerID[:sizeof(info.manufacturerID)]
*/
  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(((char const *)__pyx_v_info.serialNumber) + 0, (sizeof(__pyx_v_info.serialNumber)) - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_serial_number = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":449
 *         label = info.label[:sizeof(info.label)]
 *         serial_number = info.serialNumber[:sizeof(info.serialNumber)]
 *         model = info.model[:sizeof(info.model)]             # <<<<<<<<<<<<<<
 *         manufacturer_id = info.manufacturerID[:sizeof(info.manufacturerID)]
 * 
*/
  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(((char const *)__pyx_v_info.model) + 0, (sizeof(__pyx_v_info.model)) - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 449, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_model = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":450
 *         serial_number = info.serialNumber[:sizeof(info.serialNumber)]
 *         model = info.model[:sizeof(info.model)]
 *         manufacturer_id = info.manufacturerID[:sizeof(info.manufacturerID)]             # <<<<<<<<<<<<<<
 * 
 *         cdef Token token = Token.__new__(Token)
*/
  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(((char const *)__pyx_v_info.manufacturerID) + 0, (sizeof(__pyx_v_info.manufacturerID)) - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 450, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_manufacturer_id = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":452
 *         manufacturer_id = info.manufacturerID[:sizeof(info.manufacturerID)]
 * 
 *         cdef Token token = Token.__new__(Token)             # <<<<<<<<<<<<<<
 *         token.funclist = slot.funclist
 *         token.slot = slot
*/
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_6pkcs11_7_pkcs11_Token(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Token), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 452, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_1);
  __pyx_v_token = ((struct __pyx_obj_6pkcs11_7_pkcs11_Token *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":453
 * 
 *         cdef Token token = Token.__new__(Token)
 *         token.funclist = slot.funclist             # <<<<<<<<<<<<<<
 *         token.slot = slot
 *         token.label = _CK_UTF8CHAR_to_str(label)
*/
  __pyx_t_2 = __pyx_v_slot->__pyx_base.funclist;
  __pyx_v_token->__pyx_base.funclist = __pyx_t_2;

  /* "pkcs11/_pkcs11.pyx":454
 *         cdef Token token = Token.__new__(Token)
 *         token.funclist = slot.funclist
 *         token.slot = slot             # <<<<<<<<<<<<<<
 *         token.label = _CK_UTF8CHAR_to_str(label)
 *         token.serial = serial_number.rstrip()
*/
  __Pyx_INCREF((PyObject *)__pyx_v_slot);
  __Pyx_GIVEREF((PyObject *)__pyx_v_slot);
  __Pyx_GOTREF((PyObject *)__pyx_v_token->slot);
  __Pyx_DECREF((PyObject *)__pyx_v_token->slot);
  __pyx_v_token->slot = __pyx_v_slot;

  /* "pkcs11/_pkcs11.pyx":455
 *         token.funclist = slot.funclist
 *         token.slot = slot
 *         token.label = _CK_UTF8CHAR_to_str(label)             # <<<<<<<<<<<<<<
 *         token.serial = serial_number.rstrip()
 *         token.manufacturer_id = _CK_UTF8CHAR_to_str(manufacturer_id)
*/
  __pyx_t_3 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_CK_UTF8CHAR_to_str); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_3);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_label};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 455, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_1))) __PYX_ERR(0, 455, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_token->label);
  __Pyx_DECREF(__pyx_v_token->label);
  __pyx_v_token->label = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":456
 *         token.slot = slot
 *         token.label = _CK_UTF8CHAR_to_str(label)
 *         token.serial = serial_number.rstrip()             # <<<<<<<<<<<<<<
 *         token.manufacturer_id = _CK_UTF8CHAR_to_str(manufacturer_id)
 *         token.model = _CK_UTF8CHAR_to_str(model)
*/
  __pyx_t_1 = __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyBytes_Type__rstrip, __pyx_v_serial_number); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_token->serial);
  __Pyx_DECREF(__pyx_v_token->serial);
  __pyx_v_token->serial = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":457
 *         token.label = _CK_UTF8CHAR_to_str(label)
 *         token.serial = serial_number.rstrip()
 *         token.manufacturer_id = _CK_UTF8CHAR_to_str(manufacturer_id)             # <<<<<<<<<<<<<<
 *         token.model = _CK_UTF8CHAR_to_str(model)
 *         token._hw_version = info.hardwareVersion
*/
  __pyx_t_4 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_CK_UTF8CHAR_to_str); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 457, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_4);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_manufacturer_id};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 457, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_1))) __PYX_ERR(0, 457, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_token->manufacturer_id);
  __Pyx_DECREF(__pyx_v_token->manufacturer_id);
  __pyx_v_token->manufacturer_id = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":458
 *         token.serial = serial_number.rstrip()
 *         token.manufacturer_id = _CK_UTF8CHAR_to_str(manufacturer_id)
 *         token.model = _CK_UTF8CHAR_to_str(model)             # <<<<<<<<<<<<<<
 *         token._hw_version = info.hardwareVersion
 *         token._fw_version = info.firmwareVersion
*/
  __pyx_t_3 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_CK_UTF8CHAR_to_str); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 458, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_3);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_model};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 458, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_1))) __PYX_ERR(0, 458, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_token->model);
  __Pyx_DECREF(__pyx_v_token->model);
  __pyx_v_token->model = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":459
 *         token.manufacturer_id = _CK_UTF8CHAR_to_str(manufacturer_id)
 *         token.model = _CK_UTF8CHAR_to_str(model)
 *         token._hw_version = info.hardwareVersion             # <<<<<<<<<<<<<<
 *         token._fw_version = info.firmwareVersion
 *         token.token_flags = info.flags
*/
  __pyx_t_6 = __pyx_v_info.hardwareVersion;
  __pyx_v_token->_hw_version = __pyx_t_6;

  /* "pkcs11/_pkcs11.pyx":460
 *         token.model = _CK_UTF8CHAR_to_str(model)
 *         token._hw_version = info.hardwareVersion
 *         token._fw_version = info.firmwareVersion             # <<<<<<<<<<<<<<
 *         token.token_flags = info.flags
 *         return token
*/
  __pyx_t_6 = __pyx_v_info.firmwareVersion;
  __pyx_v_token->_fw_version = __pyx_t_6;

  /* "pkcs11/_pkcs11.pyx":461
 *         token._hw_version = info.hardwareVersion
 *         token._fw_version = info.firmwareVersion
 *         token.token_flags = info.flags             # <<<<<<<<<<<<<<
 *         return token
 * 
*/
  __pyx_t_7 = __pyx_v_info.flags;
  __pyx_v_token->token_flags = __pyx_t_7;

  /* "pkcs11/_pkcs11.pyx":462
 *         token._fw_version = info.firmwareVersion
 *         token.token_flags = info.flags
 *         return token             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self):
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_token);
  __pyx_r = __pyx_v_token;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":445
 *     cdef CK_VERSION _fw_version
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef Token make(Slot slot, CK_TOKEN_INFO info):
 *         label = info.label[:sizeof(info.label)]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pkcs11._pkcs11.Token.make", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_label);
  __Pyx_XDECREF(__pyx_v_serial_number);
  __Pyx_XDECREF(__pyx_v_model);
  __Pyx_XDECREF(__pyx_v_manufacturer_id);
  __Pyx_XDECREF((PyObject *)__pyx_v_token);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":464
 *         return token
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         raise TypeError
 * 
*/

/* Python wrapper */
static int __pyx_pw_6pkcs11_7_pkcs11_5Token_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6pkcs11_7_pkcs11_5Token_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, __pyx_nargs); return -1; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__init__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_5Token___init__(((struct __pyx_obj_6pkcs11_7_pkcs11_Token *)__pyx_v_self));

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

static int __pyx_pf_6pkcs11_7_pkcs11_5Token___init__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_v_self) {
  int __pyx_r;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "pkcs11/_pkcs11.pyx":465
 * 
 *     def __init__(self):
 *         raise TypeError             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), 0, 0, 0);
  __PYX_ERR(0, 465, __pyx_L1_error)

  /* "pkcs11/_pkcs11.pyx":464
 *         return token
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         raise TypeError
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.Token.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":467
 *         raise TypeError
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def flags(self):
 *         """Capabilities of this token (:class:`TokenFlag`)."""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_5Token_5flags_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_5Token_5flags_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_5Token_5flags___get__(((struct __pyx_obj_6pkcs11_7_pkcs11_Token *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_5Token_5flags___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "pkcs11/_pkcs11.pyx":470
 *     def flags(self):
 *         """Capabilities of this token (:class:`TokenFlag`)."""
 *         return TokenFlag(self.token_flags)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_TokenFlag); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyLong_From_CK_ULONG(__pyx_v_self->token_flags); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 470, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":467
 *         raise TypeError
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def flags(self):
 *         """Capabilities of this token (:class:`TokenFlag`)."""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pkcs11._pkcs11.Token.flags.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":472
 *         return TokenFlag(self.token_flags)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def hardware_version(self):
 *         """Hardware version (:class:`tuple`)."""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_5Token_16hardware_version_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_5Token_16hardware_version_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_5Token_16hardware_version___get__(((struct __pyx_obj_6pkcs11_7_pkcs11_Token *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_5Token_16hardware_version___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "pkcs11/_pkcs11.pyx":475
 *     def hardware_version(self):
 *         """Hardware version (:class:`tuple`)."""
 *         return _CK_VERSION_to_tuple(self._hw_version)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_CK_VERSION_to_tuple); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 475, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_convert__to_py_CK_VERSION(__pyx_v_self->_hw_version); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 475, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 475, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":472
 *         return TokenFlag(self.token_flags)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def hardware_version(self):
 *         """Hardware version (:class:`tuple`)."""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pkcs11._pkcs11.Token.hardware_version.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":477
 *         return _CK_VERSION_to_tuple(self._hw_version)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def firmware_version(self):
 *         """Firmware version (:class:`tuple`)."""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_5Token_16firmware_version_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_5Token_16firmware_version_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_5Token_16firmware_version___get__(((struct __pyx_obj_6pkcs11_7_pkcs11_Token *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_5Token_16firmware_version___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "pkcs11/_pkcs11.pyx":480
 *     def firmware_version(self):
 *         """Firmware version (:class:`tuple`)."""
 *         return _CK_VERSION_to_tuple(self._fw_version)             # <<<<<<<<<<<<<<
 * 
 *     def open(
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_CK_VERSION_to_tuple); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_convert__to_py_CK_VERSION(__pyx_v_self->_fw_version); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 480, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":477
 *         return _CK_VERSION_to_tuple(self._hw_version)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def firmware_version(self):
 *         """Firmware version (:class:`tuple`)."""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pkcs11._pkcs11.Token.firmware_version.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":482
 *         return _CK_VERSION_to_tuple(self._fw_version)
 * 
 *     def open(             # <<<<<<<<<<<<<<
 *             self,
 *             rw=False,
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_5Token_3open(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_5Token_3open = {"open", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_5Token_3open, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_5Token_3open(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_rw = 0;
  PyObject *__pyx_v_user_pin = 0;
  PyObject *__pyx_v_so_pin = 0;
  PyObject *__pyx_v_user_type = 0;
  PyObject *__pyx_v_attribute_mapper = 0;
  PyObject *__pyx_v_cancel_strategy = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[6] = {0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("open (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_rw,&__pyx_mstate_global->__pyx_n_u_user_pin,&__pyx_mstate_global->__pyx_n_u_so_pin,&__pyx_mstate_global->__pyx_n_u_user_type,&__pyx_mstate_global->__pyx_n_u_attribute_mapper,&__pyx_mstate_global->__pyx_n_u_cancel_strategy,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 482, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 482, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 482, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 482, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 482, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 482, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 482, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "open", 0) < (0)) __PYX_ERR(0, 482, __pyx_L3_error)

      /* "pkcs11/_pkcs11.pyx":484
 *     def open(
 *             self,
 *             rw=False,             # <<<<<<<<<<<<<<
 *             user_pin=None,
 *             so_pin=None,
*/
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_False));

      /* "pkcs11/_pkcs11.pyx":485
 *             self,
 *             rw=False,
 *             user_pin=None,             # <<<<<<<<<<<<<<
 *             so_pin=None,
 *             user_type=None,
*/
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":486
 *             rw=False,
 *             user_pin=None,
 *             so_pin=None,             # <<<<<<<<<<<<<<
 *             user_type=None,
 *             attribute_mapper=None,
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":487
 *             user_pin=None,
 *             so_pin=None,
 *             user_type=None,             # <<<<<<<<<<<<<<
 *             attribute_mapper=None,
 *             cancel_strategy=CancelStrategy.DEFAULT
*/
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":488
 *             so_pin=None,
 *             user_type=None,
 *             attribute_mapper=None,             # <<<<<<<<<<<<<<
 *             cancel_strategy=CancelStrategy.DEFAULT
 *     ):
*/
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[5]) values[5] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__9);
    } else {
      switch (__pyx_nargs) {
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 482, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 482, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 482, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 482, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 482, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 482, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }

      /* "pkcs11/_pkcs11.pyx":484
 *     def open(
 *             self,
 *             rw=False,             # <<<<<<<<<<<<<<
 *             user_pin=None,
 *             so_pin=None,
*/
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_False));

      /* "pkcs11/_pkcs11.pyx":485
 *             self,
 *             rw=False,
 *             user_pin=None,             # <<<<<<<<<<<<<<
 *             so_pin=None,
 *             user_type=None,
*/
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":486
 *             rw=False,
 *             user_pin=None,
 *             so_pin=None,             # <<<<<<<<<<<<<<
 *             user_type=None,
 *             attribute_mapper=None,
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":487
 *             user_pin=None,
 *             so_pin=None,
 *             user_type=None,             # <<<<<<<<<<<<<<
 *             attribute_mapper=None,
 *             cancel_strategy=CancelStrategy.DEFAULT
*/
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":488
 *             so_pin=None,
 *             user_type=None,
 *             attribute_mapper=None,             # <<<<<<<<<<<<<<
 *             cancel_strategy=CancelStrategy.DEFAULT
 *     ):
*/
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[5]) values[5] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__9);
    }
    __pyx_v_rw = values[0];
    __pyx_v_user_pin = values[1];
    __pyx_v_so_pin = values[2];
    __pyx_v_user_type = values[3];
    __pyx_v_attribute_mapper = values[4];
    __pyx_v_cancel_strategy = values[5];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("open", 0, 0, 6, __pyx_nargs); __PYX_ERR(0, 482, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.Token.open", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_5Token_2open(((struct __pyx_obj_6pkcs11_7_pkcs11_Token *)__pyx_v_self), __pyx_v_rw, __pyx_v_user_pin, __pyx_v_so_pin, __pyx_v_user_type, __pyx_v_attribute_mapper, __pyx_v_cancel_strategy);

  /* "pkcs11/_pkcs11.pyx":482
 *         return _CK_VERSION_to_tuple(self._fw_version)
 * 
 *     def open(             # <<<<<<<<<<<<<<
 *             self,
 *             rw=False,
*/

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_5Token_2open(struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_v_self, PyObject *__pyx_v_rw, PyObject *__pyx_v_user_pin, PyObject *__pyx_v_so_pin, PyObject *__pyx_v_user_type, PyObject *__pyx_v_attribute_mapper, PyObject *__pyx_v_cancel_strategy) {
  CK_SLOT_ID __pyx_v_slot_id;
  CK_SESSION_HANDLE __pyx_v_handle;
  CK_FLAGS __pyx_v_flags;
  CK_UTF8CHAR *__pyx_v_pin_data;
  CK_ULONG __pyx_v_pin_length;
  CK_RV __pyx_v_retval;
  CK_USER_TYPE __pyx_v_c_user_type;
  PyObject *__pyx_v_pin = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  CK_SLOT_ID __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  CK_USER_TYPE __pyx_t_8;
  CK_USER_TYPE __pyx_t_9;
  CK_UTF8CHAR *__pyx_t_10;
  Py_ssize_t __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  unsigned int __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("open", 0);

  /* "pkcs11/_pkcs11.pyx":491
 *             cancel_strategy=CancelStrategy.DEFAULT
 *     ):
 *         cdef CK_SLOT_ID slot_id = self.slot.slot_id             # <<<<<<<<<<<<<<
 *         cdef CK_SESSION_HANDLE handle
 *         cdef CK_FLAGS flags = CKF_SERIAL_SESSION
*/
  __pyx_t_1 = __pyx_v_self->slot->slot_id;
  __pyx_v_slot_id = __pyx_t_1;

  /* "pkcs11/_pkcs11.pyx":493
 *         cdef CK_SLOT_ID slot_id = self.slot.slot_id
 *         cdef CK_SESSION_HANDLE handle
 *         cdef CK_FLAGS flags = CKF_SERIAL_SESSION             # <<<<<<<<<<<<<<
 *         cdef CK_USER_TYPE final_user_type
 *         cdef CK_UTF8CHAR *pin_data
*/
  __pyx_v_flags = CKF_SERIAL_SESSION;

  /* "pkcs11/_pkcs11.pyx":500
 *         cdef CK_USER_TYPE c_user_type
 * 
 *         if rw:             # <<<<<<<<<<<<<<
 *             flags |= CKF_RW_SESSION
 * 
*/
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_rw); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 500, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "pkcs11/_pkcs11.pyx":501
 * 
 *         if rw:
 *             flags |= CKF_RW_SESSION             # <<<<<<<<<<<<<<
 * 
 *         if user_pin is not None and so_pin is not None:
*/
    __pyx_v_flags = (__pyx_v_flags | CKF_RW_SESSION);

    /* "pkcs11/_pkcs11.pyx":500
 *         cdef CK_USER_TYPE c_user_type
 * 
 *         if rw:             # <<<<<<<<<<<<<<
 *             flags |= CKF_RW_SESSION
 * 
*/
  }

  /* "pkcs11/_pkcs11.pyx":503
 *             flags |= CKF_RW_SESSION
 * 
 *         if user_pin is not None and so_pin is not None:             # <<<<<<<<<<<<<<
 *             raise ArgumentsBad("Set either `user_pin` or `so_pin`")
 *         elif user_pin is PROTECTED_AUTH:
*/
  __pyx_t_3 = (__pyx_v_user_pin != Py_None);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_so_pin != Py_None);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_2)) {

    /* "pkcs11/_pkcs11.pyx":504
 * 
 *         if user_pin is not None and so_pin is not None:
 *             raise ArgumentsBad("Set either `user_pin` or `so_pin`")             # <<<<<<<<<<<<<<
 *         elif user_pin is PROTECTED_AUTH:
 *             pin = None
*/
    __pyx_t_5 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_ArgumentsBad); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 504, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_5);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_7 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Set_either_user_pin_or_so_pin};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 504, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(0, 504, __pyx_L1_error)

    /* "pkcs11/_pkcs11.pyx":503
 *             flags |= CKF_RW_SESSION
 * 
 *         if user_pin is not None and so_pin is not None:             # <<<<<<<<<<<<<<
 *             raise ArgumentsBad("Set either `user_pin` or `so_pin`")
 *         elif user_pin is PROTECTED_AUTH:
*/
  }

  /* "pkcs11/_pkcs11.pyx":505
 *         if user_pin is not None and so_pin is not None:
 *             raise ArgumentsBad("Set either `user_pin` or `so_pin`")
 *         elif user_pin is PROTECTED_AUTH:             # <<<<<<<<<<<<<<
 *             pin = None
 *             c_user_type = user_type if user_type is not None else CKU_USER
*/
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_PROTECTED_AUTH); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 505, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = (__pyx_v_user_pin == __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_2) {

    /* "pkcs11/_pkcs11.pyx":506
 *             raise ArgumentsBad("Set either `user_pin` or `so_pin`")
 *         elif user_pin is PROTECTED_AUTH:
 *             pin = None             # <<<<<<<<<<<<<<
 *             c_user_type = user_type if user_type is not None else CKU_USER
 *         elif so_pin is PROTECTED_AUTH:
*/
    __Pyx_INCREF(Py_None);
    __pyx_v_pin = Py_None;

    /* "pkcs11/_pkcs11.pyx":507
 *         elif user_pin is PROTECTED_AUTH:
 *             pin = None
 *             c_user_type = user_type if user_type is not None else CKU_USER             # <<<<<<<<<<<<<<
 *         elif so_pin is PROTECTED_AUTH:
 *             pin = None
*/
    __pyx_t_2 = (__pyx_v_user_type != Py_None);
    if (__pyx_t_2) {
      __pyx_t_9 = ((CK_USER_TYPE)__Pyx_PyLong_As_CK_USER_TYPE(__pyx_v_user_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 507, __pyx_L1_error)
      __pyx_t_8 = __pyx_t_9;
    } else {
      __pyx_t_8 = CKU_USER;
    }
    __pyx_v_c_user_type = __pyx_t_8;

    /* "pkcs11/_pkcs11.pyx":505
 *         if user_pin is not None and so_pin is not None:
 *             raise ArgumentsBad("Set either `user_pin` or `so_pin`")
 *         elif user_pin is PROTECTED_AUTH:             # <<<<<<<<<<<<<<
 *             pin = None
 *             c_user_type = user_type if user_type is not None else CKU_USER
*/
    goto __pyx_L4;
  }

  /* "pkcs11/_pkcs11.pyx":508
 *             pin = None
 *             c_user_type = user_type if user_type is not None else CKU_USER
 *         elif so_pin is PROTECTED_AUTH:             # <<<<<<<<<<<<<<
 *             pin = None
 *             c_user_type = CKU_SO
*/
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_PROTECTED_AUTH); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 508, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = (__pyx_v_so_pin == __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_2) {

    /* "pkcs11/_pkcs11.pyx":509
 *             c_user_type = user_type if user_type is not None else CKU_USER
 *         elif so_pin is PROTECTED_AUTH:
 *             pin = None             # <<<<<<<<<<<<<<
 *             c_user_type = CKU_SO
 *         elif user_pin is not None:
*/
    __Pyx_INCREF(Py_None);
    __pyx_v_pin = Py_None;

    /* "pkcs11/_pkcs11.pyx":510
 *         elif so_pin is PROTECTED_AUTH:
 *             pin = None
 *             c_user_type = CKU_SO             # <<<<<<<<<<<<<<
 *         elif user_pin is not None:
 *             pin = user_pin.encode('utf-8')
*/
    __pyx_v_c_user_type = CKU_SO;

    /* "pkcs11/_pkcs11.pyx":508
 *             pin = None
 *             c_user_type = user_type if user_type is not None else CKU_USER
 *         elif so_pin is PROTECTED_AUTH:             # <<<<<<<<<<<<<<
 *             pin = None
 *             c_user_type = CKU_SO
*/
    goto __pyx_L4;
  }

  /* "pkcs11/_pkcs11.pyx":511
 *             pin = None
 *             c_user_type = CKU_SO
 *         elif user_pin is not None:             # <<<<<<<<<<<<<<
 *             pin = user_pin.encode('utf-8')
 *             c_user_type = user_type if user_type is not None else CKU_USER
*/
  __pyx_t_2 = (__pyx_v_user_pin != Py_None);
  if (__pyx_t_2) {

    /* "pkcs11/_pkcs11.pyx":512
 *             c_user_type = CKU_SO
 *         elif user_pin is not None:
 *             pin = user_pin.encode('utf-8')             # <<<<<<<<<<<<<<
 *             c_user_type = user_type if user_type is not None else CKU_USER
 *         elif so_pin is not None:
*/
    __pyx_t_6 = __pyx_v_user_pin;
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_7 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_utf_8};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 512, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_v_pin = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pkcs11/_pkcs11.pyx":513
 *         elif user_pin is not None:
 *             pin = user_pin.encode('utf-8')
 *             c_user_type = user_type if user_type is not None else CKU_USER             # <<<<<<<<<<<<<<
 *         elif so_pin is not None:
 *             pin = so_pin.encode('utf-8')
*/
    __pyx_t_2 = (__pyx_v_user_type != Py_None);
    if (__pyx_t_2) {
      __pyx_t_9 = ((CK_USER_TYPE)__Pyx_PyLong_As_CK_USER_TYPE(__pyx_v_user_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 513, __pyx_L1_error)
      __pyx_t_8 = __pyx_t_9;
    } else {
      __pyx_t_8 = CKU_USER;
    }
    __pyx_v_c_user_type = __pyx_t_8;

    /* "pkcs11/_pkcs11.pyx":511
 *             pin = None
 *             c_user_type = CKU_SO
 *         elif user_pin is not None:             # <<<<<<<<<<<<<<
 *             pin = user_pin.encode('utf-8')
 *             c_user_type = user_type if user_type is not None else CKU_USER
*/
    goto __pyx_L4;
  }

  /* "pkcs11/_pkcs11.pyx":514
 *             pin = user_pin.encode('utf-8')
 *             c_user_type = user_type if user_type is not None else CKU_USER
 *         elif so_pin is not None:             # <<<<<<<<<<<<<<
 *             pin = so_pin.encode('utf-8')
 *             c_user_type = CKU_SO
*/
  __pyx_t_2 = (__pyx_v_so_pin != Py_None);
  if (__pyx_t_2) {

    /* "pkcs11/_pkcs11.pyx":515
 *             c_user_type = user_type if user_type is not None else CKU_USER
 *         elif so_pin is not None:
 *             pin = so_pin.encode('utf-8')             # <<<<<<<<<<<<<<
 *             c_user_type = CKU_SO
 *         else:
*/
    __pyx_t_6 = __pyx_v_so_pin;
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_7 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_utf_8};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 515, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_v_pin = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pkcs11/_pkcs11.pyx":516
 *         elif so_pin is not None:
 *             pin = so_pin.encode('utf-8')
 *             c_user_type = CKU_SO             # <<<<<<<<<<<<<<
 *         else:
 *             pin = None
*/
    __pyx_v_c_user_type = CKU_SO;

    /* "pkcs11/_pkcs11.pyx":514
 *             pin = user_pin.encode('utf-8')
 *             c_user_type = user_type if user_type is not None else CKU_USER
 *         elif so_pin is not None:             # <<<<<<<<<<<<<<
 *             pin = so_pin.encode('utf-8')
 *             c_user_type = CKU_SO
*/
    goto __pyx_L4;
  }

  /* "pkcs11/_pkcs11.pyx":518
 *             c_user_type = CKU_SO
 *         else:
 *             pin = None             # <<<<<<<<<<<<<<
 *             c_user_type = CKU_USER_NOBODY
 * 
*/
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __pyx_v_pin = Py_None;

    /* "pkcs11/_pkcs11.pyx":519
 *         else:
 *             pin = None
 *             c_user_type = CKU_USER_NOBODY             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
*/
    __pyx_v_c_user_type = CKU_USER_NOBODY;
  }
  __pyx_L4:;

  /* "pkcs11/_pkcs11.pyx":521
 *             c_user_type = CKU_USER_NOBODY
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_OpenSession(slot_id, flags, NULL, NULL, &handle)
 *         assertRV(retval)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":522
 * 
 *         with nogil:
 *             retval = self.funclist.C_OpenSession(slot_id, flags, NULL, NULL, &handle)             # <<<<<<<<<<<<<<
 *         assertRV(retval)
 * 
*/
        __pyx_v_retval = __pyx_v_self->__pyx_base.funclist->C_OpenSession(__pyx_v_slot_id, __pyx_v_flags, NULL, NULL, (&__pyx_v_handle));
      }

      /* "pkcs11/_pkcs11.pyx":521
 *             c_user_type = CKU_USER_NOBODY
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_OpenSession(slot_id, flags, NULL, NULL, &handle)
 *         assertRV(retval)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L9;
        }
        __pyx_L9:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":523
 *         with nogil:
 *             retval = self.funclist.C_OpenSession(slot_id, flags, NULL, NULL, &handle)
 *         assertRV(retval)             # <<<<<<<<<<<<<<
 * 
 *         if so_pin is PROTECTED_AUTH or user_pin is PROTECTED_AUTH:
*/
  __pyx_t_4 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "pkcs11/_pkcs11.pyx":525
 *         assertRV(retval)
 * 
 *         if so_pin is PROTECTED_AUTH or user_pin is PROTECTED_AUTH:             # <<<<<<<<<<<<<<
 *             if self.flags & TokenFlag.PROTECTED_AUTHENTICATION_PATH:
 *                 with nogil:
*/
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_PROTECTED_AUTH); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = (__pyx_v_so_pin == __pyx_t_6);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L11_bool_binop_done;
  }
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_PROTECTED_AUTH); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = (__pyx_v_user_pin == __pyx_t_6);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_2 = __pyx_t_3;
  __pyx_L11_bool_binop_done:;
  if (__pyx_t_2) {

    /* "pkcs11/_pkcs11.pyx":526
 * 
 *         if so_pin is PROTECTED_AUTH or user_pin is PROTECTED_AUTH:
 *             if self.flags & TokenFlag.PROTECTED_AUTHENTICATION_PATH:             # <<<<<<<<<<<<<<
 *                 with nogil:
 *                     retval = self.funclist.C_Login(handle, c_user_type, NULL, 0)
*/
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_flags); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 526, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_TokenFlag); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 526, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_PROTECTED_AUTHENTICATION_PATH); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 526, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_And(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 526, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 526, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (likely(__pyx_t_2)) {

      /* "pkcs11/_pkcs11.pyx":527
 *         if so_pin is PROTECTED_AUTH or user_pin is PROTECTED_AUTH:
 *             if self.flags & TokenFlag.PROTECTED_AUTHENTICATION_PATH:
 *                 with nogil:             # <<<<<<<<<<<<<<
 *                     retval = self.funclist.C_Login(handle, c_user_type, NULL, 0)
 *                 assertRV(retval)
*/
      {
          PyThreadState * _save;
          _save = PyEval_SaveThread();
          __Pyx_FastGIL_Remember();
          /*try:*/ {

            /* "pkcs11/_pkcs11.pyx":528
 *             if self.flags & TokenFlag.PROTECTED_AUTHENTICATION_PATH:
 *                 with nogil:
 *                     retval = self.funclist.C_Login(handle, c_user_type, NULL, 0)             # <<<<<<<<<<<<<<
 *                 assertRV(retval)
 *             else:
*/
            __pyx_v_retval = __pyx_v_self->__pyx_base.funclist->C_Login(__pyx_v_handle, __pyx_v_c_user_type, NULL, 0);
          }

          /* "pkcs11/_pkcs11.pyx":527
 *         if so_pin is PROTECTED_AUTH or user_pin is PROTECTED_AUTH:
 *             if self.flags & TokenFlag.PROTECTED_AUTHENTICATION_PATH:
 *                 with nogil:             # <<<<<<<<<<<<<<
 *                     retval = self.funclist.C_Login(handle, c_user_type, NULL, 0)
 *                 assertRV(retval)
*/
          /*finally:*/ {
            /*normal exit:*/{
              __Pyx_FastGIL_Forget();
              PyEval_RestoreThread(_save);
              goto __pyx_L16;
            }
            __pyx_L16:;
          }
      }

      /* "pkcs11/_pkcs11.pyx":529
 *                 with nogil:
 *                     retval = self.funclist.C_Login(handle, c_user_type, NULL, 0)
 *                 assertRV(retval)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ArgumentsBad("Protected authentication is not supported by loaded module")
*/
      __pyx_t_4 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 529, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 529, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "pkcs11/_pkcs11.pyx":526
 * 
 *         if so_pin is PROTECTED_AUTH or user_pin is PROTECTED_AUTH:
 *             if self.flags & TokenFlag.PROTECTED_AUTHENTICATION_PATH:             # <<<<<<<<<<<<<<
 *                 with nogil:
 *                     retval = self.funclist.C_Login(handle, c_user_type, NULL, 0)
*/
      goto __pyx_L13;
    }

    /* "pkcs11/_pkcs11.pyx":531
 *                 assertRV(retval)
 *             else:
 *                 raise ArgumentsBad("Protected authentication is not supported by loaded module")             # <<<<<<<<<<<<<<
 *         elif pin is not None:
 *             pin_data = pin
*/
    /*else*/ {
      __pyx_t_4 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_ArgumentsBad); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 531, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
        assert(__pyx_t_4);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
        __pyx_t_7 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Protected_authentication_is_not};
        __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 531, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(0, 531, __pyx_L1_error)
    }
    __pyx_L13:;

    /* "pkcs11/_pkcs11.pyx":525
 *         assertRV(retval)
 * 
 *         if so_pin is PROTECTED_AUTH or user_pin is PROTECTED_AUTH:             # <<<<<<<<<<<<<<
 *             if self.flags & TokenFlag.PROTECTED_AUTHENTICATION_PATH:
 *                 with nogil:
*/
    goto __pyx_L10;
  }

  /* "pkcs11/_pkcs11.pyx":532
 *             else:
 *                 raise ArgumentsBad("Protected authentication is not supported by loaded module")
 *         elif pin is not None:             # <<<<<<<<<<<<<<
 *             pin_data = pin
 *             pin_length = <CK_ULONG> len(pin)
*/
  __pyx_t_2 = (__pyx_v_pin != Py_None);
  if (__pyx_t_2) {

    /* "pkcs11/_pkcs11.pyx":533
 *                 raise ArgumentsBad("Protected authentication is not supported by loaded module")
 *         elif pin is not None:
 *             pin_data = pin             # <<<<<<<<<<<<<<
 *             pin_length = <CK_ULONG> len(pin)
 * 
*/
    __pyx_t_10 = __Pyx_PyObject_AsWritableUString(__pyx_v_pin); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(0, 533, __pyx_L1_error)
    __pyx_v_pin_data = __pyx_t_10;

    /* "pkcs11/_pkcs11.pyx":534
 *         elif pin is not None:
 *             pin_data = pin
 *             pin_length = <CK_ULONG> len(pin)             # <<<<<<<<<<<<<<
 * 
 *             with nogil:
*/
    __pyx_t_11 = PyObject_Length(__pyx_v_pin); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 534, __pyx_L1_error)
    __pyx_v_pin_length = ((CK_ULONG)__pyx_t_11);

    /* "pkcs11/_pkcs11.pyx":536
 *             pin_length = <CK_ULONG> len(pin)
 * 
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 retval = self.funclist.C_Login(handle, c_user_type, pin_data, pin_length)
 *             assertRV(retval)
*/
    {
        PyThreadState * _save;
        _save = PyEval_SaveThread();
        __Pyx_FastGIL_Remember();
        /*try:*/ {

          /* "pkcs11/_pkcs11.pyx":537
 * 
 *             with nogil:
 *                 retval = self.funclist.C_Login(handle, c_user_type, pin_data, pin_length)             # <<<<<<<<<<<<<<
 *             assertRV(retval)
 * 
*/
          __pyx_v_retval = __pyx_v_self->__pyx_base.funclist->C_Login(__pyx_v_handle, __pyx_v_c_user_type, __pyx_v_pin_data, __pyx_v_pin_length);
        }

        /* "pkcs11/_pkcs11.pyx":536
 *             pin_length = <CK_ULONG> len(pin)
 * 
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 retval = self.funclist.C_Login(handle, c_user_type, pin_data, pin_length)
 *             assertRV(retval)
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_FastGIL_Forget();
            PyEval_RestoreThread(_save);
            goto __pyx_L19;
          }
          __pyx_L19:;
        }
    }

    /* "pkcs11/_pkcs11.pyx":538
 *             with nogil:
 *                 retval = self.funclist.C_Login(handle, c_user_type, pin_data, pin_length)
 *             assertRV(retval)             # <<<<<<<<<<<<<<
 * 
 *         return Session.make(
*/
    __pyx_t_5 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 538, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 538, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "pkcs11/_pkcs11.pyx":532
 *             else:
 *                 raise ArgumentsBad("Protected authentication is not supported by loaded module")
 *         elif pin is not None:             # <<<<<<<<<<<<<<
 *             pin_data = pin
 *             pin_length = <CK_ULONG> len(pin)
*/
  }
  __pyx_L10:;

  /* "pkcs11/_pkcs11.pyx":540
 *             assertRV(retval)
 * 
 *         return Session.make(             # <<<<<<<<<<<<<<
 *             self, handle,
 *             rw=<bint> rw,
*/
  __Pyx_XDECREF(__pyx_r);

  /* "pkcs11/_pkcs11.pyx":542
 *         return Session.make(
 *             self, handle,
 *             rw=<bint> rw,             # <<<<<<<<<<<<<<
 *             user_type=c_user_type,
 *             mapper=attribute_mapper or AttributeMapper(),
*/
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_rw); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 542, __pyx_L1_error)

  /* "pkcs11/_pkcs11.pyx":544
 *             rw=<bint> rw,
 *             user_type=c_user_type,
 *             mapper=attribute_mapper or AttributeMapper(),             # <<<<<<<<<<<<<<
 *             cancel_strategy=<unsigned int> cancel_strategy
 *         )
*/
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_attribute_mapper); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 544, __pyx_L1_error)
  if (!__pyx_t_3) {
  } else {
    __Pyx_INCREF(__pyx_v_attribute_mapper);
    __pyx_t_6 = __pyx_v_attribute_mapper;
    goto __pyx_L20_bool_binop_done;
  }
  __pyx_t_4 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_AttributeMapper); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 544, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_7 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_12))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_12);
    assert(__pyx_t_4);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_12);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_12, __pyx__function);
    __pyx_t_7 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
    __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_12, __pyx_callargs+__pyx_t_7, (1-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 544, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_6 = __pyx_t_5;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_L20_bool_binop_done:;

  /* "pkcs11/_pkcs11.pyx":545
 *             user_type=c_user_type,
 *             mapper=attribute_mapper or AttributeMapper(),
 *             cancel_strategy=<unsigned int> cancel_strategy             # <<<<<<<<<<<<<<
 *         )
 * 
*/
  __pyx_t_13 = __Pyx_PyLong_As_unsigned_int(__pyx_v_cancel_strategy); if (unlikely((__pyx_t_13 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 545, __pyx_L1_error)

  /* "pkcs11/_pkcs11.pyx":540
 *             assertRV(retval)
 * 
 *         return Session.make(             # <<<<<<<<<<<<<<
 *             self, handle,
 *             rw=<bint> rw,
*/
  __pyx_t_5 = ((PyObject *)__pyx_f_6pkcs11_7_pkcs11_7Session_make(__pyx_v_self, __pyx_v_handle, __pyx_t_2, __pyx_v_c_user_type, __pyx_t_6, ((unsigned int)__pyx_t_13))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 540, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":482
 *         return _CK_VERSION_to_tuple(self._fw_version)
 * 
 *     def open(             # <<<<<<<<<<<<<<
 *             self,
 *             rw=False,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("pkcs11._pkcs11.Token.open", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pin);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":548
 *         )
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return self.label
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_5Token_5__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_5Token_5__str__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_5Token_4__str__(((struct __pyx_obj_6pkcs11_7_pkcs11_Token *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_5Token_4__str__(struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "pkcs11/_pkcs11.pyx":549
 * 
 *     def __str__(self):
 *         return self.label             # <<<<<<<<<<<<<<
 * 
 *     def _identity(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->label);
  __pyx_r = __pyx_v_self->label;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":548
 *         )
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return self.label
 * 
*/

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

/* "pkcs11/_pkcs11.pyx":551
 *         return self.label
 * 
 *     def _identity(self):             # <<<<<<<<<<<<<<
 *         return Token.__name__, self.slot
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_5Token_7_identity(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_5Token_7_identity = {"_identity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_5Token_7_identity, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_5Token_7_identity(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_identity (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("_identity", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("_identity", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_5Token_6_identity(((struct __pyx_obj_6pkcs11_7_pkcs11_Token *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_5Token_6_identity(struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_identity", 0);

  /* "pkcs11/_pkcs11.pyx":552
 * 
 *     def _identity(self):
 *         return Token.__name__, self.slot             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Token), __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 552, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 552, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 552, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_v_self->slot);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self->slot);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self->slot)) != (0)) __PYX_ERR(0, 552, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":551
 *         return self.label
 * 
 *     def _identity(self):             # <<<<<<<<<<<<<<
 *         return Token.__name__, self.slot
 * 
*/

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

/* "pkcs11/_pkcs11.pyx":554
 *         return Token.__name__, self.slot
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<{klass} (label='{label}' serial={serial} flags={flags})>".format(
 *             klass=type(self).__name__, label=self.label, serial=self.serial, flags=str(self.flags)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_5Token_9__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_5Token_9__repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_5Token_8__repr__(((struct __pyx_obj_6pkcs11_7_pkcs11_Token *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_5Token_8__repr__(struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "pkcs11/_pkcs11.pyx":555
 * 
 *     def __repr__(self):
 *         return "<{klass} (label='{label}' serial={serial} flags={flags})>".format(             # <<<<<<<<<<<<<<
 *             klass=type(self).__name__, label=self.label, serial=self.serial, flags=str(self.flags)
 *         )
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_mstate_global->__pyx_kp_u_klass_label_label_serial_serial;
  __Pyx_INCREF(__pyx_t_2);

  /* "pkcs11/_pkcs11.pyx":556
 *     def __repr__(self):
 *         return "<{klass} (label='{label}' serial={serial} flags={flags})>".format(
 *             klass=type(self).__name__, label=self.label, serial=self.serial, flags=str(self.flags)             # <<<<<<<<<<<<<<
 *         )
 * 
*/
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))), __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 556, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_flags); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 556, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_Unicode(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 556, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 4 : 0)] = {__pyx_t_2, NULL};
    __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 555, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_klass, __pyx_t_3, __pyx_t_4, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 555, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_label, __pyx_v_self->label, __pyx_t_4, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 555, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_serial, __pyx_v_self->serial, __pyx_t_4, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 555, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_flags, __pyx_t_5, __pyx_t_4, __pyx_callargs+1, 3) < (0)) __PYX_ERR(0, 555, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 555, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":554
 *         return Token.__name__, self.slot
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<{klass} (label='{label}' serial={serial} flags={flags})>".format(
 *             klass=type(self).__name__, label=self.label, serial=self.serial, flags=str(self.flags)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pkcs11._pkcs11.Token.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":436
 *     """Extend Token with implementation."""
 * 
 *     cdef readonly Slot slot             # <<<<<<<<<<<<<<
 *     cdef readonly str label
 *     cdef readonly bytes serial
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_5Token_4slot_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_5Token_4slot_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_5Token_4slot___get__(((struct __pyx_obj_6pkcs11_7_pkcs11_Token *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_5Token_4slot___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self->slot);
  __pyx_r = ((PyObject *)__pyx_v_self->slot);
  goto __pyx_L0;

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

/* "pkcs11/_pkcs11.pyx":437
 * 
 *     cdef readonly Slot slot
 *     cdef readonly str label             # <<<<<<<<<<<<<<
 *     cdef readonly bytes serial
 *     cdef readonly str manufacturer_id
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_5Token_5label_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_5Token_5label_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_5Token_5label___get__(((struct __pyx_obj_6pkcs11_7_pkcs11_Token *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_5Token_5label___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->label);
  __pyx_r = __pyx_v_self->label;
  goto __pyx_L0;

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

/* "pkcs11/_pkcs11.pyx":438
 *     cdef readonly Slot slot
 *     cdef readonly str label
 *     cdef readonly bytes serial             # <<<<<<<<<<<<<<
 *     cdef readonly str manufacturer_id
 *     cdef readonly str model
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_5Token_6serial_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_5Token_6serial_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_5Token_6serial___get__(((struct __pyx_obj_6pkcs11_7_pkcs11_Token *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_5Token_6serial___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->serial);
  __pyx_r = __pyx_v_self->serial;
  goto __pyx_L0;

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

/* "pkcs11/_pkcs11.pyx":439
 *     cdef readonly str label
 *     cdef readonly bytes serial
 *     cdef readonly str manufacturer_id             # <<<<<<<<<<<<<<
 *     cdef readonly str model
 *     cdef CK_FLAGS token_flags
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_5Token_15manufacturer_id_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_5Token_15manufacturer_id_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_5Token_15manufacturer_id___get__(((struct __pyx_obj_6pkcs11_7_pkcs11_Token *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_5Token_15manufacturer_id___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->manufacturer_id);
  __pyx_r = __pyx_v_self->manufacturer_id;
  goto __pyx_L0;

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

/* "pkcs11/_pkcs11.pyx":440
 *     cdef readonly bytes serial
 *     cdef readonly str manufacturer_id
 *     cdef readonly str model             # <<<<<<<<<<<<<<
 *     cdef CK_FLAGS token_flags
 *     cdef CK_VERSION _hw_version
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_5Token_5model_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_5Token_5model_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_5Token_5model___get__(((struct __pyx_obj_6pkcs11_7_pkcs11_Token *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_5Token_5model___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->model);
  __pyx_r = __pyx_v_self->model;
  goto __pyx_L0;

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

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

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_5Token_11__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_5Token_11__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_5Token_11__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_5Token_11__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_5Token_10__reduce_cython__(((struct __pyx_obj_6pkcs11_7_pkcs11_Token *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_5Token_10__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 2, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.Token.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_5Token_13__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_5Token_13__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_5Token_13__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_5Token_13__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.Token.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_5Token_12__setstate_cython__(((struct __pyx_obj_6pkcs11_7_pkcs11_Token *)__pyx_v_self), __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_5Token_12__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 4, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.Token.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":564
 *     cdef bint active
 * 
 *     def __cinit__(self, session, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         self.session = session
 *         self.active = False
*/

/* Python wrapper */
static int __pyx_pw_6pkcs11_7_pkcs11_16OperationContext_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6pkcs11_7_pkcs11_16OperationContext_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_session = 0;
  CYTHON_UNUSED PyObject *__pyx_v_args = 0;
  CYTHON_UNUSED PyObject *__pyx_v_kwargs = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_v_args = __Pyx_ArgsSlice_VARARGS(__pyx_args, 1, __pyx_nargs);
  if (unlikely(!__pyx_v_args)) {
    __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
    __Pyx_RefNannyFinishContext();
    return -1;
  }
  __Pyx_GOTREF(__pyx_v_args);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_session,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 564, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        default:
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 564, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      const Py_ssize_t used_pos_args = (kwd_pos_args < 1) ? kwd_pos_args : 1;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, __pyx_kwds_len, "__cinit__", 1) < (0)) __PYX_ERR(0, 564, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 1, i); __PYX_ERR(0, 564, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs < 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 564, __pyx_L3_error)
    }
    __pyx_v_session = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 1, __pyx_nargs); __PYX_ERR(0, 564, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
  __Pyx_XDECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("pkcs11._pkcs11.OperationContext.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_16OperationContext___cinit__(((struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *)__pyx_v_self), __pyx_v_session, __pyx_v_args, __pyx_v_kwargs);

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

static int __pyx_pf_6pkcs11_7_pkcs11_16OperationContext___cinit__(struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *__pyx_v_self, PyObject *__pyx_v_session, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "pkcs11/_pkcs11.pyx":565
 * 
 *     def __cinit__(self, session, *args, **kwargs):
 *         self.session = session             # <<<<<<<<<<<<<<
 *         self.active = False
 * 
*/
  __pyx_t_1 = __pyx_v_session;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Session))))) __PYX_ERR(0, 565, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->session);
  __Pyx_DECREF((PyObject *)__pyx_v_self->session);
  __pyx_v_self->session = ((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":566
 *     def __cinit__(self, session, *args, **kwargs):
 *         self.session = session
 *         self.active = False             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, session):
*/
  __pyx_v_self->active = 0;

  /* "pkcs11/_pkcs11.pyx":564
 *     cdef bint active
 * 
 *     def __cinit__(self, session, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         self.session = session
 *         self.active = False
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pkcs11._pkcs11.OperationContext.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":568
 *         self.active = False
 * 
 *     def __init__(self, session):             # <<<<<<<<<<<<<<
 *         pass
 * 
*/

/* Python wrapper */
static int __pyx_pw_6pkcs11_7_pkcs11_16OperationContext_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6pkcs11_7_pkcs11_16OperationContext_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_session = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_session,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 568, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 568, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 568, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, i); __PYX_ERR(0, 568, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 568, __pyx_L3_error)
    }
    __pyx_v_session = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 568, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.OperationContext.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_16OperationContext_2__init__(((struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *)__pyx_v_self), __pyx_v_session);

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

static int __pyx_pf_6pkcs11_7_pkcs11_16OperationContext_2__init__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_session) {
  int __pyx_r;

  /* function exit code */
  __pyx_r = 0;
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":571
 *         pass
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         self.session.operation_lock.acquire()
 *         self.active = True
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_16OperationContext_5__enter__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_16OperationContext_5__enter__ = {"__enter__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_16OperationContext_5__enter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_16OperationContext_5__enter__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__enter__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__enter__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_16OperationContext_4__enter__(((struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_16OperationContext_4__enter__(struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__enter__", 0);

  /* "pkcs11/_pkcs11.pyx":572
 * 
 *     def __enter__(self):
 *         self.session.operation_lock.acquire()             # <<<<<<<<<<<<<<
 *         self.active = True
 *         self._initiate()
*/
  __pyx_t_2 = __pyx_v_self->session->operation_lock;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_acquire, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 572, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":573
 *     def __enter__(self):
 *         self.session.operation_lock.acquire()
 *         self.active = True             # <<<<<<<<<<<<<<
 *         self._initiate()
 *         return self
*/
  __pyx_v_self->active = 1;

  /* "pkcs11/_pkcs11.pyx":574
 *         self.session.operation_lock.acquire()
 *         self.active = True
 *         self._initiate()             # <<<<<<<<<<<<<<
 *         return self
 * 
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_initiate, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 574, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":575
 *         self.active = True
 *         self._initiate()
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":571
 *         pass
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         self.session.operation_lock.acquire()
 *         self.active = True
*/

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

/* "pkcs11/_pkcs11.pyx":577
 *         return self
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         self._finalize(silent=False)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_16OperationContext_7__exit__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_16OperationContext_7__exit__ = {"__exit__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_16OperationContext_7__exit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_16OperationContext_7__exit__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_exc_type = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc_val = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc_tb = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_exc_type,&__pyx_mstate_global->__pyx_n_u_exc_val,&__pyx_mstate_global->__pyx_n_u_exc_tb,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 577, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 577, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 577, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 577, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__exit__", 0) < (0)) __PYX_ERR(0, 577, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, i); __PYX_ERR(0, 577, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 577, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 577, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 577, __pyx_L3_error)
    }
    __pyx_v_exc_type = values[0];
    __pyx_v_exc_val = values[1];
    __pyx_v_exc_tb = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 577, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.OperationContext.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_16OperationContext_6__exit__(((struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *)__pyx_v_self), __pyx_v_exc_type, __pyx_v_exc_val, __pyx_v_exc_tb);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_16OperationContext_6__exit__(struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_val, CYTHON_UNUSED PyObject *__pyx_v_exc_tb) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__exit__", 0);

  /* "pkcs11/_pkcs11.pyx":578
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):
 *         self._finalize(silent=False)             # <<<<<<<<<<<<<<
 * 
 *     cdef _handle_final_retval(self, CK_RV retval) with gil:
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, NULL};
    __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 578, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_silent, Py_False, __pyx_t_4, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 578, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_finalize, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 578, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":577
 *         return self
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         self._finalize(silent=False)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pkcs11._pkcs11.OperationContext.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":580
 *         self._finalize(silent=False)
 * 
 *     cdef _handle_final_retval(self, CK_RV retval) with gil:             # <<<<<<<<<<<<<<
 *         self.active = False
 *         self.session.operation_lock.release()
*/

static PyObject *__pyx_f_6pkcs11_7_pkcs11_16OperationContext__handle_final_retval(struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *__pyx_v_self, CK_RV __pyx_v_retval) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_handle_final_retval", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_self);

  /* "pkcs11/_pkcs11.pyx":581
 * 
 *     cdef _handle_final_retval(self, CK_RV retval) with gil:
 *         self.active = False             # <<<<<<<<<<<<<<
 *         self.session.operation_lock.release()
 *         assertRV(retval)
*/
  __pyx_v_self->active = 0;

  /* "pkcs11/_pkcs11.pyx":582
 *     cdef _handle_final_retval(self, CK_RV retval) with gil:
 *         self.active = False
 *         self.session.operation_lock.release()             # <<<<<<<<<<<<<<
 *         assertRV(retval)
 * 
*/
  __pyx_t_2 = __pyx_v_self->session->operation_lock;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_release, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 582, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":583
 *         self.active = False
 *         self.session.operation_lock.release()
 *         assertRV(retval)             # <<<<<<<<<<<<<<
 * 
 *     cdef _operation_aware_assert(self, CK_RV retval) with gil:
*/
  __pyx_t_1 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 583, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 583, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pkcs11/_pkcs11.pyx":580
 *         self._finalize(silent=False)
 * 
 *     cdef _handle_final_retval(self, CK_RV retval) with gil:             # <<<<<<<<<<<<<<
 *         self.active = False
 *         self.session.operation_lock.release()
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pkcs11._pkcs11.OperationContext._handle_final_retval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":585
 *         assertRV(retval)
 * 
 *     cdef _operation_aware_assert(self, CK_RV retval) with gil:             # <<<<<<<<<<<<<<
 *         if retval != CKR_BUFFER_TOO_SMALL and retval != CKR_OK:
 *             # This is an error that terminated the operation
*/

static PyObject *__pyx_f_6pkcs11_7_pkcs11_16OperationContext__operation_aware_assert(struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *__pyx_v_self, CK_RV __pyx_v_retval) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_operation_aware_assert", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_self);

  /* "pkcs11/_pkcs11.pyx":586
 * 
 *     cdef _operation_aware_assert(self, CK_RV retval) with gil:
 *         if retval != CKR_BUFFER_TOO_SMALL and retval != CKR_OK:             # <<<<<<<<<<<<<<
 *             # This is an error that terminated the operation
 *             # We flag the operation as completed on our end as well.
*/
  switch (__pyx_v_retval) {
    case CKR_BUFFER_TOO_SMALL:
    case CKR_OK:
    __pyx_t_1 = 0;
    break;
    default:
    __pyx_t_1 = 1;
    break;
  }
  if (__pyx_t_1) {

    /* "pkcs11/_pkcs11.pyx":591
 *             # This is useful to track because there's no way to cleanly cancel
 *             # cryptographic operations in PCKS#11 2.x.
 *             self._handle_final_retval(retval)             # <<<<<<<<<<<<<<
 * 
 *     def _initiate(self):
*/
    __pyx_t_2 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_OperationContext *)__pyx_v_self->__pyx_vtab)->_handle_final_retval(__pyx_v_self, __pyx_v_retval); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 591, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pkcs11/_pkcs11.pyx":586
 * 
 *     cdef _operation_aware_assert(self, CK_RV retval) with gil:
 *         if retval != CKR_BUFFER_TOO_SMALL and retval != CKR_OK:             # <<<<<<<<<<<<<<
 *             # This is an error that terminated the operation
 *             # We flag the operation as completed on our end as well.
*/
  }

  /* "pkcs11/_pkcs11.pyx":585
 *         assertRV(retval)
 * 
 *     cdef _operation_aware_assert(self, CK_RV retval) with gil:             # <<<<<<<<<<<<<<
 *         if retval != CKR_BUFFER_TOO_SMALL and retval != CKR_OK:
 *             # This is an error that terminated the operation
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pkcs11._pkcs11.OperationContext._operation_aware_assert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":593
 *             self._handle_final_retval(retval)
 * 
 *     def _initiate(self):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_16OperationContext_9_initiate(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_16OperationContext_9_initiate = {"_initiate", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_16OperationContext_9_initiate, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_16OperationContext_9_initiate(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_initiate (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("_initiate", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("_initiate", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_16OperationContext_8_initiate(((struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_16OperationContext_8_initiate(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_initiate", 0);

  /* "pkcs11/_pkcs11.pyx":594
 * 
 *     def _initiate(self):
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def _finalize(self, silent=False):
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_NotImplementedError))), 0, 0, 0);
  __PYX_ERR(0, 594, __pyx_L1_error)

  /* "pkcs11/_pkcs11.pyx":593
 *             self._handle_final_retval(retval)
 * 
 *     def _initiate(self):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.OperationContext._initiate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":596
 *         raise NotImplementedError
 * 
 *     def _finalize(self, silent=False):             # <<<<<<<<<<<<<<
 *         if self.active:
 *             self.active = False
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_16OperationContext_11_finalize(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_16OperationContext_11_finalize = {"_finalize", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_16OperationContext_11_finalize, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_16OperationContext_11_finalize(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_silent = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_finalize (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_silent,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 596, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 596, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_finalize", 0) < (0)) __PYX_ERR(0, 596, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_False));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 596, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_False));
    }
    __pyx_v_silent = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_finalize", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 596, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.OperationContext._finalize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_16OperationContext_10_finalize(((struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *)__pyx_v_self), __pyx_v_silent);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_16OperationContext_10_finalize(struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_silent) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_finalize", 0);

  /* "pkcs11/_pkcs11.pyx":597
 * 
 *     def _finalize(self, silent=False):
 *         if self.active:             # <<<<<<<<<<<<<<
 *             self.active = False
 *             self.session.operation_lock.release()
*/
  if (__pyx_v_self->active) {

    /* "pkcs11/_pkcs11.pyx":598
 *     def _finalize(self, silent=False):
 *         if self.active:
 *             self.active = False             # <<<<<<<<<<<<<<
 *             self.session.operation_lock.release()
 * 
*/
    __pyx_v_self->active = 0;

    /* "pkcs11/_pkcs11.pyx":599
 *         if self.active:
 *             self.active = False
 *             self.session.operation_lock.release()             # <<<<<<<<<<<<<<
 * 
 *     def __del__(self):
*/
    __pyx_t_2 = __pyx_v_self->session->operation_lock;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_release, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 599, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pyx":597
 * 
 *     def _finalize(self, silent=False):
 *         if self.active:             # <<<<<<<<<<<<<<
 *             self.active = False
 *             self.session.operation_lock.release()
*/
  }

  /* "pkcs11/_pkcs11.pyx":596
 *         raise NotImplementedError
 * 
 *     def _finalize(self, silent=False):             # <<<<<<<<<<<<<<
 *         if self.active:
 *             self.active = False
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pkcs11._pkcs11.OperationContext._finalize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":601
 *             self.session.operation_lock.release()
 * 
 *     def __del__(self):             # <<<<<<<<<<<<<<
 *         self._finalize()
 * 
*/

/* Python wrapper */
static void __pyx_pw_6pkcs11_7_pkcs11_16OperationContext_13__del__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_6pkcs11_7_pkcs11_16OperationContext_13__del__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_6pkcs11_7_pkcs11_16OperationContext_12__del__(((struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *)__pyx_v_self));

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

static void __pyx_pf_6pkcs11_7_pkcs11_16OperationContext_12__del__(struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__del__", 0);

  /* "pkcs11/_pkcs11.pyx":602
 * 
 *     def __del__(self):
 *         self._finalize()             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_finalize, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 602, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":601
 *             self.session.operation_lock.release()
 * 
 *     def __del__(self):             # <<<<<<<<<<<<<<
 *         self._finalize()
 * 
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("pkcs11._pkcs11.OperationContext.__del__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

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

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_16OperationContext_15__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_16OperationContext_15__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_16OperationContext_15__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_16OperationContext_15__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_16OperationContext_14__reduce_cython__(((struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_16OperationContext_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 2, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.OperationContext.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_16OperationContext_17__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_16OperationContext_17__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_16OperationContext_17__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_16OperationContext_17__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.OperationContext.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_16OperationContext_16__setstate_cython__(((struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *)__pyx_v_self), __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_16OperationContext_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 4, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.OperationContext.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":613
 *     cdef CK_BYTE [:] output_buf
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef OperationWithBinaryOutput _setup(
 *             type cls,
*/

static struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *__pyx_f_6pkcs11_7_pkcs11_25OperationWithBinaryOutput__setup(PyTypeObject *__pyx_v_cls, struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_mech, CK_ULONG __pyx_v_buffer_size) {
  struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *__pyx_v_op = 0;
  struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_setup", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_cls);
  __Pyx_INCREF((PyObject *)__pyx_v_session);
  __Pyx_INCREF((PyObject *)__pyx_v_mech);

  /* "pkcs11/_pkcs11.pyx":620
 *             CK_ULONG buffer_size
 *     ) with gil:
 *         cdef OperationWithBinaryOutput op = cls.__new__(cls, session)             # <<<<<<<<<<<<<<
 *         op.mech = mech
 *         if buffer_size > 0:
*/
  if (unlikely(((PyObject *)__pyx_v_cls) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object.__new__(X): X is not a type object (NoneType)");
    __PYX_ERR(0, 620, __pyx_L1_error)
  }
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF((PyObject *)__pyx_v_session);
  __Pyx_GIVEREF((PyObject *)__pyx_v_session);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_session)) != (0)) __PYX_ERR(0, 620, __pyx_L1_error);
  __pyx_t_2 = __Pyx_tp_new(((PyObject *)__pyx_v_cls), ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_OperationWithBinaryOutput)))) __PYX_ERR(0, 620, __pyx_L1_error)
  __pyx_v_op = ((struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pkcs11/_pkcs11.pyx":621
 *     ) with gil:
 *         cdef OperationWithBinaryOutput op = cls.__new__(cls, session)
 *         op.mech = mech             # <<<<<<<<<<<<<<
 *         if buffer_size > 0:
 *             op.output_buf = CK_BYTE_buffer(buffer_size)
*/
  __Pyx_INCREF((PyObject *)__pyx_v_mech);
  __Pyx_GIVEREF((PyObject *)__pyx_v_mech);
  __Pyx_GOTREF((PyObject *)__pyx_v_op->mech);
  __Pyx_DECREF((PyObject *)__pyx_v_op->mech);
  __pyx_v_op->mech = __pyx_v_mech;

  /* "pkcs11/_pkcs11.pyx":622
 *         cdef OperationWithBinaryOutput op = cls.__new__(cls, session)
 *         op.mech = mech
 *         if buffer_size > 0:             # <<<<<<<<<<<<<<
 *             op.output_buf = CK_BYTE_buffer(buffer_size)
 *         op.buffer_size = buffer_size
*/
  __pyx_t_3 = (__pyx_v_buffer_size > 0);
  if (__pyx_t_3) {

    /* "pkcs11/_pkcs11.pyx":623
 *         op.mech = mech
 *         if buffer_size > 0:
 *             op.output_buf = CK_BYTE_buffer(buffer_size)             # <<<<<<<<<<<<<<
 *         op.buffer_size = buffer_size
 *         return op
*/
    __pyx_t_2 = __Pyx_PyLong_From_CK_ULONG(__pyx_v_buffer_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 623, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_f_6pkcs11_7_pkcs11_CK_BYTE_buffer(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 623, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn_CK_BYTE(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 623, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_XCLEAR_MEMVIEW(&__pyx_v_op->output_buf, 0);
    __pyx_v_op->output_buf = __pyx_t_4;
    __pyx_t_4.memview = NULL;
    __pyx_t_4.data = NULL;

    /* "pkcs11/_pkcs11.pyx":622
 *         cdef OperationWithBinaryOutput op = cls.__new__(cls, session)
 *         op.mech = mech
 *         if buffer_size > 0:             # <<<<<<<<<<<<<<
 *             op.output_buf = CK_BYTE_buffer(buffer_size)
 *         op.buffer_size = buffer_size
*/
  }

  /* "pkcs11/_pkcs11.pyx":624
 *         if buffer_size > 0:
 *             op.output_buf = CK_BYTE_buffer(buffer_size)
 *         op.buffer_size = buffer_size             # <<<<<<<<<<<<<<
 *         return op
 * 
*/
  __pyx_v_op->buffer_size = __pyx_v_buffer_size;

  /* "pkcs11/_pkcs11.pyx":625
 *             op.output_buf = CK_BYTE_buffer(buffer_size)
 *         op.buffer_size = buffer_size
 *         return op             # <<<<<<<<<<<<<<
 * 
 *     cdef resize_buffer(self, CK_ULONG length):
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_op);
  __pyx_r = __pyx_v_op;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":613
 *     cdef CK_BYTE [:] output_buf
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef OperationWithBinaryOutput _setup(
 *             type cls,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_4, 1);
  __Pyx_AddTraceback("pkcs11._pkcs11.OperationWithBinaryOutput._setup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_op);
  __Pyx_XDECREF((PyObject *)__pyx_v_cls);
  __Pyx_XDECREF((PyObject *)__pyx_v_session);
  __Pyx_XDECREF((PyObject *)__pyx_v_mech);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":627
 *         return op
 * 
 *     cdef resize_buffer(self, CK_ULONG length):             # <<<<<<<<<<<<<<
 *         self.output_buf = CK_BYTE_buffer(length)
 *         self.buffer_size = length
*/

static PyObject *__pyx_f_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_resize_buffer(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *__pyx_v_self, CK_ULONG __pyx_v_length) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resize_buffer", 0);

  /* "pkcs11/_pkcs11.pyx":628
 * 
 *     cdef resize_buffer(self, CK_ULONG length):
 *         self.output_buf = CK_BYTE_buffer(length)             # <<<<<<<<<<<<<<
 *         self.buffer_size = length
 * 
*/
  __pyx_t_1 = __Pyx_PyLong_From_CK_ULONG(__pyx_v_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_6pkcs11_7_pkcs11_CK_BYTE_buffer(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn_CK_BYTE(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 628, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_self->output_buf, 0);
  __pyx_v_self->output_buf = __pyx_t_3;
  __pyx_t_3.memview = NULL;
  __pyx_t_3.data = NULL;

  /* "pkcs11/_pkcs11.pyx":629
 *     cdef resize_buffer(self, CK_ULONG length):
 *         self.output_buf = CK_BYTE_buffer(length)
 *         self.buffer_size = length             # <<<<<<<<<<<<<<
 * 
 *     cdef inline bytes current_output(self):
*/
  __pyx_v_self->buffer_size = __pyx_v_length;

  /* "pkcs11/_pkcs11.pyx":627
 *         return op
 * 
 *     cdef resize_buffer(self, CK_ULONG length):             # <<<<<<<<<<<<<<
 *         self.output_buf = CK_BYTE_buffer(length)
 *         self.buffer_size = length
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_3, 1);
  __Pyx_AddTraceback("pkcs11._pkcs11.OperationWithBinaryOutput.resize_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":631
 *         self.buffer_size = length
 * 
 *     cdef inline bytes current_output(self):             # <<<<<<<<<<<<<<
 *         return bytes(self.output_buf[:self.buffer_data_length])
 * 
*/

static CYTHON_INLINE PyObject *__pyx_f_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_current_output(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("current_output", 0);

  /* "pkcs11/_pkcs11.pyx":632
 * 
 *     cdef inline bytes current_output(self):
 *         return bytes(self.output_buf[:self.buffer_data_length])             # <<<<<<<<<<<<<<
 * 
 *     cdef CK_RV update_resizing_output(
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  if (unlikely(!__pyx_v_self->output_buf.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 632, __pyx_L1_error)}
  __pyx_t_3.data = __pyx_v_self->output_buf.data;
  __pyx_t_3.memview = __pyx_v_self->output_buf.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_3, 1);
  __pyx_t_4 = -1;
  if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_3,
    __pyx_v_self->output_buf.shape[0], __pyx_v_self->output_buf.strides[0], __pyx_v_self->output_buf.suboffsets[0],
    0,
    0,
    &__pyx_t_4,
    0,
    __pyx_v_self->buffer_data_length,
    0,
    0,
    1,
    0,
    1) < 0))
{
    __PYX_ERR(0, 632, __pyx_L1_error)
}

__pyx_t_5 = __pyx_memoryview_fromslice(__pyx_t_3, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn_CK_BYTE, (int (*)(char *, PyObject *)) __pyx_memview_set_nn_CK_BYTE, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 632, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_3, 1);
  __pyx_t_3.memview = NULL; __pyx_t_3.data = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(&PyBytes_Type), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 632, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":631
 *         self.buffer_size = length
 * 
 *     cdef inline bytes current_output(self):             # <<<<<<<<<<<<<<
 *         return bytes(self.output_buf[:self.buffer_data_length])
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_3, 1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pkcs11._pkcs11.OperationWithBinaryOutput.current_output", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":634
 *         return bytes(self.output_buf[:self.buffer_data_length])
 * 
 *     cdef CK_RV update_resizing_output(             # <<<<<<<<<<<<<<
 *             self,
 *             OperationUpdateWithResult op_update,
*/

static CK_RV __pyx_f_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_update_resizing_output(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *__pyx_v_self, __pyx_t_6pkcs11_7_pkcs11_OperationUpdateWithResult __pyx_v_op_update, CK_BYTE *__pyx_v_data, CK_ULONG __pyx_v_data_len) {
  CK_ULONG __pyx_v_length;
  CK_BYTE *__pyx_v_output_buf_loc;
  CK_RV __pyx_v_retval;
  CK_RV __pyx_r;
  __Pyx_RefNannyDeclarations
  CK_ULONG __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  CK_RV __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("update_resizing_output", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_self);

  /* "pkcs11/_pkcs11.pyx":641
 *     ) with gil:
 * 
 *         cdef CK_ULONG length = self.buffer_size             # <<<<<<<<<<<<<<
 *         cdef CK_BYTE *output_buf_loc = &self.output_buf[0]
 *         cdef CK_RV retval
*/
  __pyx_t_1 = __pyx_v_self->buffer_size;
  __pyx_v_length = __pyx_t_1;

  /* "pkcs11/_pkcs11.pyx":642
 * 
 *         cdef CK_ULONG length = self.buffer_size
 *         cdef CK_BYTE *output_buf_loc = &self.output_buf[0]             # <<<<<<<<<<<<<<
 *         cdef CK_RV retval
 * 
*/
  if (unlikely(!__pyx_v_self->output_buf.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 642, __pyx_L1_error)}
  __pyx_t_2 = 0;
  __pyx_t_3 = -1;
  if (__pyx_t_2 < 0) {
    __pyx_t_2 += __pyx_v_self->output_buf.shape[0];
    if (unlikely(__pyx_t_2 < 0)) __pyx_t_3 = 0;
  } else if (unlikely(__pyx_t_2 >= __pyx_v_self->output_buf.shape[0])) __pyx_t_3 = 0;
  if (unlikely(__pyx_t_3 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_3);
    __PYX_ERR(0, 642, __pyx_L1_error)
  }
  __pyx_v_output_buf_loc = (&(*((CK_BYTE *) ( /* dim=0 */ (__pyx_v_self->output_buf.data + __pyx_t_2 * __pyx_v_self->output_buf.strides[0]) ))));

  /* "pkcs11/_pkcs11.pyx":645
 *         cdef CK_RV retval
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = op_update(
 *                 self.session.handle, data, data_len, NULL, &length
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":646
 * 
 *         with nogil:
 *             retval = op_update(             # <<<<<<<<<<<<<<
 *                 self.session.handle, data, data_len, NULL, &length
 *             )
*/
        __pyx_t_4 = __pyx_v_op_update(__pyx_v_self->__pyx_base.session->handle, __pyx_v_data, __pyx_v_data_len, NULL, (&__pyx_v_length)); if (unlikely(__Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 646, __pyx_L4_error)
        __pyx_v_retval = __pyx_t_4;
      }

      /* "pkcs11/_pkcs11.pyx":645
 *         cdef CK_RV retval
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = op_update(
 *                 self.session.handle, data, data_len, NULL, &length
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L5;
        }
        __pyx_L4_error: {
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L1_error;
        }
        __pyx_L5:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":650
 *             )
 * 
 *         if retval != CKR_OK:             # <<<<<<<<<<<<<<
 *             return retval
 * 
*/
  __pyx_t_5 = (__pyx_v_retval != CKR_OK);
  if (__pyx_t_5) {

    /* "pkcs11/_pkcs11.pyx":651
 * 
 *         if retval != CKR_OK:
 *             return retval             # <<<<<<<<<<<<<<
 * 
 *         if length > self.buffer_size:
*/
    __pyx_r = __pyx_v_retval;
    goto __pyx_L0;

    /* "pkcs11/_pkcs11.pyx":650
 *             )
 * 
 *         if retval != CKR_OK:             # <<<<<<<<<<<<<<
 *             return retval
 * 
*/
  }

  /* "pkcs11/_pkcs11.pyx":653
 *             return retval
 * 
 *         if length > self.buffer_size:             # <<<<<<<<<<<<<<
 *             self.resize_buffer(length)
 *             output_buf_loc = &self.output_buf[0]
*/
  __pyx_t_5 = (__pyx_v_length > __pyx_v_self->buffer_size);
  if (__pyx_t_5) {

    /* "pkcs11/_pkcs11.pyx":654
 * 
 *         if length > self.buffer_size:
 *             self.resize_buffer(length)             # <<<<<<<<<<<<<<
 *             output_buf_loc = &self.output_buf[0]
 * 
*/
    __pyx_t_6 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_OperationWithBinaryOutput *)__pyx_v_self->__pyx_base.__pyx_vtab)->resize_buffer(__pyx_v_self, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 654, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "pkcs11/_pkcs11.pyx":655
 *         if length > self.buffer_size:
 *             self.resize_buffer(length)
 *             output_buf_loc = &self.output_buf[0]             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
*/
    if (unlikely(!__pyx_v_self->output_buf.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 655, __pyx_L1_error)}
    __pyx_t_2 = 0;
    __pyx_t_3 = -1;
    if (__pyx_t_2 < 0) {
      __pyx_t_2 += __pyx_v_self->output_buf.shape[0];
      if (unlikely(__pyx_t_2 < 0)) __pyx_t_3 = 0;
    } else if (unlikely(__pyx_t_2 >= __pyx_v_self->output_buf.shape[0])) __pyx_t_3 = 0;
    if (unlikely(__pyx_t_3 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_3);
      __PYX_ERR(0, 655, __pyx_L1_error)
    }
    __pyx_v_output_buf_loc = (&(*((CK_BYTE *) ( /* dim=0 */ (__pyx_v_self->output_buf.data + __pyx_t_2 * __pyx_v_self->output_buf.strides[0]) ))));

    /* "pkcs11/_pkcs11.pyx":653
 *             return retval
 * 
 *         if length > self.buffer_size:             # <<<<<<<<<<<<<<
 *             self.resize_buffer(length)
 *             output_buf_loc = &self.output_buf[0]
*/
  }

  /* "pkcs11/_pkcs11.pyx":657
 *             output_buf_loc = &self.output_buf[0]
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = op_update(
 *                 self.session.handle, data, data_len, output_buf_loc, &length
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":658
 * 
 *         with nogil:
 *             retval = op_update(             # <<<<<<<<<<<<<<
 *                 self.session.handle, data, data_len, output_buf_loc, &length
 *             )
*/
        __pyx_t_4 = __pyx_v_op_update(__pyx_v_self->__pyx_base.session->handle, __pyx_v_data, __pyx_v_data_len, __pyx_v_output_buf_loc, (&__pyx_v_length)); if (unlikely(__Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 658, __pyx_L9_error)
        __pyx_v_retval = __pyx_t_4;
      }

      /* "pkcs11/_pkcs11.pyx":657
 *             output_buf_loc = &self.output_buf[0]
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = op_update(
 *                 self.session.handle, data, data_len, output_buf_loc, &length
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L10;
        }
        __pyx_L9_error: {
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L1_error;
        }
        __pyx_L10:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":661
 *                 self.session.handle, data, data_len, output_buf_loc, &length
 *             )
 *         self.buffer_data_length = length             # <<<<<<<<<<<<<<
 *         return retval
 * 
*/
  __pyx_v_self->buffer_data_length = __pyx_v_length;

  /* "pkcs11/_pkcs11.pyx":662
 *             )
 *         self.buffer_data_length = length
 *         return retval             # <<<<<<<<<<<<<<
 * 
 *     cdef CK_RV execute_resizing_output(self, OperationWithResult op) with gil:
*/
  __pyx_r = __pyx_v_retval;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":634
 *         return bytes(self.output_buf[:self.buffer_data_length])
 * 
 *     cdef CK_RV update_resizing_output(             # <<<<<<<<<<<<<<
 *             self,
 *             OperationUpdateWithResult op_update,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pkcs11._pkcs11.OperationWithBinaryOutput.update_resizing_output", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = (CK_RV) 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_self);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":664
 *         return retval
 * 
 *     cdef CK_RV execute_resizing_output(self, OperationWithResult op) with gil:             # <<<<<<<<<<<<<<
 * 
 *         cdef CK_ULONG length = self.buffer_size
*/

static CK_RV __pyx_f_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_execute_resizing_output(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *__pyx_v_self, __pyx_t_6pkcs11_7_pkcs11_OperationWithResult __pyx_v_op) {
  CK_ULONG __pyx_v_length;
  CK_BYTE *__pyx_v_output_buf_loc;
  CK_RV __pyx_v_retval;
  CK_RV __pyx_r;
  __Pyx_RefNannyDeclarations
  CK_ULONG __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  CK_RV __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("execute_resizing_output", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_self);

  /* "pkcs11/_pkcs11.pyx":666
 *     cdef CK_RV execute_resizing_output(self, OperationWithResult op) with gil:
 * 
 *         cdef CK_ULONG length = self.buffer_size             # <<<<<<<<<<<<<<
 *         cdef CK_BYTE *output_buf_loc = &self.output_buf[0]
 *         cdef CK_RV retval
*/
  __pyx_t_1 = __pyx_v_self->buffer_size;
  __pyx_v_length = __pyx_t_1;

  /* "pkcs11/_pkcs11.pyx":667
 * 
 *         cdef CK_ULONG length = self.buffer_size
 *         cdef CK_BYTE *output_buf_loc = &self.output_buf[0]             # <<<<<<<<<<<<<<
 *         cdef CK_RV retval
 * 
*/
  if (unlikely(!__pyx_v_self->output_buf.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 667, __pyx_L1_error)}
  __pyx_t_2 = 0;
  __pyx_t_3 = -1;
  if (__pyx_t_2 < 0) {
    __pyx_t_2 += __pyx_v_self->output_buf.shape[0];
    if (unlikely(__pyx_t_2 < 0)) __pyx_t_3 = 0;
  } else if (unlikely(__pyx_t_2 >= __pyx_v_self->output_buf.shape[0])) __pyx_t_3 = 0;
  if (unlikely(__pyx_t_3 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_3);
    __PYX_ERR(0, 667, __pyx_L1_error)
  }
  __pyx_v_output_buf_loc = (&(*((CK_BYTE *) ( /* dim=0 */ (__pyx_v_self->output_buf.data + __pyx_t_2 * __pyx_v_self->output_buf.strides[0]) ))));

  /* "pkcs11/_pkcs11.pyx":670
 *         cdef CK_RV retval
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = op(self.session.handle, NULL, &length)
 * 
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":671
 * 
 *         with nogil:
 *             retval = op(self.session.handle, NULL, &length)             # <<<<<<<<<<<<<<
 * 
 *         if retval != CKR_OK:
*/
        __pyx_t_4 = __pyx_v_op(__pyx_v_self->__pyx_base.session->handle, NULL, (&__pyx_v_length)); if (unlikely(__Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 671, __pyx_L4_error)
        __pyx_v_retval = __pyx_t_4;
      }

      /* "pkcs11/_pkcs11.pyx":670
 *         cdef CK_RV retval
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = op(self.session.handle, NULL, &length)
 * 
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L5;
        }
        __pyx_L4_error: {
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L1_error;
        }
        __pyx_L5:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":673
 *             retval = op(self.session.handle, NULL, &length)
 * 
 *         if retval != CKR_OK:             # <<<<<<<<<<<<<<
 *             return retval
 * 
*/
  __pyx_t_5 = (__pyx_v_retval != CKR_OK);
  if (__pyx_t_5) {

    /* "pkcs11/_pkcs11.pyx":674
 * 
 *         if retval != CKR_OK:
 *             return retval             # <<<<<<<<<<<<<<
 * 
 *         if length > self.buffer_size:
*/
    __pyx_r = __pyx_v_retval;
    goto __pyx_L0;

    /* "pkcs11/_pkcs11.pyx":673
 *             retval = op(self.session.handle, NULL, &length)
 * 
 *         if retval != CKR_OK:             # <<<<<<<<<<<<<<
 *             return retval
 * 
*/
  }

  /* "pkcs11/_pkcs11.pyx":676
 *             return retval
 * 
 *         if length > self.buffer_size:             # <<<<<<<<<<<<<<
 *             self.resize_buffer(length)
 *             output_buf_loc = &self.output_buf[0]
*/
  __pyx_t_5 = (__pyx_v_length > __pyx_v_self->buffer_size);
  if (__pyx_t_5) {

    /* "pkcs11/_pkcs11.pyx":677
 * 
 *         if length > self.buffer_size:
 *             self.resize_buffer(length)             # <<<<<<<<<<<<<<
 *             output_buf_loc = &self.output_buf[0]
 * 
*/
    __pyx_t_6 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_OperationWithBinaryOutput *)__pyx_v_self->__pyx_base.__pyx_vtab)->resize_buffer(__pyx_v_self, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 677, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "pkcs11/_pkcs11.pyx":678
 *         if length > self.buffer_size:
 *             self.resize_buffer(length)
 *             output_buf_loc = &self.output_buf[0]             # <<<<<<<<<<<<<<
 * 
 * 
*/
    if (unlikely(!__pyx_v_self->output_buf.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 678, __pyx_L1_error)}
    __pyx_t_2 = 0;
    __pyx_t_3 = -1;
    if (__pyx_t_2 < 0) {
      __pyx_t_2 += __pyx_v_self->output_buf.shape[0];
      if (unlikely(__pyx_t_2 < 0)) __pyx_t_3 = 0;
    } else if (unlikely(__pyx_t_2 >= __pyx_v_self->output_buf.shape[0])) __pyx_t_3 = 0;
    if (unlikely(__pyx_t_3 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_3);
      __PYX_ERR(0, 678, __pyx_L1_error)
    }
    __pyx_v_output_buf_loc = (&(*((CK_BYTE *) ( /* dim=0 */ (__pyx_v_self->output_buf.data + __pyx_t_2 * __pyx_v_self->output_buf.strides[0]) ))));

    /* "pkcs11/_pkcs11.pyx":676
 *             return retval
 * 
 *         if length > self.buffer_size:             # <<<<<<<<<<<<<<
 *             self.resize_buffer(length)
 *             output_buf_loc = &self.output_buf[0]
*/
  }

  /* "pkcs11/_pkcs11.pyx":681
 * 
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = op(self.session.handle, output_buf_loc, &length)
 *         self.buffer_data_length = length
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":682
 * 
 *         with nogil:
 *             retval = op(self.session.handle, output_buf_loc, &length)             # <<<<<<<<<<<<<<
 *         self.buffer_data_length = length
 *         return retval
*/
        __pyx_t_4 = __pyx_v_op(__pyx_v_self->__pyx_base.session->handle, __pyx_v_output_buf_loc, (&__pyx_v_length)); if (unlikely(__Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 682, __pyx_L9_error)
        __pyx_v_retval = __pyx_t_4;
      }

      /* "pkcs11/_pkcs11.pyx":681
 * 
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = op(self.session.handle, output_buf_loc, &length)
 *         self.buffer_data_length = length
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L10;
        }
        __pyx_L9_error: {
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L1_error;
        }
        __pyx_L10:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":683
 *         with nogil:
 *             retval = op(self.session.handle, output_buf_loc, &length)
 *         self.buffer_data_length = length             # <<<<<<<<<<<<<<
 *         return retval
 * 
*/
  __pyx_v_self->buffer_data_length = __pyx_v_length;

  /* "pkcs11/_pkcs11.pyx":684
 *             retval = op(self.session.handle, output_buf_loc, &length)
 *         self.buffer_data_length = length
 *         return retval             # <<<<<<<<<<<<<<
 * 
 *     cdef bytes process_fully(
*/
  __pyx_r = __pyx_v_retval;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":664
 *         return retval
 * 
 *     cdef CK_RV execute_resizing_output(self, OperationWithResult op) with gil:             # <<<<<<<<<<<<<<
 * 
 *         cdef CK_ULONG length = self.buffer_size
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pkcs11._pkcs11.OperationWithBinaryOutput.execute_resizing_output", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = (CK_RV) 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_self);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":686
 *         return retval
 * 
 *     cdef bytes process_fully(             # <<<<<<<<<<<<<<
 *             self,
 *             OperationUpdateWithResult op,
*/

static PyObject *__pyx_f_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_process_fully(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *__pyx_v_self, __pyx_t_6pkcs11_7_pkcs11_OperationUpdateWithResult __pyx_v_op, CK_BYTE *__pyx_v_data, CK_ULONG __pyx_v_data_len) {
  CK_RV __pyx_v_retval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  CK_RV __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("process_fully", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_self);

  /* "pkcs11/_pkcs11.pyx":692
 *             CK_ULONG data_len
 *     ) with gil:
 *         cdef CK_RV retval = self.update_resizing_output(op, data, data_len)             # <<<<<<<<<<<<<<
 *         self._handle_final_retval(retval)
 *         return self.current_output()
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_OperationWithBinaryOutput *)__pyx_v_self->__pyx_base.__pyx_vtab)->update_resizing_output(__pyx_v_self, __pyx_v_op, __pyx_v_data, __pyx_v_data_len); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 692, __pyx_L1_error)
  __pyx_v_retval = __pyx_t_1;

  /* "pkcs11/_pkcs11.pyx":693
 *     ) with gil:
 *         cdef CK_RV retval = self.update_resizing_output(op, data, data_len)
 *         self._handle_final_retval(retval)             # <<<<<<<<<<<<<<
 *         return self.current_output()
 * 
*/
  __pyx_t_2 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_OperationWithBinaryOutput *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._handle_final_retval(((struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *)__pyx_v_self), __pyx_v_retval); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 693, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pkcs11/_pkcs11.pyx":694
 *         cdef CK_RV retval = self.update_resizing_output(op, data, data_len)
 *         self._handle_final_retval(retval)
 *         return self.current_output()             # <<<<<<<<<<<<<<
 * 
 *     cdef bytes update_with_result(
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_current_output(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":686
 *         return retval
 * 
 *     cdef bytes process_fully(             # <<<<<<<<<<<<<<
 *             self,
 *             OperationUpdateWithResult op,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pkcs11._pkcs11.OperationWithBinaryOutput.process_fully", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":696
 *         return self.current_output()
 * 
 *     cdef bytes update_with_result(             # <<<<<<<<<<<<<<
 *             self, OperationUpdateWithResult op, CK_BYTE *data, CK_ULONG data_len
 *     ) with gil:
*/

static PyObject *__pyx_f_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_update_with_result(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *__pyx_v_self, __pyx_t_6pkcs11_7_pkcs11_OperationUpdateWithResult __pyx_v_op, CK_BYTE *__pyx_v_data, CK_ULONG __pyx_v_data_len) {
  CK_RV __pyx_v_retval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  CK_RV __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("update_with_result", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_self);

  /* "pkcs11/_pkcs11.pyx":699
 *             self, OperationUpdateWithResult op, CK_BYTE *data, CK_ULONG data_len
 *     ) with gil:
 *         cdef CK_RV retval = self.update_resizing_output(op, data, data_len)             # <<<<<<<<<<<<<<
 *         self._operation_aware_assert(retval)
 *         return self.current_output()
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_OperationWithBinaryOutput *)__pyx_v_self->__pyx_base.__pyx_vtab)->update_resizing_output(__pyx_v_self, __pyx_v_op, __pyx_v_data, __pyx_v_data_len); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 699, __pyx_L1_error)
  __pyx_v_retval = __pyx_t_1;

  /* "pkcs11/_pkcs11.pyx":700
 *     ) with gil:
 *         cdef CK_RV retval = self.update_resizing_output(op, data, data_len)
 *         self._operation_aware_assert(retval)             # <<<<<<<<<<<<<<
 *         return self.current_output()
 * 
*/
  __pyx_t_2 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_OperationWithBinaryOutput *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._operation_aware_assert(((struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *)__pyx_v_self), __pyx_v_retval); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pkcs11/_pkcs11.pyx":701
 *         cdef CK_RV retval = self.update_resizing_output(op, data, data_len)
 *         self._operation_aware_assert(retval)
 *         return self.current_output()             # <<<<<<<<<<<<<<
 * 
 *     cdef update_no_output(
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_current_output(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 701, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":696
 *         return self.current_output()
 * 
 *     cdef bytes update_with_result(             # <<<<<<<<<<<<<<
 *             self, OperationUpdateWithResult op, CK_BYTE *data, CK_ULONG data_len
 *     ) with gil:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pkcs11._pkcs11.OperationWithBinaryOutput.update_with_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":703
 *         return self.current_output()
 * 
 *     cdef update_no_output(             # <<<<<<<<<<<<<<
 *             self, OperationUpdate op, CK_BYTE *data, CK_ULONG data_len
 *     ) with gil:
*/

static PyObject *__pyx_f_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_update_no_output(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *__pyx_v_self, __pyx_t_6pkcs11_7_pkcs11_OperationUpdate __pyx_v_op, CK_BYTE *__pyx_v_data, CK_ULONG __pyx_v_data_len) {
  CK_RV __pyx_v_retval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  CK_RV __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("update_no_output", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_self);

  /* "pkcs11/_pkcs11.pyx":707
 *     ) with gil:
 *         cdef CK_RV retval
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = op(self.session.handle, data, data_len)
 *         self._operation_aware_assert(retval)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":708
 *         cdef CK_RV retval
 *         with nogil:
 *             retval = op(self.session.handle, data, data_len)             # <<<<<<<<<<<<<<
 *         self._operation_aware_assert(retval)
 * 
*/
        __pyx_t_1 = __pyx_v_op(__pyx_v_self->__pyx_base.session->handle, __pyx_v_data, __pyx_v_data_len); if (unlikely(__Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 708, __pyx_L4_error)
        __pyx_v_retval = __pyx_t_1;
      }

      /* "pkcs11/_pkcs11.pyx":707
 *     ) with gil:
 *         cdef CK_RV retval
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = op(self.session.handle, data, data_len)
 *         self._operation_aware_assert(retval)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L5;
        }
        __pyx_L4_error: {
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L1_error;
        }
        __pyx_L5:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":709
 *         with nogil:
 *             retval = op(self.session.handle, data, data_len)
 *         self._operation_aware_assert(retval)             # <<<<<<<<<<<<<<
 * 
 *     cdef bytes finish_with_output(self, OperationWithResult op_final) with gil:
*/
  __pyx_t_2 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_OperationWithBinaryOutput *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._operation_aware_assert(((struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *)__pyx_v_self), __pyx_v_retval); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 709, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pkcs11/_pkcs11.pyx":703
 *         return self.current_output()
 * 
 *     cdef update_no_output(             # <<<<<<<<<<<<<<
 *             self, OperationUpdate op, CK_BYTE *data, CK_ULONG data_len
 *     ) with gil:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pkcs11._pkcs11.OperationWithBinaryOutput.update_no_output", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":711
 *         self._operation_aware_assert(retval)
 * 
 *     cdef bytes finish_with_output(self, OperationWithResult op_final) with gil:             # <<<<<<<<<<<<<<
 *         cdef CK_RV retval = self.execute_resizing_output(op_final)
 *         self._handle_final_retval(retval)
*/

static PyObject *__pyx_f_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_finish_with_output(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *__pyx_v_self, __pyx_t_6pkcs11_7_pkcs11_OperationWithResult __pyx_v_op_final) {
  CK_RV __pyx_v_retval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  CK_RV __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("finish_with_output", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_self);

  /* "pkcs11/_pkcs11.pyx":712
 * 
 *     cdef bytes finish_with_output(self, OperationWithResult op_final) with gil:
 *         cdef CK_RV retval = self.execute_resizing_output(op_final)             # <<<<<<<<<<<<<<
 *         self._handle_final_retval(retval)
 *         return self.current_output()
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_OperationWithBinaryOutput *)__pyx_v_self->__pyx_base.__pyx_vtab)->execute_resizing_output(__pyx_v_self, __pyx_v_op_final); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 712, __pyx_L1_error)
  __pyx_v_retval = __pyx_t_1;

  /* "pkcs11/_pkcs11.pyx":713
 *     cdef bytes finish_with_output(self, OperationWithResult op_final) with gil:
 *         cdef CK_RV retval = self.execute_resizing_output(op_final)
 *         self._handle_final_retval(retval)             # <<<<<<<<<<<<<<
 *         return self.current_output()
 * 
*/
  __pyx_t_2 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_OperationWithBinaryOutput *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._handle_final_retval(((struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *)__pyx_v_self), __pyx_v_retval); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 713, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pkcs11/_pkcs11.pyx":714
 *         cdef CK_RV retval = self.execute_resizing_output(op_final)
 *         self._handle_final_retval(retval)
 *         return self.current_output()             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_current_output(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 714, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":711
 *         self._operation_aware_assert(retval)
 * 
 *     cdef bytes finish_with_output(self, OperationWithResult op_final) with gil:             # <<<<<<<<<<<<<<
 *         cdef CK_RV retval = self.execute_resizing_output(op_final)
 *         self._handle_final_retval(retval)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pkcs11._pkcs11.OperationWithBinaryOutput.finish_with_output", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_1__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_1__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_1__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_25OperationWithBinaryOutput___reduce_cython__(((struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_25OperationWithBinaryOutput___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 2, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.OperationWithBinaryOutput.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_3__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_3__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_3__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.OperationWithBinaryOutput.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_2__setstate_cython__(((struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *)__pyx_v_self), __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 4, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.OperationWithBinaryOutput.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":723
 *     cdef CK_ULONG batch_size
 * 
 *     def __init__(self, session, attrs, batch_size):             # <<<<<<<<<<<<<<
 *         cdef Session _session = session
 *         cdef AttributeList template = _session.make_attribute_list(attrs)
*/

/* Python wrapper */
static int __pyx_pw_6pkcs11_7_pkcs11_10SearchIter_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6pkcs11_7_pkcs11_10SearchIter_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_session = 0;
  PyObject *__pyx_v_attrs = 0;
  PyObject *__pyx_v_batch_size = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_session,&__pyx_mstate_global->__pyx_n_u_attrs,&__pyx_mstate_global->__pyx_n_u_batch_size,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 723, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 723, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 723, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 723, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 723, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, i); __PYX_ERR(0, 723, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 723, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 723, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 723, __pyx_L3_error)
    }
    __pyx_v_session = values[0];
    __pyx_v_attrs = values[1];
    __pyx_v_batch_size = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 723, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.SearchIter.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_10SearchIter___init__(((struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter *)__pyx_v_self), __pyx_v_session, __pyx_v_attrs, __pyx_v_batch_size);

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

static int __pyx_pf_6pkcs11_7_pkcs11_10SearchIter___init__(struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter *__pyx_v_self, PyObject *__pyx_v_session, PyObject *__pyx_v_attrs, PyObject *__pyx_v_batch_size) {
  struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v__session = 0;
  struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_template = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  CK_ULONG __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pkcs11/_pkcs11.pyx":724
 * 
 *     def __init__(self, session, attrs, batch_size):
 *         cdef Session _session = session             # <<<<<<<<<<<<<<
 *         cdef AttributeList template = _session.make_attribute_list(attrs)
 *         self.template = template
*/
  __pyx_t_1 = __pyx_v_session;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Session))))) __PYX_ERR(0, 724, __pyx_L1_error)
  __pyx_v__session = ((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":725
 *     def __init__(self, session, attrs, batch_size):
 *         cdef Session _session = session
 *         cdef AttributeList template = _session.make_attribute_list(attrs)             # <<<<<<<<<<<<<<
 *         self.template = template
 *         self.batch_size = batch_size
*/
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_Session *)__pyx_v__session->__pyx_vtab)->make_attribute_list(__pyx_v__session, __pyx_v_attrs)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_template = ((struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":726
 *         cdef Session _session = session
 *         cdef AttributeList template = _session.make_attribute_list(attrs)
 *         self.template = template             # <<<<<<<<<<<<<<
 *         self.batch_size = batch_size
 *         super().__init__(_session)
*/
  __Pyx_INCREF((PyObject *)__pyx_v_template);
  __Pyx_GIVEREF((PyObject *)__pyx_v_template);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->__pyx_template);
  __Pyx_DECREF((PyObject *)__pyx_v_self->__pyx_template);
  __pyx_v_self->__pyx_template = __pyx_v_template;

  /* "pkcs11/_pkcs11.pyx":727
 *         cdef AttributeList template = _session.make_attribute_list(attrs)
 *         self.template = template
 *         self.batch_size = batch_size             # <<<<<<<<<<<<<<
 *         super().__init__(_session)
 * 
*/
  __pyx_t_2 = __Pyx_PyLong_As_CK_ULONG(__pyx_v_batch_size); if (unlikely((__pyx_t_2 == ((CK_ULONG)-1)) && PyErr_Occurred())) __PYX_ERR(0, 727, __pyx_L1_error)
  __pyx_v_self->batch_size = __pyx_t_2;

  /* "pkcs11/_pkcs11.pyx":728
 *         self.template = template
 *         self.batch_size = batch_size
 *         super().__init__(_session)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
  __pyx_t_5 = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_5, ((PyObject *)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_SearchIter), ((PyObject *)__pyx_v_self)};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_super, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 728, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_3 = __pyx_t_4;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v__session)};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_init, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 728, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":723
 *     cdef CK_ULONG batch_size
 * 
 *     def __init__(self, session, attrs, batch_size):             # <<<<<<<<<<<<<<
 *         cdef Session _session = session
 *         cdef AttributeList template = _session.make_attribute_list(attrs)
*/

  /* function exit code */
  __pyx_r = 0;
  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_AddTraceback("pkcs11._pkcs11.SearchIter.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v__session);
  __Pyx_XDECREF((PyObject *)__pyx_v_template);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":730
 *         super().__init__(_session)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_10SearchIter_3__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_10SearchIter_3__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_10SearchIter_2__iter__(((struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_10SearchIter_2__iter__(struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "pkcs11/_pkcs11.pyx":731
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def _batch_iter(self, results, count):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":730
 *         super().__init__(_session)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6pkcs11_7_pkcs11_10SearchIter_6generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pkcs11/_pkcs11.pyx":733
 *         return self
 * 
 *     def _batch_iter(self, results, count):             # <<<<<<<<<<<<<<
 *         for ix in range(count):
 *             yield make_object(self.session, results[ix])
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_10SearchIter_5_batch_iter(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_10SearchIter_5_batch_iter = {"_batch_iter", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_10SearchIter_5_batch_iter, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_10SearchIter_5_batch_iter(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_results = 0;
  PyObject *__pyx_v_count = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_batch_iter (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_results,&__pyx_mstate_global->__pyx_n_u_count,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 733, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 733, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 733, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_batch_iter", 0) < (0)) __PYX_ERR(0, 733, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_batch_iter", 1, 2, 2, i); __PYX_ERR(0, 733, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 733, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 733, __pyx_L3_error)
    }
    __pyx_v_results = values[0];
    __pyx_v_count = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_batch_iter", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 733, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.SearchIter._batch_iter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_10SearchIter_4_batch_iter(((struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter *)__pyx_v_self), __pyx_v_results, __pyx_v_count);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_10SearchIter_4_batch_iter(struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter *__pyx_v_self, PyObject *__pyx_v_results, PyObject *__pyx_v_count) {
  struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_batch_iter", 0);
  __pyx_cur_scope = (struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter *)__pyx_tp_new_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 733, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_results = __pyx_v_results;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_results);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_results);
  __pyx_cur_scope->__pyx_v_count = __pyx_v_count;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_count);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_count);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6pkcs11_7_pkcs11_10SearchIter_6generator, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_batch_iter, __pyx_mstate_global->__pyx_n_u_SearchIter__batch_iter, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11); if (unlikely(!gen)) __PYX_ERR(0, 733, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.SearchIter._batch_iter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6pkcs11_7_pkcs11_10SearchIter_6generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter *__pyx_cur_scope = ((struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  CK_OBJECT_HANDLE __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_batch_iter", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(0, 733, __pyx_L1_error)
  }

  /* "pkcs11/_pkcs11.pyx":734
 * 
 *     def _batch_iter(self, results, count):
 *         for ix in range(count):             # <<<<<<<<<<<<<<
 *             yield make_object(self.session, results[ix])
 * 
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_cur_scope->__pyx_v_count};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 734, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 734, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 734, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 734, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_ix);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_ix, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pyx":735
 *     def _batch_iter(self, results, count):
 *         for ix in range(count):
 *             yield make_object(self.session, results[ix])             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
*/
    __pyx_t_1 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->__pyx_base.session);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_results, __pyx_cur_scope->__pyx_v_ix); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 735, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyLong_As_CK_ULONG(__pyx_t_5); if (unlikely((__pyx_t_6 == ((CK_OBJECT_HANDLE)-1)) && PyErr_Occurred())) __PYX_ERR(0, 735, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __pyx_f_6pkcs11_7_pkcs11_make_object(((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_t_1), __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 735, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    __Pyx_XGIVEREF(__pyx_t_2);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_2);
    __pyx_t_4 = __pyx_cur_scope->__pyx_t_1;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 735, __pyx_L1_error)

    /* "pkcs11/_pkcs11.pyx":734
 * 
 *     def _batch_iter(self, results, count):
 *         for ix in range(count):             # <<<<<<<<<<<<<<
 *             yield make_object(self.session, results[ix])
 * 
*/
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "pkcs11/_pkcs11.pyx":733
 *         return self
 * 
 *     def _batch_iter(self, results, count):             # <<<<<<<<<<<<<<
 *         for ix in range(count):
 *             yield make_object(self.session, results[ix])
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("_batch_iter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":737
 *             yield make_object(self.session, results[ix])
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         """Get the next batch of objects."""
 *         cdef CK_SESSION_HANDLE handle = self.session.handle
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_10SearchIter_8__next__(PyObject *__pyx_v_self); /*proto*/
PyDoc_STRVAR(__pyx_doc_6pkcs11_7_pkcs11_10SearchIter_7__next__, "Get the next batch of objects.");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_6pkcs11_7_pkcs11_10SearchIter_7__next__;
#endif
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_10SearchIter_8__next__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_10SearchIter_7__next__(((struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_10SearchIter_7__next__(struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter *__pyx_v_self) {
  CK_SESSION_HANDLE __pyx_v_handle;
  CK_ULONG __pyx_v_count;
  CK_RV __pyx_v_retval;
  __Pyx_memviewslice __pyx_v_results = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_error_without_exception = 0; /* StopIteration */
  CK_SESSION_HANDLE __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  size_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "pkcs11/_pkcs11.pyx":739
 *     def __next__(self):
 *         """Get the next batch of objects."""
 *         cdef CK_SESSION_HANDLE handle = self.session.handle             # <<<<<<<<<<<<<<
 *         cdef CK_OBJECT_HANDLE obj
 *         cdef CK_ULONG count
*/
  __pyx_t_1 = __pyx_v_self->__pyx_base.session->handle;
  __pyx_v_handle = __pyx_t_1;

  /* "pkcs11/_pkcs11.pyx":744
 *         cdef CK_RV retval
 * 
 *         cdef CK_OBJECT_HANDLE [:] results = CK_ULONG_buffer(self.batch_size)             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
*/
  __pyx_t_2 = __Pyx_PyLong_From_CK_ULONG(__pyx_v_self->batch_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 744, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_6pkcs11_7_pkcs11_CK_ULONG_buffer(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 744, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn_CK_OBJECT_HANDLE(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 744, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_results = __pyx_t_4;
  __pyx_t_4.memview = NULL;
  __pyx_t_4.data = NULL;

  /* "pkcs11/_pkcs11.pyx":746
 *         cdef CK_OBJECT_HANDLE [:] results = CK_ULONG_buffer(self.batch_size)
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.session.funclist.C_FindObjects(handle, &results[0], self.batch_size, &count)
 *         assertRV(retval)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":747
 * 
 *         with nogil:
 *             retval = self.session.funclist.C_FindObjects(handle, &results[0], self.batch_size, &count)             # <<<<<<<<<<<<<<
 *         assertRV(retval)
 * 
*/
        __pyx_t_5 = 0;
        __pyx_t_6 = -1;
        if (__pyx_t_5 < 0) {
          __pyx_t_5 += __pyx_v_results.shape[0];
          if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
        } else if (unlikely(__pyx_t_5 >= __pyx_v_results.shape[0])) __pyx_t_6 = 0;
        if (unlikely(__pyx_t_6 != -1)) {
          __Pyx_RaiseBufferIndexErrorNogil(__pyx_t_6);
          __PYX_ERR(0, 747, __pyx_L4_error)
        }
        __pyx_v_retval = __pyx_v_self->__pyx_base.session->__pyx_base.funclist->C_FindObjects(__pyx_v_handle, (&(*((CK_OBJECT_HANDLE *) ( /* dim=0 */ (__pyx_v_results.data + __pyx_t_5 * __pyx_v_results.strides[0]) )))), __pyx_v_self->batch_size, (&__pyx_v_count));
      }

      /* "pkcs11/_pkcs11.pyx":746
 *         cdef CK_OBJECT_HANDLE [:] results = CK_ULONG_buffer(self.batch_size)
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.session.funclist.C_FindObjects(handle, &results[0], self.batch_size, &count)
 *         assertRV(retval)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L5;
        }
        __pyx_L4_error: {
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L1_error;
        }
        __pyx_L5:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":748
 *         with nogil:
 *             retval = self.session.funclist.C_FindObjects(handle, &results[0], self.batch_size, &count)
 *         assertRV(retval)             # <<<<<<<<<<<<<<
 * 
 *         if count == 0:
*/
  __pyx_t_3 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 748, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 748, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pkcs11/_pkcs11.pyx":750
 *         assertRV(retval)
 * 
 *         if count == 0:             # <<<<<<<<<<<<<<
 *             self._finalize()
 *             raise StopIteration()
*/
  __pyx_t_7 = (__pyx_v_count == 0);
  if (unlikely(__pyx_t_7)) {

    /* "pkcs11/_pkcs11.pyx":751
 * 
 *         if count == 0:
 *             self._finalize()             # <<<<<<<<<<<<<<
 *             raise StopIteration()
 *         else:
*/
    __pyx_t_3 = ((PyObject *)__pyx_v_self);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_8 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_finalize, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 751, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pkcs11/_pkcs11.pyx":752
 *         if count == 0:
 *             self._finalize()
 *             raise StopIteration()             # <<<<<<<<<<<<<<
 *         else:
 *             return self._batch_iter(results, count)
*/
    __pyx_error_without_exception = 1;
    goto __pyx_L1_error;;

    /* "pkcs11/_pkcs11.pyx":750
 *         assertRV(retval)
 * 
 *         if count == 0:             # <<<<<<<<<<<<<<
 *             self._finalize()
 *             raise StopIteration()
*/
  }

  /* "pkcs11/_pkcs11.pyx":754
 *             raise StopIteration()
 *         else:
 *             return self._batch_iter(results, count)             # <<<<<<<<<<<<<<
 * 
 *     def _initiate(self):
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((PyObject *)__pyx_v_self);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_9 = __pyx_memoryview_fromslice(__pyx_v_results, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn_CK_OBJECT_HANDLE, (int (*)(char *, PyObject *)) __pyx_memview_set_nn_CK_OBJECT_HANDLE, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 754, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = __Pyx_PyLong_From_CK_ULONG(__pyx_v_count); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 754, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_8 = 0;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_t_9, __pyx_t_10};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_batch_iter, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 754, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "pkcs11/_pkcs11.pyx":737
 *             yield make_object(self.session, results[ix])
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         """Get the next batch of objects."""
 *         cdef CK_SESSION_HANDLE handle = self.session.handle
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_4, 1);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  if (!__pyx_error_without_exception) {
    __Pyx_AddTraceback("pkcs11._pkcs11.SearchIter.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_r = NULL;
  __pyx_L0:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_results, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":756
 *             return self._batch_iter(results, count)
 * 
 *     def _initiate(self):             # <<<<<<<<<<<<<<
 *         cdef CK_SESSION_HANDLE handle = self.session.handle
 *         cdef CK_ATTRIBUTE *attr_data = self.template.data
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_10SearchIter_10_initiate(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_10SearchIter_10_initiate = {"_initiate", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_10SearchIter_10_initiate, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_10SearchIter_10_initiate(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_initiate (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("_initiate", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("_initiate", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_10SearchIter_9_initiate(((struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_10SearchIter_9_initiate(struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter *__pyx_v_self) {
  CK_SESSION_HANDLE __pyx_v_handle;
  CK_ATTRIBUTE *__pyx_v_attr_data;
  CK_ULONG __pyx_v_attr_count;
  CK_RV __pyx_v_retval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  CK_SESSION_HANDLE __pyx_t_1;
  CK_ATTRIBUTE *__pyx_t_2;
  CK_ULONG __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_initiate", 0);

  /* "pkcs11/_pkcs11.pyx":757
 * 
 *     def _initiate(self):
 *         cdef CK_SESSION_HANDLE handle = self.session.handle             # <<<<<<<<<<<<<<
 *         cdef CK_ATTRIBUTE *attr_data = self.template.data
 *         cdef CK_ULONG attr_count = self.template.count
*/
  __pyx_t_1 = __pyx_v_self->__pyx_base.session->handle;
  __pyx_v_handle = __pyx_t_1;

  /* "pkcs11/_pkcs11.pyx":758
 *     def _initiate(self):
 *         cdef CK_SESSION_HANDLE handle = self.session.handle
 *         cdef CK_ATTRIBUTE *attr_data = self.template.data             # <<<<<<<<<<<<<<
 *         cdef CK_ULONG attr_count = self.template.count
 *         cdef CK_RV retval
*/
  __pyx_t_2 = __pyx_v_self->__pyx_template->data;
  __pyx_v_attr_data = __pyx_t_2;

  /* "pkcs11/_pkcs11.pyx":759
 *         cdef CK_SESSION_HANDLE handle = self.session.handle
 *         cdef CK_ATTRIBUTE *attr_data = self.template.data
 *         cdef CK_ULONG attr_count = self.template.count             # <<<<<<<<<<<<<<
 *         cdef CK_RV retval
 * 
*/
  __pyx_t_3 = __pyx_v_self->__pyx_template->count;
  __pyx_v_attr_count = __pyx_t_3;

  /* "pkcs11/_pkcs11.pyx":762
 *         cdef CK_RV retval
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.session.funclist.C_FindObjectsInit(handle, attr_data, attr_count)
 *         assertRV(retval)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":763
 * 
 *         with nogil:
 *             retval = self.session.funclist.C_FindObjectsInit(handle, attr_data, attr_count)             # <<<<<<<<<<<<<<
 *         assertRV(retval)
 * 
*/
        __pyx_v_retval = __pyx_v_self->__pyx_base.session->__pyx_base.funclist->C_FindObjectsInit(__pyx_v_handle, __pyx_v_attr_data, __pyx_v_attr_count);
      }

      /* "pkcs11/_pkcs11.pyx":762
 *         cdef CK_RV retval
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.session.funclist.C_FindObjectsInit(handle, attr_data, attr_count)
 *         assertRV(retval)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":764
 *         with nogil:
 *             retval = self.session.funclist.C_FindObjectsInit(handle, attr_data, attr_count)
 *         assertRV(retval)             # <<<<<<<<<<<<<<
 * 
 *     def _finalize(self, silent=False):
*/
  __pyx_t_4 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 764, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 764, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":756
 *             return self._batch_iter(results, count)
 * 
 *     def _initiate(self):             # <<<<<<<<<<<<<<
 *         cdef CK_SESSION_HANDLE handle = self.session.handle
 *         cdef CK_ATTRIBUTE *attr_data = self.template.data
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pkcs11._pkcs11.SearchIter._initiate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":766
 *         assertRV(retval)
 * 
 *     def _finalize(self, silent=False):             # <<<<<<<<<<<<<<
 *         """Finish the operation."""
 *         cdef CK_SESSION_HANDLE handle = self.session.handle
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_10SearchIter_12_finalize(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6pkcs11_7_pkcs11_10SearchIter_11_finalize, "Finish the operation.");
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_10SearchIter_12_finalize = {"_finalize", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_10SearchIter_12_finalize, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6pkcs11_7_pkcs11_10SearchIter_11_finalize};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_10SearchIter_12_finalize(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_silent = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_finalize (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_silent,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 766, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 766, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_finalize", 0) < (0)) __PYX_ERR(0, 766, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_False));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 766, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_False));
    }
    __pyx_v_silent = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_finalize", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 766, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.SearchIter._finalize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_10SearchIter_11_finalize(((struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter *)__pyx_v_self), __pyx_v_silent);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_10SearchIter_11_finalize(struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter *__pyx_v_self, PyObject *__pyx_v_silent) {
  CK_SESSION_HANDLE __pyx_v_handle;
  CK_RV __pyx_v_retval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  CK_SESSION_HANDLE __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_finalize", 0);

  /* "pkcs11/_pkcs11.pyx":768
 *     def _finalize(self, silent=False):
 *         """Finish the operation."""
 *         cdef CK_SESSION_HANDLE handle = self.session.handle             # <<<<<<<<<<<<<<
 *         cdef CK_RV retval
 * 
*/
  __pyx_t_1 = __pyx_v_self->__pyx_base.session->handle;
  __pyx_v_handle = __pyx_t_1;

  /* "pkcs11/_pkcs11.pyx":771
 *         cdef CK_RV retval
 * 
 *         if self.active:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 retval = self.session.funclist.C_FindObjectsFinal(handle)
*/
  if (__pyx_v_self->__pyx_base.active) {

    /* "pkcs11/_pkcs11.pyx":772
 * 
 *         if self.active:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 retval = self.session.funclist.C_FindObjectsFinal(handle)
 *             if not silent:
*/
    {
        PyThreadState * _save;
        _save = PyEval_SaveThread();
        __Pyx_FastGIL_Remember();
        /*try:*/ {

          /* "pkcs11/_pkcs11.pyx":773
 *         if self.active:
 *             with nogil:
 *                 retval = self.session.funclist.C_FindObjectsFinal(handle)             # <<<<<<<<<<<<<<
 *             if not silent:
 *                 self._handle_final_retval(retval)
*/
          __pyx_v_retval = __pyx_v_self->__pyx_base.session->__pyx_base.funclist->C_FindObjectsFinal(__pyx_v_handle);
        }

        /* "pkcs11/_pkcs11.pyx":772
 * 
 *         if self.active:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 retval = self.session.funclist.C_FindObjectsFinal(handle)
 *             if not silent:
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_FastGIL_Forget();
            PyEval_RestoreThread(_save);
            goto __pyx_L6;
          }
          __pyx_L6:;
        }
    }

    /* "pkcs11/_pkcs11.pyx":774
 *             with nogil:
 *                 retval = self.session.funclist.C_FindObjectsFinal(handle)
 *             if not silent:             # <<<<<<<<<<<<<<
 *                 self._handle_final_retval(retval)
 * 
*/
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_silent); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 774, __pyx_L1_error)
    __pyx_t_3 = (!__pyx_t_2);
    if (__pyx_t_3) {

      /* "pkcs11/_pkcs11.pyx":775
 *                 retval = self.session.funclist.C_FindObjectsFinal(handle)
 *             if not silent:
 *                 self._handle_final_retval(retval)             # <<<<<<<<<<<<<<
 * 
 * 
*/
      __pyx_t_4 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_SearchIter *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._handle_final_retval(((struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *)__pyx_v_self), __pyx_v_retval); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 775, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "pkcs11/_pkcs11.pyx":774
 *             with nogil:
 *                 retval = self.session.funclist.C_FindObjectsFinal(handle)
 *             if not silent:             # <<<<<<<<<<<<<<
 *                 self._handle_final_retval(retval)
 * 
*/
    }

    /* "pkcs11/_pkcs11.pyx":771
 *         cdef CK_RV retval
 * 
 *         if self.active:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 retval = self.session.funclist.C_FindObjectsFinal(handle)
*/
  }

  /* "pkcs11/_pkcs11.pyx":766
 *         assertRV(retval)
 * 
 *     def _finalize(self, silent=False):             # <<<<<<<<<<<<<<
 *         """Finish the operation."""
 *         cdef CK_SESSION_HANDLE handle = self.session.handle
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pkcs11._pkcs11.SearchIter._finalize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_10SearchIter_14__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_10SearchIter_14__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_10SearchIter_14__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_10SearchIter_14__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_10SearchIter_13__reduce_cython__(((struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_10SearchIter_13__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 2, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.SearchIter.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_10SearchIter_16__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_10SearchIter_16__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_10SearchIter_16__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_10SearchIter_16__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.SearchIter.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_10SearchIter_15__setstate_cython__(((struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter *)__pyx_v_self), __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_10SearchIter_15__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 4, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.SearchIter.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":780
 * cdef class DigestOperation(OperationWithBinaryOutput):
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef DigestOperation setup(
 *             Session session,
*/

static struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *__pyx_f_6pkcs11_7_pkcs11_15DigestOperation_setup(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_mech, CK_ULONG __pyx_v_buffer_size) {
  struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *__pyx_v_op = 0;
  struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("setup", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_session);
  __Pyx_INCREF((PyObject *)__pyx_v_mech);

  /* "pkcs11/_pkcs11.pyx":786
 *             CK_ULONG buffer_size
 *     ) with gil:
 *         cdef DigestOperation op = <DigestOperation> OperationWithBinaryOutput._setup(             # <<<<<<<<<<<<<<
 *             DigestOperation, session, mech, buffer_size
 *         )
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_6pkcs11_7_pkcs11_25OperationWithBinaryOutput__setup(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_DigestOperation, __pyx_v_session, __pyx_v_mech, __pyx_v_buffer_size)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 786, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_op = ((struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pkcs11/_pkcs11.pyx":789
 *             DigestOperation, session, mech, buffer_size
 *         )
 *         return op             # <<<<<<<<<<<<<<
 * 
 *     def _initiate(self):
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_op);
  __pyx_r = __pyx_v_op;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":780
 * cdef class DigestOperation(OperationWithBinaryOutput):
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef DigestOperation setup(
 *             Session session,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pkcs11._pkcs11.DigestOperation.setup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_op);
  __Pyx_XDECREF((PyObject *)__pyx_v_session);
  __Pyx_XDECREF((PyObject *)__pyx_v_mech);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":791
 *         return op
 * 
 *     def _initiate(self):             # <<<<<<<<<<<<<<
 *         cdef CK_RV retval
 *         with nogil:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_15DigestOperation_1_initiate(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_15DigestOperation_1_initiate = {"_initiate", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_15DigestOperation_1_initiate, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_15DigestOperation_1_initiate(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_initiate (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("_initiate", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("_initiate", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_15DigestOperation__initiate(((struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_15DigestOperation__initiate(struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *__pyx_v_self) {
  CK_RV __pyx_v_retval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_initiate", 0);

  /* "pkcs11/_pkcs11.pyx":793
 *     def _initiate(self):
 *         cdef CK_RV retval
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.session.funclist.C_DigestInit(self.session.handle, self.mech.data)
 *         self._operation_aware_assert(retval)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":794
 *         cdef CK_RV retval
 *         with nogil:
 *             retval = self.session.funclist.C_DigestInit(self.session.handle, self.mech.data)             # <<<<<<<<<<<<<<
 *         self._operation_aware_assert(retval)
 * 
*/
        __pyx_v_retval = __pyx_v_self->__pyx_base.__pyx_base.session->__pyx_base.funclist->C_DigestInit(__pyx_v_self->__pyx_base.__pyx_base.session->handle, __pyx_v_self->__pyx_base.mech->data);
      }

      /* "pkcs11/_pkcs11.pyx":793
 *     def _initiate(self):
 *         cdef CK_RV retval
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.session.funclist.C_DigestInit(self.session.handle, self.mech.data)
 *         self._operation_aware_assert(retval)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":795
 *         with nogil:
 *             retval = self.session.funclist.C_DigestInit(self.session.handle, self.mech.data)
 *         self._operation_aware_assert(retval)             # <<<<<<<<<<<<<<
 * 
 *     cdef bytes digest_process_fully(self, CK_BYTE *data, CK_ULONG data_len) with gil:
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DigestOperation *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._operation_aware_assert(((struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *)__pyx_v_self), __pyx_v_retval); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 795, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":791
 *         return op
 * 
 *     def _initiate(self):             # <<<<<<<<<<<<<<
 *         cdef CK_RV retval
 *         with nogil:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pkcs11._pkcs11.DigestOperation._initiate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":797
 *         self._operation_aware_assert(retval)
 * 
 *     cdef bytes digest_process_fully(self, CK_BYTE *data, CK_ULONG data_len) with gil:             # <<<<<<<<<<<<<<
 *         cdef Session session = self.session
 *         return self.process_fully(session.funclist.C_Digest, data, data_len)
*/

static PyObject *__pyx_f_6pkcs11_7_pkcs11_15DigestOperation_digest_process_fully(struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *__pyx_v_self, CK_BYTE *__pyx_v_data, CK_ULONG __pyx_v_data_len) {
  struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("digest_process_fully", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_self);

  /* "pkcs11/_pkcs11.pyx":798
 * 
 *     cdef bytes digest_process_fully(self, CK_BYTE *data, CK_ULONG data_len) with gil:
 *         cdef Session session = self.session             # <<<<<<<<<<<<<<
 *         return self.process_fully(session.funclist.C_Digest, data, data_len)
 * 
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.session);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_session = ((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":799
 *     cdef bytes digest_process_fully(self, CK_BYTE *data, CK_ULONG data_len) with gil:
 *         cdef Session session = self.session
 *         return self.process_fully(session.funclist.C_Digest, data, data_len)             # <<<<<<<<<<<<<<
 * 
 *     cdef void update_digest(self, CK_BYTE *data, CK_ULONG data_len):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DigestOperation *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.process_fully(((struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *)__pyx_v_self), __pyx_v_session->__pyx_base.funclist->C_Digest, __pyx_v_data, __pyx_v_data_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 799, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":797
 *         self._operation_aware_assert(retval)
 * 
 *     cdef bytes digest_process_fully(self, CK_BYTE *data, CK_ULONG data_len) with gil:             # <<<<<<<<<<<<<<
 *         cdef Session session = self.session
 *         return self.process_fully(session.funclist.C_Digest, data, data_len)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pkcs11._pkcs11.DigestOperation.digest_process_fully", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_session);
  __Pyx_XDECREF((PyObject *)__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":801
 *         return self.process_fully(session.funclist.C_Digest, data, data_len)
 * 
 *     cdef void update_digest(self, CK_BYTE *data, CK_ULONG data_len):             # <<<<<<<<<<<<<<
 *         self.update_no_output(self.session.funclist.C_DigestUpdate, data, data_len)
 * 
*/

static void __pyx_f_6pkcs11_7_pkcs11_15DigestOperation_update_digest(struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *__pyx_v_self, CK_BYTE *__pyx_v_data, CK_ULONG __pyx_v_data_len) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("update_digest", 0);

  /* "pkcs11/_pkcs11.pyx":802
 * 
 *     cdef void update_digest(self, CK_BYTE *data, CK_ULONG data_len):
 *         self.update_no_output(self.session.funclist.C_DigestUpdate, data, data_len)             # <<<<<<<<<<<<<<
 * 
 *     cdef void update_digest_with_key(self, CK_OBJECT_HANDLE key):
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DigestOperation *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.update_no_output(((struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *)__pyx_v_self), __pyx_v_self->__pyx_base.__pyx_base.session->__pyx_base.funclist->C_DigestUpdate, __pyx_v_data, __pyx_v_data_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 802, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":801
 *         return self.process_fully(session.funclist.C_Digest, data, data_len)
 * 
 *     cdef void update_digest(self, CK_BYTE *data, CK_ULONG data_len):             # <<<<<<<<<<<<<<
 *         self.update_no_output(self.session.funclist.C_DigestUpdate, data, data_len)
 * 
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pkcs11._pkcs11.DigestOperation.update_digest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "pkcs11/_pkcs11.pyx":804
 *         self.update_no_output(self.session.funclist.C_DigestUpdate, data, data_len)
 * 
 *     cdef void update_digest_with_key(self, CK_OBJECT_HANDLE key):             # <<<<<<<<<<<<<<
 *         cdef Session session = self.session
 *         with nogil:
*/

static void __pyx_f_6pkcs11_7_pkcs11_15DigestOperation_update_digest_with_key(struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *__pyx_v_self, CK_OBJECT_HANDLE __pyx_v_key) {
  struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session = 0;
  CK_RV __pyx_v_retval;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("update_digest_with_key", 0);

  /* "pkcs11/_pkcs11.pyx":805
 * 
 *     cdef void update_digest_with_key(self, CK_OBJECT_HANDLE key):
 *         cdef Session session = self.session             # <<<<<<<<<<<<<<
 *         with nogil:
 *             retval = session.funclist.C_DigestKey(session.handle, key)
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.session);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_session = ((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":806
 *     cdef void update_digest_with_key(self, CK_OBJECT_HANDLE key):
 *         cdef Session session = self.session
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = session.funclist.C_DigestKey(session.handle, key)
 *         self._operation_aware_assert(retval)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":807
 *         cdef Session session = self.session
 *         with nogil:
 *             retval = session.funclist.C_DigestKey(session.handle, key)             # <<<<<<<<<<<<<<
 *         self._operation_aware_assert(retval)
 * 
*/
        __pyx_v_retval = __pyx_v_session->__pyx_base.funclist->C_DigestKey(__pyx_v_session->handle, __pyx_v_key);
      }

      /* "pkcs11/_pkcs11.pyx":806
 *     cdef void update_digest_with_key(self, CK_OBJECT_HANDLE key):
 *         cdef Session session = self.session
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = session.funclist.C_DigestKey(session.handle, key)
 *         self._operation_aware_assert(retval)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":808
 *         with nogil:
 *             retval = session.funclist.C_DigestKey(session.handle, key)
 *         self._operation_aware_assert(retval)             # <<<<<<<<<<<<<<
 * 
 *     def ingest_chunks(self, chunks):
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DigestOperation *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._operation_aware_assert(((struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *)__pyx_v_self), __pyx_v_retval); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 808, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":804
 *         self.update_no_output(self.session.funclist.C_DigestUpdate, data, data_len)
 * 
 *     cdef void update_digest_with_key(self, CK_OBJECT_HANDLE key):             # <<<<<<<<<<<<<<
 *         cdef Session session = self.session
 *         with nogil:
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pkcs11._pkcs11.DigestOperation.update_digest_with_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_session);
  __Pyx_RefNannyFinishContext();
}

/* "pkcs11/_pkcs11.pyx":810
 *         self._operation_aware_assert(retval)
 * 
 *     def ingest_chunks(self, chunks):             # <<<<<<<<<<<<<<
 *         cdef CK_BYTE *data_ptr
 *         cdef CK_ULONG data_len
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_15DigestOperation_3ingest_chunks(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_15DigestOperation_3ingest_chunks = {"ingest_chunks", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_15DigestOperation_3ingest_chunks, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_15DigestOperation_3ingest_chunks(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_chunks = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ingest_chunks (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_chunks,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 810, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 810, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "ingest_chunks", 0) < (0)) __PYX_ERR(0, 810, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("ingest_chunks", 1, 1, 1, i); __PYX_ERR(0, 810, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 810, __pyx_L3_error)
    }
    __pyx_v_chunks = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ingest_chunks", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 810, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.DigestOperation.ingest_chunks", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_15DigestOperation_2ingest_chunks(((struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *)__pyx_v_self), __pyx_v_chunks);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_15DigestOperation_2ingest_chunks(struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *__pyx_v_self, PyObject *__pyx_v_chunks) {
  CK_BYTE *__pyx_v_data_ptr;
  CK_ULONG __pyx_v_data_len;
  CK_OBJECT_HANDLE __pyx_v_key;
  PyObject *__pyx_v_chunk = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  CK_OBJECT_HANDLE __pyx_t_8;
  CK_BYTE *__pyx_t_9;
  Py_ssize_t __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ingest_chunks", 0);

  /* "pkcs11/_pkcs11.pyx":815
 *         cdef CK_OBJECT_HANDLE key
 * 
 *         for chunk in chunks:             # <<<<<<<<<<<<<<
 *             if not chunk:
 *                 continue
*/
  if (likely(PyList_CheckExact(__pyx_v_chunks)) || PyTuple_CheckExact(__pyx_v_chunks)) {
    __pyx_t_1 = __pyx_v_chunks; __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_chunks); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 815, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 815, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 815, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_2;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 815, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
        #endif
        ++__pyx_t_2;
      }
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 815, __pyx_L1_error)
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 815, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_chunk, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "pkcs11/_pkcs11.pyx":816
 * 
 *         for chunk in chunks:
 *             if not chunk:             # <<<<<<<<<<<<<<
 *                 continue
 *             if isinstance(chunk, types.Key):
*/
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_chunk); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 816, __pyx_L1_error)
    __pyx_t_6 = (!__pyx_t_5);
    if (__pyx_t_6) {

      /* "pkcs11/_pkcs11.pyx":817
 *         for chunk in chunks:
 *             if not chunk:
 *                 continue             # <<<<<<<<<<<<<<
 *             if isinstance(chunk, types.Key):
 *                 key = chunk.handle
*/
      goto __pyx_L3_continue;

      /* "pkcs11/_pkcs11.pyx":816
 * 
 *         for chunk in chunks:
 *             if not chunk:             # <<<<<<<<<<<<<<
 *                 continue
 *             if isinstance(chunk, types.Key):
*/
    }

    /* "pkcs11/_pkcs11.pyx":818
 *             if not chunk:
 *                 continue
 *             if isinstance(chunk, types.Key):             # <<<<<<<<<<<<<<
 *                 key = chunk.handle
 *                 self.update_digest_with_key(key)
*/
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_types); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 818, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Key); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 818, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = PyObject_IsInstance(__pyx_v_chunk, __pyx_t_7); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 818, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_6) {

      /* "pkcs11/_pkcs11.pyx":819
 *                 continue
 *             if isinstance(chunk, types.Key):
 *                 key = chunk.handle             # <<<<<<<<<<<<<<
 *                 self.update_digest_with_key(key)
 *             else:
*/
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_chunk, __pyx_mstate_global->__pyx_n_u_handle); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 819, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PyLong_As_CK_ULONG(__pyx_t_7); if (unlikely((__pyx_t_8 == ((CK_OBJECT_HANDLE)-1)) && PyErr_Occurred())) __PYX_ERR(0, 819, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_key = __pyx_t_8;

      /* "pkcs11/_pkcs11.pyx":820
 *             if isinstance(chunk, types.Key):
 *                 key = chunk.handle
 *                 self.update_digest_with_key(key)             # <<<<<<<<<<<<<<
 *             else:
 *                 data_ptr = chunk
*/
      ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DigestOperation *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->update_digest_with_key(__pyx_v_self, __pyx_v_key); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 820, __pyx_L1_error)

      /* "pkcs11/_pkcs11.pyx":818
 *             if not chunk:
 *                 continue
 *             if isinstance(chunk, types.Key):             # <<<<<<<<<<<<<<
 *                 key = chunk.handle
 *                 self.update_digest_with_key(key)
*/
      goto __pyx_L6;
    }

    /* "pkcs11/_pkcs11.pyx":822
 *                 self.update_digest_with_key(key)
 *             else:
 *                 data_ptr = chunk             # <<<<<<<<<<<<<<
 *                 data_len = <CK_ULONG> len(chunk)
 *                 self.update_digest(data_ptr, data_len)
*/
    /*else*/ {
      __pyx_t_9 = __Pyx_PyObject_AsWritableUString(__pyx_v_chunk); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 822, __pyx_L1_error)
      __pyx_v_data_ptr = __pyx_t_9;

      /* "pkcs11/_pkcs11.pyx":823
 *             else:
 *                 data_ptr = chunk
 *                 data_len = <CK_ULONG> len(chunk)             # <<<<<<<<<<<<<<
 *                 self.update_digest(data_ptr, data_len)
 * 
*/
      __pyx_t_10 = PyObject_Length(__pyx_v_chunk); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 823, __pyx_L1_error)
      __pyx_v_data_len = ((CK_ULONG)__pyx_t_10);

      /* "pkcs11/_pkcs11.pyx":824
 *                 data_ptr = chunk
 *                 data_len = <CK_ULONG> len(chunk)
 *                 self.update_digest(data_ptr, data_len)             # <<<<<<<<<<<<<<
 * 
 *     cdef bytes finish(self):
*/
      ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DigestOperation *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->update_digest(__pyx_v_self, __pyx_v_data_ptr, __pyx_v_data_len); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 824, __pyx_L1_error)
    }
    __pyx_L6:;

    /* "pkcs11/_pkcs11.pyx":815
 *         cdef CK_OBJECT_HANDLE key
 * 
 *         for chunk in chunks:             # <<<<<<<<<<<<<<
 *             if not chunk:
 *                 continue
*/
    __pyx_L3_continue:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":810
 *         self._operation_aware_assert(retval)
 * 
 *     def ingest_chunks(self, chunks):             # <<<<<<<<<<<<<<
 *         cdef CK_BYTE *data_ptr
 *         cdef CK_ULONG data_len
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pkcs11._pkcs11.DigestOperation.ingest_chunks", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_chunk);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":826
 *                 self.update_digest(data_ptr, data_len)
 * 
 *     cdef bytes finish(self):             # <<<<<<<<<<<<<<
 *         return self.finish_with_output(self.session.funclist.C_DigestFinal)
 * 
*/

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

  /* "pkcs11/_pkcs11.pyx":827
 * 
 *     cdef bytes finish(self):
 *         return self.finish_with_output(self.session.funclist.C_DigestFinal)             # <<<<<<<<<<<<<<
 * 
 *     def _finalize(self, silent=False):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DigestOperation *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.finish_with_output(((struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *)__pyx_v_self), __pyx_v_self->__pyx_base.__pyx_base.session->__pyx_base.funclist->C_DigestFinal); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 827, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":826
 *                 self.update_digest(data_ptr, data_len)
 * 
 *     cdef bytes finish(self):             # <<<<<<<<<<<<<<
 *         return self.finish_with_output(self.session.funclist.C_DigestFinal)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pkcs11._pkcs11.DigestOperation.finish", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":829
 *         return self.finish_with_output(self.session.funclist.C_DigestFinal)
 * 
 *     def _finalize(self, silent=False):             # <<<<<<<<<<<<<<
 *         cdef Session session = self.session
 *         if self.active:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_15DigestOperation_5_finalize(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_15DigestOperation_5_finalize = {"_finalize", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_15DigestOperation_5_finalize, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_15DigestOperation_5_finalize(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_silent = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_finalize (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_silent,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 829, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 829, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_finalize", 0) < (0)) __PYX_ERR(0, 829, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_False));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 829, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_False));
    }
    __pyx_v_silent = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_finalize", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 829, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.DigestOperation._finalize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_15DigestOperation_4_finalize(((struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *)__pyx_v_self), __pyx_v_silent);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_15DigestOperation_4_finalize(struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *__pyx_v_self, PyObject *__pyx_v_silent) {
  struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_finalize", 0);

  /* "pkcs11/_pkcs11.pyx":830
 * 
 *     def _finalize(self, silent=False):
 *         cdef Session session = self.session             # <<<<<<<<<<<<<<
 *         if self.active:
 *             self.execute_resizing_output(session.funclist.C_DigestFinal)
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.session);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_session = ((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":831
 *     def _finalize(self, silent=False):
 *         cdef Session session = self.session
 *         if self.active:             # <<<<<<<<<<<<<<
 *             self.execute_resizing_output(session.funclist.C_DigestFinal)
 *         super()._finalize(silent=silent)
*/
  if (__pyx_v_self->__pyx_base.__pyx_base.active) {

    /* "pkcs11/_pkcs11.pyx":832
 *         cdef Session session = self.session
 *         if self.active:
 *             self.execute_resizing_output(session.funclist.C_DigestFinal)             # <<<<<<<<<<<<<<
 *         super()._finalize(silent=silent)
 * 
*/
    ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DigestOperation *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.execute_resizing_output(((struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *)__pyx_v_self), __pyx_v_session->__pyx_base.funclist->C_DigestFinal); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 832, __pyx_L1_error)

    /* "pkcs11/_pkcs11.pyx":831
 *     def _finalize(self, silent=False):
 *         cdef Session session = self.session
 *         if self.active:             # <<<<<<<<<<<<<<
 *             self.execute_resizing_output(session.funclist.C_DigestFinal)
 *         super()._finalize(silent=silent)
*/
  }

  /* "pkcs11/_pkcs11.pyx":833
 *         if self.active:
 *             self.execute_resizing_output(session.funclist.C_DigestFinal)
 *         super()._finalize(silent=silent)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_4 = NULL;
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_4, ((PyObject *)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_DigestOperation), ((PyObject *)__pyx_v_self)};
    __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_super, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 833, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_t_2 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, NULL};
    __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 833, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_silent, __pyx_v_silent, __pyx_t_4, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 833, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_finalize, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 833, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":829
 *         return self.finish_with_output(self.session.funclist.C_DigestFinal)
 * 
 *     def _finalize(self, silent=False):             # <<<<<<<<<<<<<<
 *         cdef Session session = self.session
 *         if self.active:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pkcs11._pkcs11.DigestOperation._finalize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_session);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_15DigestOperation_7__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_15DigestOperation_7__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_15DigestOperation_7__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_15DigestOperation_7__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_15DigestOperation_6__reduce_cython__(((struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_15DigestOperation_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 2, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.DigestOperation.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_15DigestOperation_9__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_15DigestOperation_9__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_15DigestOperation_9__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_15DigestOperation_9__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.DigestOperation.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_15DigestOperation_8__setstate_cython__(((struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *)__pyx_v_self), __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_15DigestOperation_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 4, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.DigestOperation.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":836
 * 
 * 
 * def merge_templates(default_template, *user_templates):             # <<<<<<<<<<<<<<
 *     template = default_template.copy()
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_1merge_templates(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_1merge_templates = {"merge_templates", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_1merge_templates, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_1merge_templates(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_default_template = 0;
  PyObject *__pyx_v_user_templates = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("merge_templates (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_user_templates = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 1, __pyx_nargs);
  if (unlikely(!__pyx_v_user_templates)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_v_user_templates);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_default_template,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 836, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        default:
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 836, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      const Py_ssize_t used_pos_args = (kwd_pos_args < 1) ? kwd_pos_args : 1;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, used_pos_args, __pyx_kwds_len, "merge_templates", 0) < (0)) __PYX_ERR(0, 836, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("merge_templates", 0, 1, 1, i); __PYX_ERR(0, 836, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs < 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 836, __pyx_L3_error)
    }
    __pyx_v_default_template = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("merge_templates", 0, 1, 1, __pyx_nargs); __PYX_ERR(0, 836, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_user_templates); __pyx_v_user_templates = 0;
  __Pyx_AddTraceback("pkcs11._pkcs11.merge_templates", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_merge_templates(__pyx_self, __pyx_v_default_template, __pyx_v_user_templates);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_merge_templates(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_default_template, PyObject *__pyx_v_user_templates) {
  PyObject *__pyx_v_template = NULL;
  PyObject *__pyx_v_user_template = NULL;
  PyObject *__pyx_7genexpr__pyx_v_key = NULL;
  PyObject *__pyx_7genexpr__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("merge_templates", 0);

  /* "pkcs11/_pkcs11.pyx":837
 * 
 * def merge_templates(default_template, *user_templates):
 *     template = default_template.copy()             # <<<<<<<<<<<<<<
 * 
 *     for user_template in user_templates:
*/
  __pyx_t_2 = __pyx_v_default_template;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_copy, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 837, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_template = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":839
 *     template = default_template.copy()
 * 
 *     for user_template in user_templates:             # <<<<<<<<<<<<<<
 *         if user_template is not None:
 *             template.update(user_template)
*/
  __pyx_t_1 = __pyx_v_user_templates; __Pyx_INCREF(__pyx_t_1);
  __pyx_t_4 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 839, __pyx_L1_error)
      #endif
      if (__pyx_t_4 >= __pyx_temp) break;
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4));
    #else
    __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_4);
    #endif
    ++__pyx_t_4;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 839, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_user_template, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "pkcs11/_pkcs11.pyx":840
 * 
 *     for user_template in user_templates:
 *         if user_template is not None:             # <<<<<<<<<<<<<<
 *             template.update(user_template)
 * 
*/
    __pyx_t_5 = (__pyx_v_user_template != Py_None);
    if (__pyx_t_5) {

      /* "pkcs11/_pkcs11.pyx":841
 *     for user_template in user_templates:
 *         if user_template is not None:
 *             template.update(user_template)             # <<<<<<<<<<<<<<
 * 
 *     return {
*/
      __pyx_t_6 = __pyx_v_template;
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_3 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_user_template};
        __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 841, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "pkcs11/_pkcs11.pyx":840
 * 
 *     for user_template in user_templates:
 *         if user_template is not None:             # <<<<<<<<<<<<<<
 *             template.update(user_template)
 * 
*/
    }

    /* "pkcs11/_pkcs11.pyx":839
 *     template = default_template.copy()
 * 
 *     for user_template in user_templates:             # <<<<<<<<<<<<<<
 *         if user_template is not None:
 *             template.update(user_template)
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":843
 *             template.update(user_template)
 * 
 *     return {             # <<<<<<<<<<<<<<
 *         key: value
 *         for key, value in template.items()
*/
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 843, __pyx_L9_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "pkcs11/_pkcs11.pyx":845
 *     return {
 *         key: value
 *         for key, value in template.items()             # <<<<<<<<<<<<<<
 *         if value is not DEFAULT
 *     }
*/
    __pyx_t_4 = 0;
    if (unlikely(__pyx_v_template == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
      __PYX_ERR(0, 845, __pyx_L9_error)
    }
    __pyx_t_6 = __Pyx_dict_iterator(__pyx_v_template, 0, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_7), (&__pyx_t_8)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 845, __pyx_L9_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_2);
    __pyx_t_2 = __pyx_t_6;
    __pyx_t_6 = 0;
    while (1) {
      __pyx_t_10 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_7, &__pyx_t_4, &__pyx_t_6, &__pyx_t_9, NULL, __pyx_t_8);
      if (unlikely(__pyx_t_10 == 0)) break;
      if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 845, __pyx_L9_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_key, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_value, __pyx_t_9);
      __pyx_t_9 = 0;

      /* "pkcs11/_pkcs11.pyx":846
 *         key: value
 *         for key, value in template.items()
 *         if value is not DEFAULT             # <<<<<<<<<<<<<<
 *     }
 * 
*/
      __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_DEFAULT); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 846, __pyx_L9_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_5 = (__pyx_7genexpr__pyx_v_value != __pyx_t_9);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (__pyx_t_5) {

        /* "pkcs11/_pkcs11.pyx":844
 * 
 *     return {
 *         key: value             # <<<<<<<<<<<<<<
 *         for key, value in template.items()
 *         if value is not DEFAULT
*/
        if (unlikely(PyDict_SetItem(__pyx_t_1, (PyObject*)__pyx_7genexpr__pyx_v_key, (PyObject*)__pyx_7genexpr__pyx_v_value))) __PYX_ERR(0, 844, __pyx_L9_error)

        /* "pkcs11/_pkcs11.pyx":846
 *         key: value
 *         for key, value in template.items()
 *         if value is not DEFAULT             # <<<<<<<<<<<<<<
 *     }
 * 
*/
      }
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_key); __pyx_7genexpr__pyx_v_key = 0;
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_value); __pyx_7genexpr__pyx_v_value = 0;
    goto __pyx_L13_exit_scope;
    __pyx_L9_error:;
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_key); __pyx_7genexpr__pyx_v_key = 0;
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_value); __pyx_7genexpr__pyx_v_value = 0;
    goto __pyx_L1_error;
    __pyx_L13_exit_scope:;
  } /* exit inner scope */
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":836
 * 
 * 
 * def merge_templates(default_template, *user_templates):             # <<<<<<<<<<<<<<
 *     template = default_template.copy()
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pkcs11._pkcs11.merge_templates", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_template);
  __Pyx_XDECREF(__pyx_v_user_template);
  __Pyx_XDECREF(__pyx_7genexpr__pyx_v_key);
  __Pyx_XDECREF(__pyx_7genexpr__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":861
 *     cdef unsigned int cancel_strategy
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef Session make(
 *             Token token,
*/

static struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_f_6pkcs11_7_pkcs11_7Session_make(struct __pyx_obj_6pkcs11_7_pkcs11_Token *__pyx_v_token, CK_SESSION_HANDLE __pyx_v_handle, int __pyx_v_rw, CK_USER_TYPE __pyx_v_user_type, PyObject *__pyx_v_mapper, unsigned int __pyx_v_cancel_strategy) {
  struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session = 0;
  struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct CK_FUNCTION_LIST *__pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("make", 0);

  /* "pkcs11/_pkcs11.pyx":870
 *             unsigned int cancel_strategy
 *     ):
 *         cdef Session session = Session.__new__(Session)             # <<<<<<<<<<<<<<
 * 
 *         session.funclist = token.funclist
*/
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_6pkcs11_7_pkcs11_Session(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Session), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 870, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_1);
  __pyx_v_session = ((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":872
 *         cdef Session session = Session.__new__(Session)
 * 
 *         session.funclist = token.funclist             # <<<<<<<<<<<<<<
 *         session.token = token
 * 
*/
  __pyx_t_2 = __pyx_v_token->__pyx_base.funclist;
  __pyx_v_session->__pyx_base.funclist = __pyx_t_2;

  /* "pkcs11/_pkcs11.pyx":873
 * 
 *         session.funclist = token.funclist
 *         session.token = token             # <<<<<<<<<<<<<<
 * 
 *         session.handle = handle
*/
  __Pyx_INCREF((PyObject *)__pyx_v_token);
  __Pyx_GIVEREF((PyObject *)__pyx_v_token);
  __Pyx_GOTREF((PyObject *)__pyx_v_session->token);
  __Pyx_DECREF((PyObject *)__pyx_v_session->token);
  __pyx_v_session->token = __pyx_v_token;

  /* "pkcs11/_pkcs11.pyx":875
 *         session.token = token
 * 
 *         session.handle = handle             # <<<<<<<<<<<<<<
 *         # Big operation lock prevents other threads from entering/reentering
 *         # operations. If the same thread enters the lock, they will get a
*/
  __pyx_v_session->handle = __pyx_v_handle;

  /* "pkcs11/_pkcs11.pyx":879
 *         # operations. If the same thread enters the lock, they will get a
 *         # Cryptoki warning
 *         session.operation_lock = RLock()             # <<<<<<<<<<<<<<
 * 
 *         session.rw = rw
*/
  __pyx_t_3 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_RLock); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 879, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_3);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 879, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_session->operation_lock);
  __Pyx_DECREF(__pyx_v_session->operation_lock);
  __pyx_v_session->operation_lock = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":881
 *         session.operation_lock = RLock()
 * 
 *         session.rw = rw             # <<<<<<<<<<<<<<
 *         session._user_type = user_type
 *         session.attribute_mapper = mapper
*/
  __pyx_v_session->rw = __pyx_v_rw;

  /* "pkcs11/_pkcs11.pyx":882
 * 
 *         session.rw = rw
 *         session._user_type = user_type             # <<<<<<<<<<<<<<
 *         session.attribute_mapper = mapper
 *         session.cancel_strategy = cancel_strategy
*/
  __pyx_v_session->_user_type = __pyx_v_user_type;

  /* "pkcs11/_pkcs11.pyx":883
 *         session.rw = rw
 *         session._user_type = user_type
 *         session.attribute_mapper = mapper             # <<<<<<<<<<<<<<
 *         session.cancel_strategy = cancel_strategy
 *         return session
*/
  __Pyx_INCREF(__pyx_v_mapper);
  __Pyx_GIVEREF(__pyx_v_mapper);
  __Pyx_GOTREF(__pyx_v_session->attribute_mapper);
  __Pyx_DECREF(__pyx_v_session->attribute_mapper);
  __pyx_v_session->attribute_mapper = __pyx_v_mapper;

  /* "pkcs11/_pkcs11.pyx":884
 *         session._user_type = user_type
 *         session.attribute_mapper = mapper
 *         session.cancel_strategy = cancel_strategy             # <<<<<<<<<<<<<<
 *         return session
 * 
*/
  __pyx_v_session->cancel_strategy = __pyx_v_cancel_strategy;

  /* "pkcs11/_pkcs11.pyx":885
 *         session.attribute_mapper = mapper
 *         session.cancel_strategy = cancel_strategy
 *         return session             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self):
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_session);
  __pyx_r = __pyx_v_session;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":861
 *     cdef unsigned int cancel_strategy
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef Session make(
 *             Token token,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pkcs11._pkcs11.Session.make", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_session);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":887
 *         return session
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         raise TypeError
 * 
*/

/* Python wrapper */
static int __pyx_pw_6pkcs11_7_pkcs11_7Session_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6pkcs11_7_pkcs11_7Session_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, __pyx_nargs); return -1; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__init__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_7Session___init__(((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_v_self));

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

static int __pyx_pf_6pkcs11_7_pkcs11_7Session___init__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self) {
  int __pyx_r;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "pkcs11/_pkcs11.pyx":888
 * 
 *     def __init__(self):
 *         raise TypeError             # <<<<<<<<<<<<<<
 * 
 *     def _identity(self):
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), 0, 0, 0);
  __PYX_ERR(0, 888, __pyx_L1_error)

  /* "pkcs11/_pkcs11.pyx":887
 *         return session
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         raise TypeError
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.Session.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":890
 *         raise TypeError
 * 
 *     def _identity(self):             # <<<<<<<<<<<<<<
 *         return Session.__name__, self.token, self.handle
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_3_identity(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_7Session_3_identity = {"_identity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_3_identity, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_3_identity(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_identity (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("_identity", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("_identity", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_7Session_2_identity(((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_2_identity(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_identity", 0);

  /* "pkcs11/_pkcs11.pyx":891
 * 
 *     def _identity(self):
 *         return Session.__name__, self.token, self.handle             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Session), __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 891, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyLong_From_CK_ULONG(__pyx_v_self->handle); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 891, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 891, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 891, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_v_self->token);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self->token);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self->token)) != (0)) __PYX_ERR(0, 891, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2) != (0)) __PYX_ERR(0, 891, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":890
 *         raise TypeError
 * 
 *     def _identity(self):             # <<<<<<<<<<<<<<
 *         return Session.__name__, self.token, self.handle
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pkcs11._pkcs11.Session._identity", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":893
 *         return Session.__name__, self.token, self.handle
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def user_type(self):
 *         """User type for this session (:class:`pkcs11.constants.UserType` or :class:`int` for vendor-specific values)."""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_9user_type_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_9user_type_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_7Session_9user_type___get__(((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_9user_type___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "pkcs11/_pkcs11.pyx":896
 *     def user_type(self):
 *         """User type for this session (:class:`pkcs11.constants.UserType` or :class:`int` for vendor-specific values)."""
 *         try:             # <<<<<<<<<<<<<<
 *             return UserType(self._user_type)
 *         except ValueError:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "pkcs11/_pkcs11.pyx":897
 *         """User type for this session (:class:`pkcs11.constants.UserType` or :class:`int` for vendor-specific values)."""
 *         try:
 *             return UserType(self._user_type)             # <<<<<<<<<<<<<<
 *         except ValueError:
 *             # Return raw value for vendor-specific user types
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_UserType); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 897, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyLong_From_CK_USER_TYPE(__pyx_v_self->_user_type); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 897, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
        assert(__pyx_t_5);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
        __pyx_t_8 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_7};
        __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 897, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L7_try_return;

      /* "pkcs11/_pkcs11.pyx":896
 *     def user_type(self):
 *         """User type for this session (:class:`pkcs11.constants.UserType` or :class:`int` for vendor-specific values)."""
 *         try:             # <<<<<<<<<<<<<<
 *             return UserType(self._user_type)
 *         except ValueError:
*/
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "pkcs11/_pkcs11.pyx":898
 *         try:
 *             return UserType(self._user_type)
 *         except ValueError:             # <<<<<<<<<<<<<<
 *             # Return raw value for vendor-specific user types
 *             return self._user_type
*/
    __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_ValueError))));
    if (__pyx_t_9) {
      __Pyx_AddTraceback("pkcs11._pkcs11.Session.user_type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 898, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);

      /* "pkcs11/_pkcs11.pyx":900
 *         except ValueError:
 *             # Return raw value for vendor-specific user types
 *             return self._user_type             # <<<<<<<<<<<<<<
 * 
 *     def close(self):
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = __Pyx_PyLong_From_CK_USER_TYPE(__pyx_v_self->_user_type); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 900, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;

    /* "pkcs11/_pkcs11.pyx":896
 *     def user_type(self):
 *         """User type for this session (:class:`pkcs11.constants.UserType` or :class:`int` for vendor-specific values)."""
 *         try:             # <<<<<<<<<<<<<<
 *             return UserType(self._user_type)
 *         except ValueError:
*/
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
  }

  /* "pkcs11/_pkcs11.pyx":893
 *         return Session.__name__, self.token, self.handle
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def user_type(self):
 *         """User type for this session (:class:`pkcs11.constants.UserType` or :class:`int` for vendor-specific values)."""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pkcs11._pkcs11.Session.user_type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":902
 *             return self._user_type
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         cdef CK_SESSION_HANDLE handle = self.handle
 *         cdef CK_RV retval
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_5close(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_7Session_5close = {"close", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_5close, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_5close(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("close", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("close", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_7Session_4close(((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_4close(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self) {
  CK_SESSION_HANDLE __pyx_v_handle;
  CK_RV __pyx_v_retval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  CK_SESSION_HANDLE __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("close", 0);

  /* "pkcs11/_pkcs11.pyx":903
 * 
 *     def close(self):
 *         cdef CK_SESSION_HANDLE handle = self.handle             # <<<<<<<<<<<<<<
 *         cdef CK_RV retval
 * 
*/
  __pyx_t_1 = __pyx_v_self->handle;
  __pyx_v_handle = __pyx_t_1;

  /* "pkcs11/_pkcs11.pyx":906
 *         cdef CK_RV retval
 * 
 *         if self._user_type != CKU_USER_NOBODY:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 retval = self.funclist.C_Logout(handle)
*/
  __pyx_t_2 = (__pyx_v_self->_user_type != CKU_USER_NOBODY);
  if (__pyx_t_2) {

    /* "pkcs11/_pkcs11.pyx":907
 * 
 *         if self._user_type != CKU_USER_NOBODY:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 retval = self.funclist.C_Logout(handle)
 *             assertRV(retval)
*/
    {
        PyThreadState * _save;
        _save = PyEval_SaveThread();
        __Pyx_FastGIL_Remember();
        /*try:*/ {

          /* "pkcs11/_pkcs11.pyx":908
 *         if self._user_type != CKU_USER_NOBODY:
 *             with nogil:
 *                 retval = self.funclist.C_Logout(handle)             # <<<<<<<<<<<<<<
 *             assertRV(retval)
 * 
*/
          __pyx_v_retval = __pyx_v_self->__pyx_base.funclist->C_Logout(__pyx_v_handle);
        }

        /* "pkcs11/_pkcs11.pyx":907
 * 
 *         if self._user_type != CKU_USER_NOBODY:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 retval = self.funclist.C_Logout(handle)
 *             assertRV(retval)
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_FastGIL_Forget();
            PyEval_RestoreThread(_save);
            goto __pyx_L6;
          }
          __pyx_L6:;
        }
    }

    /* "pkcs11/_pkcs11.pyx":909
 *             with nogil:
 *                 retval = self.funclist.C_Logout(handle)
 *             assertRV(retval)             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
*/
    __pyx_t_3 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 909, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 909, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "pkcs11/_pkcs11.pyx":906
 *         cdef CK_RV retval
 * 
 *         if self._user_type != CKU_USER_NOBODY:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 retval = self.funclist.C_Logout(handle)
*/
  }

  /* "pkcs11/_pkcs11.pyx":911
 *             assertRV(retval)
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_CloseSession(handle)
 *         assertRV(retval)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":912
 * 
 *         with nogil:
 *             retval = self.funclist.C_CloseSession(handle)             # <<<<<<<<<<<<<<
 *         assertRV(retval)
 * 
*/
        __pyx_v_retval = __pyx_v_self->__pyx_base.funclist->C_CloseSession(__pyx_v_handle);
      }

      /* "pkcs11/_pkcs11.pyx":911
 *             assertRV(retval)
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_CloseSession(handle)
 *         assertRV(retval)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L9;
        }
        __pyx_L9:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":913
 *         with nogil:
 *             retval = self.funclist.C_CloseSession(handle)
 *         assertRV(retval)             # <<<<<<<<<<<<<<
 * 
 *     def get_objects(self, attrs=None, batch_size=10):
*/
  __pyx_t_4 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 913, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 913, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pkcs11/_pkcs11.pyx":902
 *             return self._user_type
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         cdef CK_SESSION_HANDLE handle = self.handle
 *         cdef CK_RV retval
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pkcs11._pkcs11.Session.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6pkcs11_7_pkcs11_7Session_8generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pkcs11/_pkcs11.pyx":915
 *         assertRV(retval)
 * 
 *     def get_objects(self, attrs=None, batch_size=10):             # <<<<<<<<<<<<<<
 *         with SearchIter(self, attrs or {}, batch_size) as op:
 *             for batch in op:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_7get_objects(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_7Session_7get_objects = {"get_objects", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_7get_objects, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_7get_objects(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_attrs = 0;
  PyObject *__pyx_v_batch_size = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_objects (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_attrs,&__pyx_mstate_global->__pyx_n_u_batch_size,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 915, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 915, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 915, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_objects", 0) < (0)) __PYX_ERR(0, 915, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_10));
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 915, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 915, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_10));
    }
    __pyx_v_attrs = values[0];
    __pyx_v_batch_size = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_objects", 0, 0, 2, __pyx_nargs); __PYX_ERR(0, 915, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.Session.get_objects", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_7Session_6get_objects(((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_v_self), __pyx_v_attrs, __pyx_v_batch_size);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_6get_objects(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, PyObject *__pyx_v_attrs, PyObject *__pyx_v_batch_size) {
  struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_objects", 0);
  __pyx_cur_scope = (struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects *)__pyx_tp_new_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 915, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_attrs = __pyx_v_attrs;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_attrs);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_attrs);
  __pyx_cur_scope->__pyx_v_batch_size = __pyx_v_batch_size;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_batch_size);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_batch_size);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6pkcs11_7_pkcs11_7Session_8generator1, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_get_objects, __pyx_mstate_global->__pyx_n_u_Session_get_objects, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11); if (unlikely(!gen)) __PYX_ERR(0, 915, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.Session.get_objects", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6pkcs11_7_pkcs11_7Session_8generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects *__pyx_cur_scope = ((struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  Py_ssize_t __pyx_t_11;
  PyObject *(*__pyx_t_12)(PyObject *);
  __Pyx_PySendResult __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_objects", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L18_resume_from_yield_from;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(0, 915, __pyx_L1_error)
  }

  /* "pkcs11/_pkcs11.pyx":916
 * 
 *     def get_objects(self, attrs=None, batch_size=10):
 *         with SearchIter(self, attrs or {}, batch_size) as op:             # <<<<<<<<<<<<<<
 *             for batch in op:
 *                 yield from batch
*/
  /*with:*/ {
    __pyx_t_2 = NULL;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_attrs); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 916, __pyx_L1_error)
    if (!__pyx_t_4) {
    } else {
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_attrs);
      __pyx_t_3 = __pyx_cur_scope->__pyx_v_attrs;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 916, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_3 = __pyx_t_5;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_L4_bool_binop_done:;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[4] = {__pyx_t_2, ((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_t_3, __pyx_cur_scope->__pyx_v_batch_size};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_SearchIter, __pyx_callargs+__pyx_t_6, (4-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 916, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_1);
    }
    __pyx_t_7 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 916, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = NULL;
    __pyx_t_5 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 916, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 916, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_t_5 = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_DECREF((PyObject *)__pyx_t_1); __pyx_t_1 = 0;
    /*try:*/ {
      {
        __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_10);
        /*try:*/ {
          __Pyx_GIVEREF(__pyx_t_5);
          __pyx_cur_scope->__pyx_v_op = __pyx_t_5;
          __pyx_t_5 = 0;

          /* "pkcs11/_pkcs11.pyx":917
 *     def get_objects(self, attrs=None, batch_size=10):
 *         with SearchIter(self, attrs or {}, batch_size) as op:
 *             for batch in op:             # <<<<<<<<<<<<<<
 *                 yield from batch
 * 
*/
          if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_op)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_op)) {
            __pyx_t_5 = __pyx_cur_scope->__pyx_v_op; __Pyx_INCREF(__pyx_t_5);
            __pyx_t_11 = 0;
            __pyx_t_12 = NULL;
          } else {
            __pyx_t_11 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_op); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 917, __pyx_L10_error)
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_12 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 917, __pyx_L10_error)
          }
          for (;;) {
            if (likely(!__pyx_t_12)) {
              if (likely(PyList_CheckExact(__pyx_t_5))) {
                {
                  Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5);
                  #if !CYTHON_ASSUME_SAFE_SIZE
                  if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 917, __pyx_L10_error)
                  #endif
                  if (__pyx_t_11 >= __pyx_temp) break;
                }
                __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_5, __pyx_t_11, __Pyx_ReferenceSharing_OwnStrongReference);
                ++__pyx_t_11;
              } else {
                {
                  Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5);
                  #if !CYTHON_ASSUME_SAFE_SIZE
                  if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 917, __pyx_L10_error)
                  #endif
                  if (__pyx_t_11 >= __pyx_temp) break;
                }
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_11));
                #else
                __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_11);
                #endif
                ++__pyx_t_11;
              }
              if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 917, __pyx_L10_error)
            } else {
              __pyx_t_1 = __pyx_t_12(__pyx_t_5);
              if (unlikely(!__pyx_t_1)) {
                PyObject* exc_type = PyErr_Occurred();
                if (exc_type) {
                  if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 917, __pyx_L10_error)
                  PyErr_Clear();
                }
                break;
              }
            }
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_batch);
            __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_batch, __pyx_t_1);
            __Pyx_GIVEREF(__pyx_t_1);
            __pyx_t_1 = 0;

            /* "pkcs11/_pkcs11.pyx":918
 *         with SearchIter(self, attrs or {}, batch_size) as op:
 *             for batch in op:
 *                 yield from batch             # <<<<<<<<<<<<<<
 * 
 *     def reaffirm_credentials(self, pin):
*/
            __pyx_t_13 = __Pyx_Generator_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_batch, &__pyx_r);
            if (likely(__pyx_t_13 == PYGEN_NEXT)) {
              __Pyx_GOTREF(__pyx_r);
              __Pyx_XGIVEREF(__pyx_t_5);
              __pyx_cur_scope->__pyx_t_0 = __pyx_t_5;
              __Pyx_XGIVEREF(__pyx_t_7);
              __pyx_cur_scope->__pyx_t_1 = __pyx_t_7;
              __Pyx_XGIVEREF(__pyx_t_8);
              __pyx_cur_scope->__pyx_t_2 = __pyx_t_8;
              __Pyx_XGIVEREF(__pyx_t_9);
              __pyx_cur_scope->__pyx_t_3 = __pyx_t_9;
              __Pyx_XGIVEREF(__pyx_t_10);
              __pyx_cur_scope->__pyx_t_4 = __pyx_t_10;
              __pyx_cur_scope->__pyx_t_5 = __pyx_t_11;
              __pyx_cur_scope->__pyx_t_6 = __pyx_t_12;
              __Pyx_XGIVEREF(__pyx_r);
              __Pyx_RefNannyFinishContext();
              __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
              /* return from generator, yielding value */
              __pyx_generator->resume_label = 1;
              return __pyx_r;
              __pyx_L18_resume_from_yield_from:;
              __pyx_t_5 = __pyx_cur_scope->__pyx_t_0;
              __pyx_cur_scope->__pyx_t_0 = 0;
              __Pyx_XGOTREF(__pyx_t_5);
              __pyx_t_7 = __pyx_cur_scope->__pyx_t_1;
              __pyx_cur_scope->__pyx_t_1 = 0;
              __Pyx_XGOTREF(__pyx_t_7);
              __pyx_t_8 = __pyx_cur_scope->__pyx_t_2;
              __pyx_cur_scope->__pyx_t_2 = 0;
              __Pyx_XGOTREF(__pyx_t_8);
              __pyx_t_9 = __pyx_cur_scope->__pyx_t_3;
              __pyx_cur_scope->__pyx_t_3 = 0;
              __Pyx_XGOTREF(__pyx_t_9);
              __pyx_t_10 = __pyx_cur_scope->__pyx_t_4;
              __pyx_cur_scope->__pyx_t_4 = 0;
              __Pyx_XGOTREF(__pyx_t_10);
              __pyx_t_11 = __pyx_cur_scope->__pyx_t_5;
              __pyx_t_12 = __pyx_cur_scope->__pyx_t_6;
              if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 918, __pyx_L10_error)
            } else if (likely(__pyx_t_13 == PYGEN_RETURN)) {
              __Pyx_GOTREF(__pyx_r);
              __Pyx_DECREF(__pyx_r); __pyx_r = 0;
            } else {
              __Pyx_XGOTREF(__pyx_r);
              __PYX_ERR(0, 918, __pyx_L10_error)
            }

            /* "pkcs11/_pkcs11.pyx":917
 *     def get_objects(self, attrs=None, batch_size=10):
 *         with SearchIter(self, attrs or {}, batch_size) as op:
 *             for batch in op:             # <<<<<<<<<<<<<<
 *                 yield from batch
 * 
*/
          }
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

          /* "pkcs11/_pkcs11.pyx":916
 * 
 *     def get_objects(self, attrs=None, batch_size=10):
 *         with SearchIter(self, attrs or {}, batch_size) as op:             # <<<<<<<<<<<<<<
 *             for batch in op:
 *                 yield from batch
*/
        }
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L15_try_end;
        __pyx_L10_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        /*except:*/ {
          __Pyx_AddTraceback("pkcs11._pkcs11.Session.get_objects", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_1, &__pyx_t_3) < 0) __PYX_ERR(0, 916, __pyx_L12_except_error)
          __Pyx_XGOTREF(__pyx_t_5);
          __Pyx_XGOTREF(__pyx_t_1);
          __Pyx_XGOTREF(__pyx_t_3);
          __pyx_t_2 = PyTuple_Pack(3, __pyx_t_5, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 916, __pyx_L12_except_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_2, NULL);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 916, __pyx_L12_except_error)
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          if (__pyx_t_4 < (0)) __PYX_ERR(0, 916, __pyx_L12_except_error)
          __pyx_t_15 = (!__pyx_t_4);
          if (unlikely(__pyx_t_15)) {
            __Pyx_GIVEREF(__pyx_t_5);
            __Pyx_GIVEREF(__pyx_t_1);
            __Pyx_XGIVEREF(__pyx_t_3);
            __Pyx_ErrRestoreWithState(__pyx_t_5, __pyx_t_1, __pyx_t_3);
            __pyx_t_5 = 0;  __pyx_t_1 = 0;  __pyx_t_3 = 0; 
            __PYX_ERR(0, 916, __pyx_L12_except_error)
          }
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          goto __pyx_L11_exception_handled;
        }
        __pyx_L12_except_error:;
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        goto __pyx_L1_error;
        __pyx_L11_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        __pyx_L15_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_7) {
          __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_mstate_global->__pyx_tuple[2], NULL);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 916, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        }
        goto __pyx_L9;
      }
      __pyx_L9:;
    }
    goto __pyx_L23;
    __pyx_L6_error:;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L1_error;
    __pyx_L23:;
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "pkcs11/_pkcs11.pyx":915
 *         assertRV(retval)
 * 
 *     def get_objects(self, attrs=None, batch_size=10):             # <<<<<<<<<<<<<<
 *         with SearchIter(self, attrs or {}, batch_size) as op:
 *             for batch in op:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("get_objects", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":920
 *                 yield from batch
 * 
 *     def reaffirm_credentials(self, pin):             # <<<<<<<<<<<<<<
 *         cdef CK_UTF8CHAR *pin_data
 *         cdef CK_ULONG pin_length
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_10reaffirm_credentials(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_7Session_10reaffirm_credentials = {"reaffirm_credentials", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_10reaffirm_credentials, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_10reaffirm_credentials(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_pin = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reaffirm_credentials (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pin,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 920, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 920, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "reaffirm_credentials", 0) < (0)) __PYX_ERR(0, 920, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("reaffirm_credentials", 1, 1, 1, i); __PYX_ERR(0, 920, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 920, __pyx_L3_error)
    }
    __pyx_v_pin = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("reaffirm_credentials", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 920, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.Session.reaffirm_credentials", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_7Session_9reaffirm_credentials(((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_v_self), __pyx_v_pin);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_9reaffirm_credentials(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, PyObject *__pyx_v_pin) {
  CK_UTF8CHAR *__pyx_v_pin_data;
  CK_ULONG __pyx_v_pin_length;
  CK_USER_TYPE __pyx_v_user_type;
  CK_RV __pyx_v_retval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  CK_UTF8CHAR *__pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reaffirm_credentials", 0);
  __Pyx_INCREF(__pyx_v_pin);

  /* "pkcs11/_pkcs11.pyx":924
 *         cdef CK_ULONG pin_length
 * 
 *         pin = pin.encode('utf-8')             # <<<<<<<<<<<<<<
 *         pin_data = pin
 *         pin_length = <CK_ULONG> len(pin)
*/
  __pyx_t_2 = __pyx_v_pin;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_utf_8};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 924, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF_SET(__pyx_v_pin, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":925
 * 
 *         pin = pin.encode('utf-8')
 *         pin_data = pin             # <<<<<<<<<<<<<<
 *         pin_length = <CK_ULONG> len(pin)
 *         user_type = CKU_CONTEXT_SPECIFIC
*/
  __pyx_t_4 = __Pyx_PyObject_AsWritableUString(__pyx_v_pin); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 925, __pyx_L1_error)
  __pyx_v_pin_data = __pyx_t_4;

  /* "pkcs11/_pkcs11.pyx":926
 *         pin = pin.encode('utf-8')
 *         pin_data = pin
 *         pin_length = <CK_ULONG> len(pin)             # <<<<<<<<<<<<<<
 *         user_type = CKU_CONTEXT_SPECIFIC
 * 
*/
  __pyx_t_5 = PyObject_Length(__pyx_v_pin); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 926, __pyx_L1_error)
  __pyx_v_pin_length = ((CK_ULONG)__pyx_t_5);

  /* "pkcs11/_pkcs11.pyx":927
 *         pin_data = pin
 *         pin_length = <CK_ULONG> len(pin)
 *         user_type = CKU_CONTEXT_SPECIFIC             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
*/
  __pyx_v_user_type = CKU_CONTEXT_SPECIFIC;

  /* "pkcs11/_pkcs11.pyx":929
 *         user_type = CKU_CONTEXT_SPECIFIC
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_Login(self.handle, user_type, pin_data, pin_length)
 *         assertRV(retval)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":930
 * 
 *         with nogil:
 *             retval = self.funclist.C_Login(self.handle, user_type, pin_data, pin_length)             # <<<<<<<<<<<<<<
 *         assertRV(retval)
 * 
*/
        __pyx_v_retval = __pyx_v_self->__pyx_base.funclist->C_Login(__pyx_v_self->handle, __pyx_v_user_type, __pyx_v_pin_data, __pyx_v_pin_length);
      }

      /* "pkcs11/_pkcs11.pyx":929
 *         user_type = CKU_CONTEXT_SPECIFIC
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_Login(self.handle, user_type, pin_data, pin_length)
 *         assertRV(retval)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":931
 *         with nogil:
 *             retval = self.funclist.C_Login(self.handle, user_type, pin_data, pin_length)
 *         assertRV(retval)             # <<<<<<<<<<<<<<
 * 
 *     def create_object(self, attrs):
*/
  __pyx_t_1 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 931, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 931, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pkcs11/_pkcs11.pyx":920
 *                 yield from batch
 * 
 *     def reaffirm_credentials(self, pin):             # <<<<<<<<<<<<<<
 *         cdef CK_UTF8CHAR *pin_data
 *         cdef CK_ULONG pin_length
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pkcs11._pkcs11.Session.reaffirm_credentials", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pin);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":933
 *         assertRV(retval)
 * 
 *     def create_object(self, attrs):             # <<<<<<<<<<<<<<
 *         template = self.make_attribute_list(attrs)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_12create_object(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_7Session_12create_object = {"create_object", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_12create_object, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_12create_object(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_attrs = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create_object (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_attrs,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 933, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 933, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "create_object", 0) < (0)) __PYX_ERR(0, 933, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("create_object", 1, 1, 1, i); __PYX_ERR(0, 933, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 933, __pyx_L3_error)
    }
    __pyx_v_attrs = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create_object", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 933, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.Session.create_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_7Session_11create_object(((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_v_self), __pyx_v_attrs);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_11create_object(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, PyObject *__pyx_v_attrs) {
  struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_template = NULL;
  CK_OBJECT_HANDLE __pyx_v_handle;
  CK_ATTRIBUTE *__pyx_v_attr_data;
  CK_ULONG __pyx_v_attr_count;
  CK_OBJECT_HANDLE __pyx_v_new;
  CK_RV __pyx_v_retval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  CK_SESSION_HANDLE __pyx_t_2;
  CK_ATTRIBUTE *__pyx_t_3;
  CK_ULONG __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("create_object", 0);

  /* "pkcs11/_pkcs11.pyx":934
 * 
 *     def create_object(self, attrs):
 *         template = self.make_attribute_list(attrs)             # <<<<<<<<<<<<<<
 * 
 *         cdef CK_OBJECT_HANDLE handle = self.handle
*/
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_Session *)__pyx_v_self->__pyx_vtab)->make_attribute_list(__pyx_v_self, __pyx_v_attrs)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_template = ((struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":936
 *         template = self.make_attribute_list(attrs)
 * 
 *         cdef CK_OBJECT_HANDLE handle = self.handle             # <<<<<<<<<<<<<<
 *         cdef CK_ATTRIBUTE *attr_data = template.data
 *         cdef CK_ULONG attr_count = template.count
*/
  __pyx_t_2 = __pyx_v_self->handle;
  __pyx_v_handle = __pyx_t_2;

  /* "pkcs11/_pkcs11.pyx":937
 * 
 *         cdef CK_OBJECT_HANDLE handle = self.handle
 *         cdef CK_ATTRIBUTE *attr_data = template.data             # <<<<<<<<<<<<<<
 *         cdef CK_ULONG attr_count = template.count
 *         cdef CK_OBJECT_HANDLE new
*/
  __pyx_t_3 = __pyx_v_template->data;
  __pyx_v_attr_data = __pyx_t_3;

  /* "pkcs11/_pkcs11.pyx":938
 *         cdef CK_OBJECT_HANDLE handle = self.handle
 *         cdef CK_ATTRIBUTE *attr_data = template.data
 *         cdef CK_ULONG attr_count = template.count             # <<<<<<<<<<<<<<
 *         cdef CK_OBJECT_HANDLE new
 *         cdef CK_RV retval
*/
  __pyx_t_4 = __pyx_v_template->count;
  __pyx_v_attr_count = __pyx_t_4;

  /* "pkcs11/_pkcs11.pyx":942
 *         cdef CK_RV retval
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_CreateObject(handle, attr_data, attr_count, &new)
 *         assertRV(retval)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":943
 * 
 *         with nogil:
 *             retval = self.funclist.C_CreateObject(handle, attr_data, attr_count, &new)             # <<<<<<<<<<<<<<
 *         assertRV(retval)
 * 
*/
        __pyx_v_retval = __pyx_v_self->__pyx_base.funclist->C_CreateObject(__pyx_v_handle, __pyx_v_attr_data, __pyx_v_attr_count, (&__pyx_v_new));
      }

      /* "pkcs11/_pkcs11.pyx":942
 *         cdef CK_RV retval
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_CreateObject(handle, attr_data, attr_count, &new)
 *         assertRV(retval)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":944
 *         with nogil:
 *             retval = self.funclist.C_CreateObject(handle, attr_data, attr_count, &new)
 *         assertRV(retval)             # <<<<<<<<<<<<<<
 * 
 *         return make_object(self, new)
*/
  __pyx_t_1 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 944, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 944, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":946
 *         assertRV(retval)
 * 
 *         return make_object(self, new)             # <<<<<<<<<<<<<<
 * 
 *     def create_domain_parameters(self, key_type, attrs,
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __pyx_f_6pkcs11_7_pkcs11_make_object(__pyx_v_self, __pyx_v_new); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 946, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":933
 *         assertRV(retval)
 * 
 *     def create_object(self, attrs):             # <<<<<<<<<<<<<<
 *         template = self.make_attribute_list(attrs)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pkcs11._pkcs11.Session.create_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_template);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":948
 *         return make_object(self, new)
 * 
 *     def create_domain_parameters(self, key_type, attrs,             # <<<<<<<<<<<<<<
 *                                  local=False, store=False):
 *         if local and store:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_14create_domain_parameters(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_7Session_14create_domain_parameters = {"create_domain_parameters", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_14create_domain_parameters, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_14create_domain_parameters(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key_type = 0;
  PyObject *__pyx_v_attrs = 0;
  PyObject *__pyx_v_local = 0;
  PyObject *__pyx_v_store = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create_domain_parameters (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_key_type,&__pyx_mstate_global->__pyx_n_u_attrs,&__pyx_mstate_global->__pyx_n_u_local,&__pyx_mstate_global->__pyx_n_u_store,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 948, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 948, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 948, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 948, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 948, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "create_domain_parameters", 0) < (0)) __PYX_ERR(0, 948, __pyx_L3_error)

      /* "pkcs11/_pkcs11.pyx":949
 * 
 *     def create_domain_parameters(self, key_type, attrs,
 *                                  local=False, store=False):             # <<<<<<<<<<<<<<
 *         if local and store:
 *             raise ArgumentsBad("Cannot set both `local` and `store`")
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_False));
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("create_domain_parameters", 0, 2, 4, i); __PYX_ERR(0, 948, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 948, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 948, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 948, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 948, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_False));
    }
    __pyx_v_key_type = values[0];
    __pyx_v_attrs = values[1];
    __pyx_v_local = values[2];
    __pyx_v_store = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create_domain_parameters", 0, 2, 4, __pyx_nargs); __PYX_ERR(0, 948, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.Session.create_domain_parameters", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_7Session_13create_domain_parameters(((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_v_self), __pyx_v_key_type, __pyx_v_attrs, __pyx_v_local, __pyx_v_store);

  /* "pkcs11/_pkcs11.pyx":948
 *         return make_object(self, new)
 * 
 *     def create_domain_parameters(self, key_type, attrs,             # <<<<<<<<<<<<<<
 *                                  local=False, store=False):
 *         if local and store:
*/

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_13create_domain_parameters(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, PyObject *__pyx_v_key_type, PyObject *__pyx_v_attrs, PyObject *__pyx_v_local, PyObject *__pyx_v_store) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("create_domain_parameters", 0);
  __Pyx_INCREF(__pyx_v_attrs);

  /* "pkcs11/_pkcs11.pyx":950
 *     def create_domain_parameters(self, key_type, attrs,
 *                                  local=False, store=False):
 *         if local and store:             # <<<<<<<<<<<<<<
 *             raise ArgumentsBad("Cannot set both `local` and `store`")
 * 
*/
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_local); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 950, __pyx_L1_error)
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_store); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 950, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "pkcs11/_pkcs11.pyx":951
 *                                  local=False, store=False):
 *         if local and store:
 *             raise ArgumentsBad("Cannot set both `local` and `store`")             # <<<<<<<<<<<<<<
 * 
 *         attrs = dict(attrs)
*/
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ArgumentsBad); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 951, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Cannot_set_both_local_and_store};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 951, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(0, 951, __pyx_L1_error)

    /* "pkcs11/_pkcs11.pyx":950
 *     def create_domain_parameters(self, key_type, attrs,
 *                                  local=False, store=False):
 *         if local and store:             # <<<<<<<<<<<<<<
 *             raise ArgumentsBad("Cannot set both `local` and `store`")
 * 
*/
  }

  /* "pkcs11/_pkcs11.pyx":953
 *             raise ArgumentsBad("Cannot set both `local` and `store`")
 * 
 *         attrs = dict(attrs)             # <<<<<<<<<<<<<<
 *         attrs[Attribute.CLASS] = ObjectClass.DOMAIN_PARAMETERS
 *         attrs[Attribute.KEY_TYPE] = key_type
*/
  __pyx_t_5 = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_attrs};
    __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(&PyDict_Type), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 953, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __Pyx_DECREF_SET(__pyx_v_attrs, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "pkcs11/_pkcs11.pyx":954
 * 
 *         attrs = dict(attrs)
 *         attrs[Attribute.CLASS] = ObjectClass.DOMAIN_PARAMETERS             # <<<<<<<<<<<<<<
 *         attrs[Attribute.KEY_TYPE] = key_type
 *         attrs[Attribute.TOKEN] = store
*/
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ObjectClass); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_DOMAIN_PARAMETERS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Attribute); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_CLASS); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely((PyObject_SetItem(__pyx_v_attrs, __pyx_t_4, __pyx_t_5) < 0))) __PYX_ERR(0, 954, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":955
 *         attrs = dict(attrs)
 *         attrs[Attribute.CLASS] = ObjectClass.DOMAIN_PARAMETERS
 *         attrs[Attribute.KEY_TYPE] = key_type             # <<<<<<<<<<<<<<
 *         attrs[Attribute.TOKEN] = store
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Attribute); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 955, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_KEY_TYPE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 955, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely((PyObject_SetItem(__pyx_v_attrs, __pyx_t_4, __pyx_v_key_type) < 0))) __PYX_ERR(0, 955, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":956
 *         attrs[Attribute.CLASS] = ObjectClass.DOMAIN_PARAMETERS
 *         attrs[Attribute.KEY_TYPE] = key_type
 *         attrs[Attribute.TOKEN] = store             # <<<<<<<<<<<<<<
 * 
 *         if local:
*/
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Attribute); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 956, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_TOKEN); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 956, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely((PyObject_SetItem(__pyx_v_attrs, __pyx_t_5, __pyx_v_store) < 0))) __PYX_ERR(0, 956, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":958
 *         attrs[Attribute.TOKEN] = store
 * 
 *         if local:             # <<<<<<<<<<<<<<
 *             return LocalDomainParameters(self, attrs)
 *         else:
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_local); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 958, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "pkcs11/_pkcs11.pyx":959
 * 
 *         if local:
 *             return LocalDomainParameters(self, attrs)             # <<<<<<<<<<<<<<
 *         else:
 *             return self.create_object(attrs)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_LocalDomainParameters); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 959, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_4, ((PyObject *)__pyx_v_self), __pyx_v_attrs};
      __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 959, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "pkcs11/_pkcs11.pyx":958
 *         attrs[Attribute.TOKEN] = store
 * 
 *         if local:             # <<<<<<<<<<<<<<
 *             return LocalDomainParameters(self, attrs)
 *         else:
*/
  }

  /* "pkcs11/_pkcs11.pyx":961
 *             return LocalDomainParameters(self, attrs)
 *         else:
 *             return self.create_object(attrs)             # <<<<<<<<<<<<<<
 * 
 *     def generate_domain_parameters(self, key_type, param_length, store=False,
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((PyObject *)__pyx_v_self);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_attrs};
      __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_create_object, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 961, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
  }

  /* "pkcs11/_pkcs11.pyx":948
 *         return make_object(self, new)
 * 
 *     def create_domain_parameters(self, key_type, attrs,             # <<<<<<<<<<<<<<
 *                                  local=False, store=False):
 *         if local and store:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pkcs11._pkcs11.Session.create_domain_parameters", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_attrs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":963
 *             return self.create_object(attrs)
 * 
 *     def generate_domain_parameters(self, key_type, param_length, store=False,             # <<<<<<<<<<<<<<
 *                                    mechanism=None, mechanism_param=None,
 *                                    template=None):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_16generate_domain_parameters(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_7Session_16generate_domain_parameters = {"generate_domain_parameters", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_16generate_domain_parameters, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_16generate_domain_parameters(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key_type = 0;
  PyObject *__pyx_v_param_length = 0;
  PyObject *__pyx_v_store = 0;
  PyObject *__pyx_v_mechanism = 0;
  PyObject *__pyx_v_mechanism_param = 0;
  PyObject *__pyx_v_template = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[6] = {0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("generate_domain_parameters (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_key_type,&__pyx_mstate_global->__pyx_n_u_param_length,&__pyx_mstate_global->__pyx_n_u_store,&__pyx_mstate_global->__pyx_n_u_mechanism,&__pyx_mstate_global->__pyx_n_u_mechanism_param,&__pyx_mstate_global->__pyx_n_u_template,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 963, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 963, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 963, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 963, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 963, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 963, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 963, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "generate_domain_parameters", 0) < (0)) __PYX_ERR(0, 963, __pyx_L3_error)
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_False));

      /* "pkcs11/_pkcs11.pyx":964
 * 
 *     def generate_domain_parameters(self, key_type, param_length, store=False,
 *                                    mechanism=None, mechanism_param=None,             # <<<<<<<<<<<<<<
 *                                    template=None):
 *         if not isinstance(key_type, KeyType):
*/
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":965
 *     def generate_domain_parameters(self, key_type, param_length, store=False,
 *                                    mechanism=None, mechanism_param=None,
 *                                    template=None):             # <<<<<<<<<<<<<<
 *         if not isinstance(key_type, KeyType):
 *             raise ArgumentsBad("`key_type` must be KeyType.")
*/
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("generate_domain_parameters", 0, 2, 6, i); __PYX_ERR(0, 963, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 963, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 963, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 963, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 963, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 963, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 963, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }

      /* "pkcs11/_pkcs11.pyx":963
 *             return self.create_object(attrs)
 * 
 *     def generate_domain_parameters(self, key_type, param_length, store=False,             # <<<<<<<<<<<<<<
 *                                    mechanism=None, mechanism_param=None,
 *                                    template=None):
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_False));

      /* "pkcs11/_pkcs11.pyx":964
 * 
 *     def generate_domain_parameters(self, key_type, param_length, store=False,
 *                                    mechanism=None, mechanism_param=None,             # <<<<<<<<<<<<<<
 *                                    template=None):
 *         if not isinstance(key_type, KeyType):
*/
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":965
 *     def generate_domain_parameters(self, key_type, param_length, store=False,
 *                                    mechanism=None, mechanism_param=None,
 *                                    template=None):             # <<<<<<<<<<<<<<
 *         if not isinstance(key_type, KeyType):
 *             raise ArgumentsBad("`key_type` must be KeyType.")
*/
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_key_type = values[0];
    __pyx_v_param_length = values[1];
    __pyx_v_store = values[2];
    __pyx_v_mechanism = values[3];
    __pyx_v_mechanism_param = values[4];
    __pyx_v_template = values[5];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("generate_domain_parameters", 0, 2, 6, __pyx_nargs); __PYX_ERR(0, 963, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.Session.generate_domain_parameters", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_7Session_15generate_domain_parameters(((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_v_self), __pyx_v_key_type, __pyx_v_param_length, __pyx_v_store, __pyx_v_mechanism, __pyx_v_mechanism_param, __pyx_v_template);

  /* "pkcs11/_pkcs11.pyx":963
 *             return self.create_object(attrs)
 * 
 *     def generate_domain_parameters(self, key_type, param_length, store=False,             # <<<<<<<<<<<<<<
 *                                    mechanism=None, mechanism_param=None,
 *                                    template=None):
*/

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_15generate_domain_parameters(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, PyObject *__pyx_v_key_type, PyObject *__pyx_v_param_length, PyObject *__pyx_v_store, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param, PyObject *__pyx_v_template) {
  struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_mech = NULL;
  PyObject *__pyx_v_template_ = NULL;
  struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_attrs = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("generate_domain_parameters", 0);

  /* "pkcs11/_pkcs11.pyx":966
 *                                    mechanism=None, mechanism_param=None,
 *                                    template=None):
 *         if not isinstance(key_type, KeyType):             # <<<<<<<<<<<<<<
 *             raise ArgumentsBad("`key_type` must be KeyType.")
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_KeyType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 966, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_key_type, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 966, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!__pyx_t_2);
  if (unlikely(__pyx_t_3)) {

    /* "pkcs11/_pkcs11.pyx":967
 *                                    template=None):
 *         if not isinstance(key_type, KeyType):
 *             raise ArgumentsBad("`key_type` must be KeyType.")             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(param_length, int):
*/
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ArgumentsBad); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 967, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_key_type_must_be_KeyType};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 967, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 967, __pyx_L1_error)

    /* "pkcs11/_pkcs11.pyx":966
 *                                    mechanism=None, mechanism_param=None,
 *                                    template=None):
 *         if not isinstance(key_type, KeyType):             # <<<<<<<<<<<<<<
 *             raise ArgumentsBad("`key_type` must be KeyType.")
 * 
*/
  }

  /* "pkcs11/_pkcs11.pyx":969
 *             raise ArgumentsBad("`key_type` must be KeyType.")
 * 
 *         if not isinstance(param_length, int):             # <<<<<<<<<<<<<<
 *             raise ArgumentsBad("`param_length` is the length in bits.")
 * 
*/
  __pyx_t_3 = PyLong_Check(__pyx_v_param_length); 
  __pyx_t_2 = (!__pyx_t_3);
  if (unlikely(__pyx_t_2)) {

    /* "pkcs11/_pkcs11.pyx":970
 * 
 *         if not isinstance(param_length, int):
 *             raise ArgumentsBad("`param_length` is the length in bits.")             # <<<<<<<<<<<<<<
 * 
 *         mech = MechanismWithParam(
*/
    __pyx_t_5 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_ArgumentsBad); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 970, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_5);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_param_length_is_the_length_in_b};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 970, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 970, __pyx_L1_error)

    /* "pkcs11/_pkcs11.pyx":969
 *             raise ArgumentsBad("`key_type` must be KeyType.")
 * 
 *         if not isinstance(param_length, int):             # <<<<<<<<<<<<<<
 *             raise ArgumentsBad("`param_length` is the length in bits.")
 * 
*/
  }

  /* "pkcs11/_pkcs11.pyx":972
 *             raise ArgumentsBad("`param_length` is the length in bits.")
 * 
 *         mech = MechanismWithParam(             # <<<<<<<<<<<<<<
 *             key_type, DEFAULT_PARAM_GENERATE_MECHANISMS,
 *             mechanism, mechanism_param)
*/
  __pyx_t_4 = NULL;

  /* "pkcs11/_pkcs11.pyx":973
 * 
 *         mech = MechanismWithParam(
 *             key_type, DEFAULT_PARAM_GENERATE_MECHANISMS,             # <<<<<<<<<<<<<<
 *             mechanism, mechanism_param)
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_DEFAULT_PARAM_GENERATE_MECHANISM); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 973, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "pkcs11/_pkcs11.pyx":974
 *         mech = MechanismWithParam(
 *             key_type, DEFAULT_PARAM_GENERATE_MECHANISMS,
 *             mechanism, mechanism_param)             # <<<<<<<<<<<<<<
 * 
 *         template_ = {
*/
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[5] = {__pyx_t_4, __pyx_v_key_type, __pyx_t_5, __pyx_v_mechanism, __pyx_v_mechanism_param};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_MechanismWithParam, __pyx_callargs+__pyx_t_6, (5-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 972, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_mech = ((struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":977
 * 
 *         template_ = {
 *             Attribute.CLASS: ObjectClass.DOMAIN_PARAMETERS,             # <<<<<<<<<<<<<<
 *             Attribute.TOKEN: store,
 *             Attribute.PRIME_BITS: param_length,
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 977, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Attribute); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 977, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_CLASS); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 977, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ObjectClass); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 977, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_DOMAIN_PARAMETERS); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 977, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_t_4, __pyx_t_7) < (0)) __PYX_ERR(0, 977, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pkcs11/_pkcs11.pyx":978
 *         template_ = {
 *             Attribute.CLASS: ObjectClass.DOMAIN_PARAMETERS,
 *             Attribute.TOKEN: store,             # <<<<<<<<<<<<<<
 *             Attribute.PRIME_BITS: param_length,
 *         }
*/
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Attribute); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 978, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_TOKEN); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 978, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_t_4, __pyx_v_store) < (0)) __PYX_ERR(0, 977, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":979
 *             Attribute.CLASS: ObjectClass.DOMAIN_PARAMETERS,
 *             Attribute.TOKEN: store,
 *             Attribute.PRIME_BITS: param_length,             # <<<<<<<<<<<<<<
 *         }
 *         attrs = self.make_attribute_list(merge_templates(template_, template))
*/
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Attribute); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 979, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_PRIME_BITS); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 979, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_t_7, __pyx_v_param_length) < (0)) __PYX_ERR(0, 977, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_template_ = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":981
 *             Attribute.PRIME_BITS: param_length,
 *         }
 *         attrs = self.make_attribute_list(merge_templates(template_, template))             # <<<<<<<<<<<<<<
 * 
 *         return self.generate_key_from_attrs(attrs, mech)
*/
  __pyx_t_7 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_merge_templates); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 981, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_7);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_7);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_v_template_, __pyx_v_template};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 981, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = ((PyObject *)((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_Session *)__pyx_v_self->__pyx_vtab)->make_attribute_list(__pyx_v_self, __pyx_t_1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 981, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_attrs = ((struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":983
 *         attrs = self.make_attribute_list(merge_templates(template_, template))
 * 
 *         return self.generate_key_from_attrs(attrs, mech)             # <<<<<<<<<<<<<<
 * 
 *     cdef AttributeList make_attribute_list(self, template):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_Session *)__pyx_v_self->__pyx_vtab)->generate_key_from_attrs(__pyx_v_self, __pyx_v_attrs, __pyx_v_mech); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 983, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":963
 *             return self.create_object(attrs)
 * 
 *     def generate_domain_parameters(self, key_type, param_length, store=False,             # <<<<<<<<<<<<<<
 *                                    mechanism=None, mechanism_param=None,
 *                                    template=None):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pkcs11._pkcs11.Session.generate_domain_parameters", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mech);
  __Pyx_XDECREF(__pyx_v_template_);
  __Pyx_XDECREF((PyObject *)__pyx_v_attrs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":985
 *         return self.generate_key_from_attrs(attrs, mech)
 * 
 *     cdef AttributeList make_attribute_list(self, template):             # <<<<<<<<<<<<<<
 *         return AttributeList.from_template(dict(template), self.attribute_mapper)
 * 
*/

static struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_f_6pkcs11_7_pkcs11_7Session_make_attribute_list(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, PyObject *__pyx_v_template) {
  struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("make_attribute_list", 0);

  /* "pkcs11/_pkcs11.pyx":986
 * 
 *     cdef AttributeList make_attribute_list(self, template):
 *         return AttributeList.from_template(dict(template), self.attribute_mapper)             # <<<<<<<<<<<<<<
 * 
 *     def generate_key(self, key_type, key_length=None,
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __pyx_t_2 = NULL;
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_template};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(&PyDict_Type), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 986, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = __pyx_v_self->attribute_mapper;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = ((PyObject *)__pyx_f_6pkcs11_7_pkcs11_13AttributeList_from_template(((PyObject*)__pyx_t_1), __pyx_t_2)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 986, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = ((struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *)__pyx_t_4);
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":985
 *         return self.generate_key_from_attrs(attrs, mech)
 * 
 *     cdef AttributeList make_attribute_list(self, template):             # <<<<<<<<<<<<<<
 *         return AttributeList.from_template(dict(template), self.attribute_mapper)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pkcs11._pkcs11.Session.make_attribute_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":988
 *         return AttributeList.from_template(dict(template), self.attribute_mapper)
 * 
 *     def generate_key(self, key_type, key_length=None,             # <<<<<<<<<<<<<<
 *                      id=None, label=None,
 *                      store=False, capabilities=None,
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_18generate_key(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_7Session_18generate_key = {"generate_key", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_18generate_key, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_18generate_key(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key_type = 0;
  PyObject *__pyx_v_key_length = 0;
  PyObject *__pyx_v_id = 0;
  PyObject *__pyx_v_label = 0;
  PyObject *__pyx_v_store = 0;
  PyObject *__pyx_v_capabilities = 0;
  PyObject *__pyx_v_mechanism = 0;
  PyObject *__pyx_v_mechanism_param = 0;
  PyObject *__pyx_v_template = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("generate_key (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_key_type,&__pyx_mstate_global->__pyx_n_u_key_length,&__pyx_mstate_global->__pyx_n_u_id,&__pyx_mstate_global->__pyx_n_u_label,&__pyx_mstate_global->__pyx_n_u_store,&__pyx_mstate_global->__pyx_n_u_capabilities,&__pyx_mstate_global->__pyx_n_u_mechanism,&__pyx_mstate_global->__pyx_n_u_mechanism_param,&__pyx_mstate_global->__pyx_n_u_template,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 988, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  9:
        values[8] = __Pyx_ArgRef_FASTCALL(__pyx_args, 8);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[8])) __PYX_ERR(0, 988, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  8:
        values[7] = __Pyx_ArgRef_FASTCALL(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 988, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 988, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 988, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 988, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 988, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 988, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 988, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 988, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "generate_key", 0) < (0)) __PYX_ERR(0, 988, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":989
 * 
 *     def generate_key(self, key_type, key_length=None,
 *                      id=None, label=None,             # <<<<<<<<<<<<<<
 *                      store=False, capabilities=None,
 *                      mechanism=None, mechanism_param=None,
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":990
 *     def generate_key(self, key_type, key_length=None,
 *                      id=None, label=None,
 *                      store=False, capabilities=None,             # <<<<<<<<<<<<<<
 *                      mechanism=None, mechanism_param=None,
 *                      template=None):
*/
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":991
 *                      id=None, label=None,
 *                      store=False, capabilities=None,
 *                      mechanism=None, mechanism_param=None,             # <<<<<<<<<<<<<<
 *                      template=None):
 * 
*/
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":992
 *                      store=False, capabilities=None,
 *                      mechanism=None, mechanism_param=None,
 *                      template=None):             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(key_type, KeyType):
*/
      if (!values[8]) values[8] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("generate_key", 0, 1, 9, i); __PYX_ERR(0, 988, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  9:
        values[8] = __Pyx_ArgRef_FASTCALL(__pyx_args, 8);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[8])) __PYX_ERR(0, 988, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  8:
        values[7] = __Pyx_ArgRef_FASTCALL(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 988, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 988, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 988, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 988, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 988, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 988, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 988, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 988, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }

      /* "pkcs11/_pkcs11.pyx":988
 *         return AttributeList.from_template(dict(template), self.attribute_mapper)
 * 
 *     def generate_key(self, key_type, key_length=None,             # <<<<<<<<<<<<<<
 *                      id=None, label=None,
 *                      store=False, capabilities=None,
*/
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":989
 * 
 *     def generate_key(self, key_type, key_length=None,
 *                      id=None, label=None,             # <<<<<<<<<<<<<<
 *                      store=False, capabilities=None,
 *                      mechanism=None, mechanism_param=None,
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":990
 *     def generate_key(self, key_type, key_length=None,
 *                      id=None, label=None,
 *                      store=False, capabilities=None,             # <<<<<<<<<<<<<<
 *                      mechanism=None, mechanism_param=None,
 *                      template=None):
*/
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":991
 *                      id=None, label=None,
 *                      store=False, capabilities=None,
 *                      mechanism=None, mechanism_param=None,             # <<<<<<<<<<<<<<
 *                      template=None):
 * 
*/
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":992
 *                      store=False, capabilities=None,
 *                      mechanism=None, mechanism_param=None,
 *                      template=None):             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(key_type, KeyType):
*/
      if (!values[8]) values[8] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_key_type = values[0];
    __pyx_v_key_length = values[1];
    __pyx_v_id = values[2];
    __pyx_v_label = values[3];
    __pyx_v_store = values[4];
    __pyx_v_capabilities = values[5];
    __pyx_v_mechanism = values[6];
    __pyx_v_mechanism_param = values[7];
    __pyx_v_template = values[8];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("generate_key", 0, 1, 9, __pyx_nargs); __PYX_ERR(0, 988, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.Session.generate_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_7Session_17generate_key(((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_v_self), __pyx_v_key_type, __pyx_v_key_length, __pyx_v_id, __pyx_v_label, __pyx_v_store, __pyx_v_capabilities, __pyx_v_mechanism, __pyx_v_mechanism_param, __pyx_v_template);

  /* "pkcs11/_pkcs11.pyx":988
 *         return AttributeList.from_template(dict(template), self.attribute_mapper)
 * 
 *     def generate_key(self, key_type, key_length=None,             # <<<<<<<<<<<<<<
 *                      id=None, label=None,
 *                      store=False, capabilities=None,
*/

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_17generate_key(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, PyObject *__pyx_v_key_type, PyObject *__pyx_v_key_length, PyObject *__pyx_v_id, PyObject *__pyx_v_label, PyObject *__pyx_v_store, PyObject *__pyx_v_capabilities, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param, PyObject *__pyx_v_template) {
  struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_mech = NULL;
  PyObject *__pyx_v_template_ = NULL;
  struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_attrs = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("generate_key", 0);
  __Pyx_INCREF(__pyx_v_capabilities);

  /* "pkcs11/_pkcs11.pyx":994
 *                      template=None):
 * 
 *         if not isinstance(key_type, KeyType):             # <<<<<<<<<<<<<<
 *             raise ArgumentsBad("`key_type` must be KeyType.")
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_KeyType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 994, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_key_type, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 994, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!__pyx_t_2);
  if (unlikely(__pyx_t_3)) {

    /* "pkcs11/_pkcs11.pyx":995
 * 
 *         if not isinstance(key_type, KeyType):
 *             raise ArgumentsBad("`key_type` must be KeyType.")             # <<<<<<<<<<<<<<
 * 
 *         if key_length is not None and not isinstance(key_length, int):
*/
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ArgumentsBad); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 995, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_key_type_must_be_KeyType};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 995, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 995, __pyx_L1_error)

    /* "pkcs11/_pkcs11.pyx":994
 *                      template=None):
 * 
 *         if not isinstance(key_type, KeyType):             # <<<<<<<<<<<<<<
 *             raise ArgumentsBad("`key_type` must be KeyType.")
 * 
*/
  }

  /* "pkcs11/_pkcs11.pyx":997
 *             raise ArgumentsBad("`key_type` must be KeyType.")
 * 
 *         if key_length is not None and not isinstance(key_length, int):             # <<<<<<<<<<<<<<
 *             raise ArgumentsBad("`key_length` is the length in bits.")
 * 
*/
  __pyx_t_2 = (__pyx_v_key_length != Py_None);
  if (__pyx_t_2) {
  } else {
    __pyx_t_3 = __pyx_t_2;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_2 = PyLong_Check(__pyx_v_key_length); 
  __pyx_t_7 = (!__pyx_t_2);
  __pyx_t_3 = __pyx_t_7;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_3)) {

    /* "pkcs11/_pkcs11.pyx":998
 * 
 *         if key_length is not None and not isinstance(key_length, int):
 *             raise ArgumentsBad("`key_length` is the length in bits.")             # <<<<<<<<<<<<<<
 * 
 *         if capabilities is None:
*/
    __pyx_t_5 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_ArgumentsBad); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 998, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_5);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_key_length_is_the_length_in_bit};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 998, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 998, __pyx_L1_error)

    /* "pkcs11/_pkcs11.pyx":997
 *             raise ArgumentsBad("`key_type` must be KeyType.")
 * 
 *         if key_length is not None and not isinstance(key_length, int):             # <<<<<<<<<<<<<<
 *             raise ArgumentsBad("`key_length` is the length in bits.")
 * 
*/
  }

  /* "pkcs11/_pkcs11.pyx":1000
 *             raise ArgumentsBad("`key_length` is the length in bits.")
 * 
 *         if capabilities is None:             # <<<<<<<<<<<<<<
 *             try:
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[key_type]
*/
  __pyx_t_3 = (__pyx_v_capabilities == Py_None);
  if (__pyx_t_3) {

    /* "pkcs11/_pkcs11.pyx":1001
 * 
 *         if capabilities is None:
 *             try:             # <<<<<<<<<<<<<<
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[key_type]
 *             except KeyError:
*/
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":1002
 *         if capabilities is None:
 *             try:
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[key_type]             # <<<<<<<<<<<<<<
 *             except KeyError:
 *                 raise ArgumentsBad("No default capabilities for this key "
*/
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_DEFAULT_KEY_CAPABILITIES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1002, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_key_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1002, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF_SET(__pyx_v_capabilities, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "pkcs11/_pkcs11.pyx":1001
 * 
 *         if capabilities is None:
 *             try:             # <<<<<<<<<<<<<<
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[key_type]
 *             except KeyError:
*/
      }
      __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_L13_try_end;
      __pyx_L8_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "pkcs11/_pkcs11.pyx":1003
 *             try:
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[key_type]
 *             except KeyError:             # <<<<<<<<<<<<<<
 *                 raise ArgumentsBad("No default capabilities for this key "
 *                                    "type. Please specify `capabilities`.")
*/
      __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_KeyError))));
      if (__pyx_t_11) {
        __Pyx_AddTraceback("pkcs11._pkcs11.Session.generate_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_1, &__pyx_t_5) < 0) __PYX_ERR(0, 1003, __pyx_L10_except_error)
        __Pyx_XGOTREF(__pyx_t_4);
        __Pyx_XGOTREF(__pyx_t_1);
        __Pyx_XGOTREF(__pyx_t_5);

        /* "pkcs11/_pkcs11.pyx":1004
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[key_type]
 *             except KeyError:
 *                 raise ArgumentsBad("No default capabilities for this key "             # <<<<<<<<<<<<<<
 *                                    "type. Please specify `capabilities`.")
 * 
*/
        __pyx_t_13 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_ArgumentsBad); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1004, __pyx_L10_except_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_6 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_14))) {
          __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_14);
          assert(__pyx_t_13);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_14);
          __Pyx_INCREF(__pyx_t_13);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_14, __pyx__function);
          __pyx_t_6 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_mstate_global->__pyx_kp_u_No_default_capabilities_for_this};
          __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_14, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1004, __pyx_L10_except_error)
          __Pyx_GOTREF(__pyx_t_12);
        }
        __Pyx_Raise(__pyx_t_12, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __PYX_ERR(0, 1004, __pyx_L10_except_error)
      }
      goto __pyx_L10_except_error;

      /* "pkcs11/_pkcs11.pyx":1001
 * 
 *         if capabilities is None:
 *             try:             # <<<<<<<<<<<<<<
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[key_type]
 *             except KeyError:
*/
      __pyx_L10_except_error:;
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      goto __pyx_L1_error;
      __pyx_L13_try_end:;
    }

    /* "pkcs11/_pkcs11.pyx":1000
 *             raise ArgumentsBad("`key_length` is the length in bits.")
 * 
 *         if capabilities is None:             # <<<<<<<<<<<<<<
 *             try:
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[key_type]
*/
  }

  /* "pkcs11/_pkcs11.pyx":1007
 *                                    "type. Please specify `capabilities`.")
 * 
 *         mech = MechanismWithParam(             # <<<<<<<<<<<<<<
 *             key_type, DEFAULT_GENERATE_MECHANISMS,
 *             mechanism, mechanism_param)
*/
  __pyx_t_1 = NULL;

  /* "pkcs11/_pkcs11.pyx":1008
 * 
 *         mech = MechanismWithParam(
 *             key_type, DEFAULT_GENERATE_MECHANISMS,             # <<<<<<<<<<<<<<
 *             mechanism, mechanism_param)
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_DEFAULT_GENERATE_MECHANISMS); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1008, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "pkcs11/_pkcs11.pyx":1009
 *         mech = MechanismWithParam(
 *             key_type, DEFAULT_GENERATE_MECHANISMS,
 *             mechanism, mechanism_param)             # <<<<<<<<<<<<<<
 * 
 *         template_ = self.attribute_mapper.secret_key_template(
*/
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[5] = {__pyx_t_1, __pyx_v_key_type, __pyx_t_4, __pyx_v_mechanism, __pyx_v_mechanism_param};
    __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_MechanismWithParam, __pyx_callargs+__pyx_t_6, (5-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1007, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_5);
  }
  __pyx_v_mech = ((struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":1011
 *             mechanism, mechanism_param)
 * 
 *         template_ = self.attribute_mapper.secret_key_template(             # <<<<<<<<<<<<<<
 *             capabilities=capabilities, id_=id, label=label, store=store,
 *         )
*/
  __pyx_t_4 = __pyx_v_self->attribute_mapper;
  __Pyx_INCREF(__pyx_t_4);

  /* "pkcs11/_pkcs11.pyx":1012
 * 
 *         template_ = self.attribute_mapper.secret_key_template(
 *             capabilities=capabilities, id_=id, label=label, store=store,             # <<<<<<<<<<<<<<
 *         )
 *         # Build attributes
*/
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 4 : 0)] = {__pyx_t_4, NULL};
    __pyx_t_1 = __Pyx_MakeVectorcallBuilderKwds(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1011, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_capabilities, __pyx_v_capabilities, __pyx_t_1, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 1011, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_id_2, __pyx_v_id, __pyx_t_1, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 1011, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_label, __pyx_v_label, __pyx_t_1, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 1011, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_store, __pyx_v_store, __pyx_t_1, __pyx_callargs+1, 3) < (0)) __PYX_ERR(0, 1011, __pyx_L1_error)
    __pyx_t_5 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_secret_key_template, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_1);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1011, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __pyx_v_template_ = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":1015
 *         )
 *         # Build attributes
 *         if key_type not in (KeyType.DES2, KeyType.DES3, KeyType.GOST28147, KeyType.SEED):             # <<<<<<<<<<<<<<
 *             if key_length is None:
 *                 raise ArgumentsBad("Must provide `key_length'")
*/
  __Pyx_INCREF(__pyx_v_key_type);
  __pyx_t_5 = __pyx_v_key_type;
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_KeyType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_DES2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1015, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 1015, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_7) {
  } else {
    __pyx_t_3 = __pyx_t_7;
    goto __pyx_L17_bool_binop_done;
  }
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_KeyType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_DES3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1015, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 1015, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_7) {
  } else {
    __pyx_t_3 = __pyx_t_7;
    goto __pyx_L17_bool_binop_done;
  }
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_KeyType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_GOST28147); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1015, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 1015, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_7) {
  } else {
    __pyx_t_3 = __pyx_t_7;
    goto __pyx_L17_bool_binop_done;
  }
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_KeyType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_SEED); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1015, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 1015, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __pyx_t_7;
  __pyx_L17_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_7 = __pyx_t_3;
  if (__pyx_t_7) {

    /* "pkcs11/_pkcs11.pyx":1016
 *         # Build attributes
 *         if key_type not in (KeyType.DES2, KeyType.DES3, KeyType.GOST28147, KeyType.SEED):
 *             if key_length is None:             # <<<<<<<<<<<<<<
 *                 raise ArgumentsBad("Must provide `key_length'")
 * 
*/
    __pyx_t_7 = (__pyx_v_key_length == Py_None);
    if (unlikely(__pyx_t_7)) {

      /* "pkcs11/_pkcs11.pyx":1017
 *         if key_type not in (KeyType.DES2, KeyType.DES3, KeyType.GOST28147, KeyType.SEED):
 *             if key_length is None:
 *                 raise ArgumentsBad("Must provide `key_length'")             # <<<<<<<<<<<<<<
 * 
 *             template_[Attribute.VALUE_LEN] = key_length // 8  # In bytes
*/
      __pyx_t_1 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_ArgumentsBad); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1017, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
        assert(__pyx_t_1);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
        __pyx_t_6 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_Must_provide_key_length};
        __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1017, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(0, 1017, __pyx_L1_error)

      /* "pkcs11/_pkcs11.pyx":1016
 *         # Build attributes
 *         if key_type not in (KeyType.DES2, KeyType.DES3, KeyType.GOST28147, KeyType.SEED):
 *             if key_length is None:             # <<<<<<<<<<<<<<
 *                 raise ArgumentsBad("Must provide `key_length'")
 * 
*/
    }

    /* "pkcs11/_pkcs11.pyx":1019
 *                 raise ArgumentsBad("Must provide `key_length'")
 * 
 *             template_[Attribute.VALUE_LEN] = key_length // 8  # In bytes             # <<<<<<<<<<<<<<
 * 
 *         attrs = self.make_attribute_list(merge_templates(template_, template))
*/
    __pyx_t_5 = __Pyx_PyLong_FloorDivideObjC(__pyx_v_key_length, __pyx_mstate_global->__pyx_int_8, 8, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1019, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Attribute); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1019, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_VALUE_LEN); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1019, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely((PyObject_SetItem(__pyx_v_template_, __pyx_t_1, __pyx_t_5) < 0))) __PYX_ERR(0, 1019, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "pkcs11/_pkcs11.pyx":1015
 *         )
 *         # Build attributes
 *         if key_type not in (KeyType.DES2, KeyType.DES3, KeyType.GOST28147, KeyType.SEED):             # <<<<<<<<<<<<<<
 *             if key_length is None:
 *                 raise ArgumentsBad("Must provide `key_length'")
*/
  }

  /* "pkcs11/_pkcs11.pyx":1021
 *             template_[Attribute.VALUE_LEN] = key_length // 8  # In bytes
 * 
 *         attrs = self.make_attribute_list(merge_templates(template_, template))             # <<<<<<<<<<<<<<
 * 
 *         return self.generate_key_from_attrs(attrs, mech)
*/
  __pyx_t_1 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_merge_templates); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1021, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_1);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_v_template_, __pyx_v_template};
    __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1021, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __pyx_t_4 = ((PyObject *)((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_Session *)__pyx_v_self->__pyx_vtab)->make_attribute_list(__pyx_v_self, __pyx_t_5)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1021, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_attrs = ((struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":1023
 *         attrs = self.make_attribute_list(merge_templates(template_, template))
 * 
 *         return self.generate_key_from_attrs(attrs, mech)             # <<<<<<<<<<<<<<
 * 
 *     cdef object generate_key_from_attrs(
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_Session *)__pyx_v_self->__pyx_vtab)->generate_key_from_attrs(__pyx_v_self, __pyx_v_attrs, __pyx_v_mech); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1023, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":988
 *         return AttributeList.from_template(dict(template), self.attribute_mapper)
 * 
 *     def generate_key(self, key_type, key_length=None,             # <<<<<<<<<<<<<<
 *                      id=None, label=None,
 *                      store=False, capabilities=None,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("pkcs11._pkcs11.Session.generate_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mech);
  __Pyx_XDECREF(__pyx_v_template_);
  __Pyx_XDECREF((PyObject *)__pyx_v_attrs);
  __Pyx_XDECREF(__pyx_v_capabilities);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1025
 *         return self.generate_key_from_attrs(attrs, mech)
 * 
 *     cdef object generate_key_from_attrs(             # <<<<<<<<<<<<<<
 *             self, AttributeList attrs, MechanismWithParam mech
 *     ):
*/

static PyObject *__pyx_f_6pkcs11_7_pkcs11_7Session_generate_key_from_attrs(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_attrs, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_mech) {
  CK_SESSION_HANDLE __pyx_v_handle;
  CK_MECHANISM *__pyx_v_mech_data;
  CK_ATTRIBUTE *__pyx_v_attr_data;
  CK_ULONG __pyx_v_attr_count;
  CK_OBJECT_HANDLE __pyx_v_key;
  CK_RV __pyx_v_retval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  CK_SESSION_HANDLE __pyx_t_1;
  CK_MECHANISM *__pyx_t_2;
  CK_ATTRIBUTE *__pyx_t_3;
  CK_ULONG __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("generate_key_from_attrs", 0);

  /* "pkcs11/_pkcs11.pyx":1028
 *             self, AttributeList attrs, MechanismWithParam mech
 *     ):
 *         cdef CK_SESSION_HANDLE handle = self.handle             # <<<<<<<<<<<<<<
 *         cdef CK_MECHANISM *mech_data = mech.data
 *         cdef CK_ATTRIBUTE *attr_data = attrs.data
*/
  __pyx_t_1 = __pyx_v_self->handle;
  __pyx_v_handle = __pyx_t_1;

  /* "pkcs11/_pkcs11.pyx":1029
 *     ):
 *         cdef CK_SESSION_HANDLE handle = self.handle
 *         cdef CK_MECHANISM *mech_data = mech.data             # <<<<<<<<<<<<<<
 *         cdef CK_ATTRIBUTE *attr_data = attrs.data
 *         cdef CK_ULONG attr_count = attrs.count
*/
  __pyx_t_2 = __pyx_v_mech->data;
  __pyx_v_mech_data = __pyx_t_2;

  /* "pkcs11/_pkcs11.pyx":1030
 *         cdef CK_SESSION_HANDLE handle = self.handle
 *         cdef CK_MECHANISM *mech_data = mech.data
 *         cdef CK_ATTRIBUTE *attr_data = attrs.data             # <<<<<<<<<<<<<<
 *         cdef CK_ULONG attr_count = attrs.count
 *         cdef CK_OBJECT_HANDLE key
*/
  __pyx_t_3 = __pyx_v_attrs->data;
  __pyx_v_attr_data = __pyx_t_3;

  /* "pkcs11/_pkcs11.pyx":1031
 *         cdef CK_MECHANISM *mech_data = mech.data
 *         cdef CK_ATTRIBUTE *attr_data = attrs.data
 *         cdef CK_ULONG attr_count = attrs.count             # <<<<<<<<<<<<<<
 *         cdef CK_OBJECT_HANDLE key
 * 
*/
  __pyx_t_4 = __pyx_v_attrs->count;
  __pyx_v_attr_count = __pyx_t_4;

  /* "pkcs11/_pkcs11.pyx":1034
 *         cdef CK_OBJECT_HANDLE key
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_GenerateKey(handle, mech_data, attr_data, attr_count, &key)
 *         assertRV(retval)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":1035
 * 
 *         with nogil:
 *             retval = self.funclist.C_GenerateKey(handle, mech_data, attr_data, attr_count, &key)             # <<<<<<<<<<<<<<
 *         assertRV(retval)
 * 
*/
        __pyx_v_retval = __pyx_v_self->__pyx_base.funclist->C_GenerateKey(__pyx_v_handle, __pyx_v_mech_data, __pyx_v_attr_data, __pyx_v_attr_count, (&__pyx_v_key));
      }

      /* "pkcs11/_pkcs11.pyx":1034
 *         cdef CK_OBJECT_HANDLE key
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_GenerateKey(handle, mech_data, attr_data, attr_count, &key)
 *         assertRV(retval)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":1036
 *         with nogil:
 *             retval = self.funclist.C_GenerateKey(handle, mech_data, attr_data, attr_count, &key)
 *         assertRV(retval)             # <<<<<<<<<<<<<<
 * 
 *         return make_object(self, key)
*/
  __pyx_t_5 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1036, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1036, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "pkcs11/_pkcs11.pyx":1038
 *         assertRV(retval)
 * 
 *         return make_object(self, key)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = __pyx_f_6pkcs11_7_pkcs11_make_object(__pyx_v_self, __pyx_v_key); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1038, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":1025
 *         return self.generate_key_from_attrs(attrs, mech)
 * 
 *     cdef object generate_key_from_attrs(             # <<<<<<<<<<<<<<
 *             self, AttributeList attrs, MechanismWithParam mech
 *     ):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pkcs11._pkcs11.Session.generate_key_from_attrs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1041
 * 
 * 
 *     def _generate_keypair(self, key_type, key_length=None,             # <<<<<<<<<<<<<<
 *                           id=None, label=None,
 *                           store=False, capabilities=None,
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_20_generate_keypair(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_7Session_20_generate_keypair = {"_generate_keypair", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_20_generate_keypair, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_20_generate_keypair(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key_type = 0;
  PyObject *__pyx_v_key_length = 0;
  PyObject *__pyx_v_id = 0;
  PyObject *__pyx_v_label = 0;
  PyObject *__pyx_v_store = 0;
  PyObject *__pyx_v_capabilities = 0;
  PyObject *__pyx_v_mechanism = 0;
  PyObject *__pyx_v_mechanism_param = 0;
  PyObject *__pyx_v_public_template = 0;
  PyObject *__pyx_v_private_template = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_generate_keypair (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_key_type,&__pyx_mstate_global->__pyx_n_u_key_length,&__pyx_mstate_global->__pyx_n_u_id,&__pyx_mstate_global->__pyx_n_u_label,&__pyx_mstate_global->__pyx_n_u_store,&__pyx_mstate_global->__pyx_n_u_capabilities,&__pyx_mstate_global->__pyx_n_u_mechanism,&__pyx_mstate_global->__pyx_n_u_mechanism_param,&__pyx_mstate_global->__pyx_n_u_public_template,&__pyx_mstate_global->__pyx_n_u_private_template,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1041, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case 10:
        values[9] = __Pyx_ArgRef_FASTCALL(__pyx_args, 9);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[9])) __PYX_ERR(0, 1041, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  9:
        values[8] = __Pyx_ArgRef_FASTCALL(__pyx_args, 8);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[8])) __PYX_ERR(0, 1041, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  8:
        values[7] = __Pyx_ArgRef_FASTCALL(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 1041, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 1041, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 1041, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1041, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1041, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1041, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1041, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1041, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_generate_keypair", 0) < (0)) __PYX_ERR(0, 1041, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":1042
 * 
 *     def _generate_keypair(self, key_type, key_length=None,
 *                           id=None, label=None,             # <<<<<<<<<<<<<<
 *                           store=False, capabilities=None,
 *                           mechanism=None, mechanism_param=None,
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":1043
 *     def _generate_keypair(self, key_type, key_length=None,
 *                           id=None, label=None,
 *                           store=False, capabilities=None,             # <<<<<<<<<<<<<<
 *                           mechanism=None, mechanism_param=None,
 *                           public_template=None, private_template=None):
*/
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":1044
 *                           id=None, label=None,
 *                           store=False, capabilities=None,
 *                           mechanism=None, mechanism_param=None,             # <<<<<<<<<<<<<<
 *                           public_template=None, private_template=None):
 * 
*/
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":1045
 *                           store=False, capabilities=None,
 *                           mechanism=None, mechanism_param=None,
 *                           public_template=None, private_template=None):             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(key_type, KeyType):
*/
      if (!values[8]) values[8] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[9]) values[9] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_generate_keypair", 0, 1, 10, i); __PYX_ERR(0, 1041, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case 10:
        values[9] = __Pyx_ArgRef_FASTCALL(__pyx_args, 9);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[9])) __PYX_ERR(0, 1041, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  9:
        values[8] = __Pyx_ArgRef_FASTCALL(__pyx_args, 8);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[8])) __PYX_ERR(0, 1041, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  8:
        values[7] = __Pyx_ArgRef_FASTCALL(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 1041, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 1041, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 1041, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1041, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1041, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1041, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1041, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1041, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }

      /* "pkcs11/_pkcs11.pyx":1041
 * 
 * 
 *     def _generate_keypair(self, key_type, key_length=None,             # <<<<<<<<<<<<<<
 *                           id=None, label=None,
 *                           store=False, capabilities=None,
*/
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":1042
 * 
 *     def _generate_keypair(self, key_type, key_length=None,
 *                           id=None, label=None,             # <<<<<<<<<<<<<<
 *                           store=False, capabilities=None,
 *                           mechanism=None, mechanism_param=None,
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":1043
 *     def _generate_keypair(self, key_type, key_length=None,
 *                           id=None, label=None,
 *                           store=False, capabilities=None,             # <<<<<<<<<<<<<<
 *                           mechanism=None, mechanism_param=None,
 *                           public_template=None, private_template=None):
*/
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":1044
 *                           id=None, label=None,
 *                           store=False, capabilities=None,
 *                           mechanism=None, mechanism_param=None,             # <<<<<<<<<<<<<<
 *                           public_template=None, private_template=None):
 * 
*/
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":1045
 *                           store=False, capabilities=None,
 *                           mechanism=None, mechanism_param=None,
 *                           public_template=None, private_template=None):             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(key_type, KeyType):
*/
      if (!values[8]) values[8] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[9]) values[9] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_key_type = values[0];
    __pyx_v_key_length = values[1];
    __pyx_v_id = values[2];
    __pyx_v_label = values[3];
    __pyx_v_store = values[4];
    __pyx_v_capabilities = values[5];
    __pyx_v_mechanism = values[6];
    __pyx_v_mechanism_param = values[7];
    __pyx_v_public_template = values[8];
    __pyx_v_private_template = values[9];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_generate_keypair", 0, 1, 10, __pyx_nargs); __PYX_ERR(0, 1041, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.Session._generate_keypair", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_7Session_19_generate_keypair(((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_v_self), __pyx_v_key_type, __pyx_v_key_length, __pyx_v_id, __pyx_v_label, __pyx_v_store, __pyx_v_capabilities, __pyx_v_mechanism, __pyx_v_mechanism_param, __pyx_v_public_template, __pyx_v_private_template);

  /* "pkcs11/_pkcs11.pyx":1041
 * 
 * 
 *     def _generate_keypair(self, key_type, key_length=None,             # <<<<<<<<<<<<<<
 *                           id=None, label=None,
 *                           store=False, capabilities=None,
*/

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_19_generate_keypair(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, PyObject *__pyx_v_key_type, PyObject *__pyx_v_key_length, PyObject *__pyx_v_id, PyObject *__pyx_v_label, PyObject *__pyx_v_store, PyObject *__pyx_v_capabilities, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param, PyObject *__pyx_v_public_template, PyObject *__pyx_v_private_template) {
  struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_mech = NULL;
  PyObject *__pyx_v_public_template_ = NULL;
  struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_public_attrs = NULL;
  PyObject *__pyx_v_private_template_ = NULL;
  struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_private_attrs = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_generate_keypair", 0);
  __Pyx_INCREF(__pyx_v_capabilities);

  /* "pkcs11/_pkcs11.pyx":1047
 *                           public_template=None, private_template=None):
 * 
 *         if not isinstance(key_type, KeyType):             # <<<<<<<<<<<<<<
 *             raise ArgumentsBad("`key_type` must be KeyType.")
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_KeyType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_key_type, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 1047, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!__pyx_t_2);
  if (unlikely(__pyx_t_3)) {

    /* "pkcs11/_pkcs11.pyx":1048
 * 
 *         if not isinstance(key_type, KeyType):
 *             raise ArgumentsBad("`key_type` must be KeyType.")             # <<<<<<<<<<<<<<
 * 
 *         if key_length is not None and not isinstance(key_length, int):
*/
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ArgumentsBad); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1048, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_key_type_must_be_KeyType};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1048, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 1048, __pyx_L1_error)

    /* "pkcs11/_pkcs11.pyx":1047
 *                           public_template=None, private_template=None):
 * 
 *         if not isinstance(key_type, KeyType):             # <<<<<<<<<<<<<<
 *             raise ArgumentsBad("`key_type` must be KeyType.")
 * 
*/
  }

  /* "pkcs11/_pkcs11.pyx":1050
 *             raise ArgumentsBad("`key_type` must be KeyType.")
 * 
 *         if key_length is not None and not isinstance(key_length, int):             # <<<<<<<<<<<<<<
 *             raise ArgumentsBad("`key_length` is the length in bits.")
 * 
*/
  __pyx_t_2 = (__pyx_v_key_length != Py_None);
  if (__pyx_t_2) {
  } else {
    __pyx_t_3 = __pyx_t_2;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_2 = PyLong_Check(__pyx_v_key_length); 
  __pyx_t_7 = (!__pyx_t_2);
  __pyx_t_3 = __pyx_t_7;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_3)) {

    /* "pkcs11/_pkcs11.pyx":1051
 * 
 *         if key_length is not None and not isinstance(key_length, int):
 *             raise ArgumentsBad("`key_length` is the length in bits.")             # <<<<<<<<<<<<<<
 * 
 *         if capabilities is None:
*/
    __pyx_t_5 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_ArgumentsBad); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1051, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_5);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_key_length_is_the_length_in_bit};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1051, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 1051, __pyx_L1_error)

    /* "pkcs11/_pkcs11.pyx":1050
 *             raise ArgumentsBad("`key_type` must be KeyType.")
 * 
 *         if key_length is not None and not isinstance(key_length, int):             # <<<<<<<<<<<<<<
 *             raise ArgumentsBad("`key_length` is the length in bits.")
 * 
*/
  }

  /* "pkcs11/_pkcs11.pyx":1053
 *             raise ArgumentsBad("`key_length` is the length in bits.")
 * 
 *         if capabilities is None:             # <<<<<<<<<<<<<<
 *             try:
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[key_type]
*/
  __pyx_t_3 = (__pyx_v_capabilities == Py_None);
  if (__pyx_t_3) {

    /* "pkcs11/_pkcs11.pyx":1054
 * 
 *         if capabilities is None:
 *             try:             # <<<<<<<<<<<<<<
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[key_type]
 *             except KeyError:
*/
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":1055
 *         if capabilities is None:
 *             try:
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[key_type]             # <<<<<<<<<<<<<<
 *             except KeyError:
 *                 raise ArgumentsBad("No default capabilities for this key "
*/
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_DEFAULT_KEY_CAPABILITIES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1055, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_key_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1055, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF_SET(__pyx_v_capabilities, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "pkcs11/_pkcs11.pyx":1054
 * 
 *         if capabilities is None:
 *             try:             # <<<<<<<<<<<<<<
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[key_type]
 *             except KeyError:
*/
      }
      __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_L13_try_end;
      __pyx_L8_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "pkcs11/_pkcs11.pyx":1056
 *             try:
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[key_type]
 *             except KeyError:             # <<<<<<<<<<<<<<
 *                 raise ArgumentsBad("No default capabilities for this key "
 *                                    "type. Please specify `capabilities`.")
*/
      __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_KeyError))));
      if (__pyx_t_11) {
        __Pyx_AddTraceback("pkcs11._pkcs11.Session._generate_keypair", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_1, &__pyx_t_5) < 0) __PYX_ERR(0, 1056, __pyx_L10_except_error)
        __Pyx_XGOTREF(__pyx_t_4);
        __Pyx_XGOTREF(__pyx_t_1);
        __Pyx_XGOTREF(__pyx_t_5);

        /* "pkcs11/_pkcs11.pyx":1057
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[key_type]
 *             except KeyError:
 *                 raise ArgumentsBad("No default capabilities for this key "             # <<<<<<<<<<<<<<
 *                                    "type. Please specify `capabilities`.")
 * 
*/
        __pyx_t_13 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_ArgumentsBad); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1057, __pyx_L10_except_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_6 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_14))) {
          __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_14);
          assert(__pyx_t_13);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_14);
          __Pyx_INCREF(__pyx_t_13);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_14, __pyx__function);
          __pyx_t_6 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_mstate_global->__pyx_kp_u_No_default_capabilities_for_this};
          __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_14, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1057, __pyx_L10_except_error)
          __Pyx_GOTREF(__pyx_t_12);
        }
        __Pyx_Raise(__pyx_t_12, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __PYX_ERR(0, 1057, __pyx_L10_except_error)
      }
      goto __pyx_L10_except_error;

      /* "pkcs11/_pkcs11.pyx":1054
 * 
 *         if capabilities is None:
 *             try:             # <<<<<<<<<<<<<<
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[key_type]
 *             except KeyError:
*/
      __pyx_L10_except_error:;
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      goto __pyx_L1_error;
      __pyx_L13_try_end:;
    }

    /* "pkcs11/_pkcs11.pyx":1053
 *             raise ArgumentsBad("`key_length` is the length in bits.")
 * 
 *         if capabilities is None:             # <<<<<<<<<<<<<<
 *             try:
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[key_type]
*/
  }

  /* "pkcs11/_pkcs11.pyx":1060
 *                                    "type. Please specify `capabilities`.")
 * 
 *         mech = MechanismWithParam(             # <<<<<<<<<<<<<<
 *             key_type, DEFAULT_GENERATE_MECHANISMS,
 *             mechanism, mechanism_param)
*/
  __pyx_t_1 = NULL;

  /* "pkcs11/_pkcs11.pyx":1061
 * 
 *         mech = MechanismWithParam(
 *             key_type, DEFAULT_GENERATE_MECHANISMS,             # <<<<<<<<<<<<<<
 *             mechanism, mechanism_param)
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_DEFAULT_GENERATE_MECHANISMS); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1061, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "pkcs11/_pkcs11.pyx":1062
 *         mech = MechanismWithParam(
 *             key_type, DEFAULT_GENERATE_MECHANISMS,
 *             mechanism, mechanism_param)             # <<<<<<<<<<<<<<
 * 
 *         public_template_ = self.attribute_mapper.public_key_template(
*/
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[5] = {__pyx_t_1, __pyx_v_key_type, __pyx_t_4, __pyx_v_mechanism, __pyx_v_mechanism_param};
    __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_MechanismWithParam, __pyx_callargs+__pyx_t_6, (5-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1060, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_5);
  }
  __pyx_v_mech = ((struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":1064
 *             mechanism, mechanism_param)
 * 
 *         public_template_ = self.attribute_mapper.public_key_template(             # <<<<<<<<<<<<<<
 *             id_=id, label=label, store=store, capabilities=capabilities,
 *         )
*/
  __pyx_t_4 = __pyx_v_self->attribute_mapper;
  __Pyx_INCREF(__pyx_t_4);

  /* "pkcs11/_pkcs11.pyx":1065
 * 
 *         public_template_ = self.attribute_mapper.public_key_template(
 *             id_=id, label=label, store=store, capabilities=capabilities,             # <<<<<<<<<<<<<<
 *         )
 * 
*/
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 4 : 0)] = {__pyx_t_4, NULL};
    __pyx_t_1 = __Pyx_MakeVectorcallBuilderKwds(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1064, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_id_2, __pyx_v_id, __pyx_t_1, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 1064, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_label, __pyx_v_label, __pyx_t_1, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 1064, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_store, __pyx_v_store, __pyx_t_1, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 1064, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_capabilities, __pyx_v_capabilities, __pyx_t_1, __pyx_callargs+1, 3) < (0)) __PYX_ERR(0, 1064, __pyx_L1_error)
    __pyx_t_5 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_public_key_template, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_1);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1064, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __pyx_v_public_template_ = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":1068
 *         )
 * 
 *         if key_type is KeyType.RSA:             # <<<<<<<<<<<<<<
 *             if key_length is None:
 *                 raise ArgumentsBad("Must provide `key_length'")
*/
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_KeyType); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1068, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_RSA); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1068, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = (__pyx_v_key_type == __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "pkcs11/_pkcs11.pyx":1069
 * 
 *         if key_type is KeyType.RSA:
 *             if key_length is None:             # <<<<<<<<<<<<<<
 *                 raise ArgumentsBad("Must provide `key_length'")
 * 
*/
    __pyx_t_3 = (__pyx_v_key_length == Py_None);
    if (unlikely(__pyx_t_3)) {

      /* "pkcs11/_pkcs11.pyx":1070
 *         if key_type is KeyType.RSA:
 *             if key_length is None:
 *                 raise ArgumentsBad("Must provide `key_length'")             # <<<<<<<<<<<<<<
 * 
 *             # Some PKCS#11 implementations don't default this, it makes sense
*/
      __pyx_t_5 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_ArgumentsBad); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1070, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        assert(__pyx_t_5);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
        __pyx_t_6 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Must_provide_key_length};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1070, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(0, 1070, __pyx_L1_error)

      /* "pkcs11/_pkcs11.pyx":1069
 * 
 *         if key_type is KeyType.RSA:
 *             if key_length is None:             # <<<<<<<<<<<<<<
 *                 raise ArgumentsBad("Must provide `key_length'")
 * 
*/
    }

    /* "pkcs11/_pkcs11.pyx":1074
 *             # Some PKCS#11 implementations don't default this, it makes sense
 *             # to do it here
 *             public_template_.update({             # <<<<<<<<<<<<<<
 *                 Attribute.PUBLIC_EXPONENT: b'\1\0\1',
 *                 Attribute.MODULUS_BITS: key_length,
*/
    __pyx_t_4 = __pyx_v_public_template_;
    __Pyx_INCREF(__pyx_t_4);

    /* "pkcs11/_pkcs11.pyx":1075
 *             # to do it here
 *             public_template_.update({
 *                 Attribute.PUBLIC_EXPONENT: b'\1\0\1',             # <<<<<<<<<<<<<<
 *                 Attribute.MODULUS_BITS: key_length,
 *             })
*/
    __pyx_t_5 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1075, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_Attribute); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1075, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_PUBLIC_EXPONENT); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1075, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (PyDict_SetItem(__pyx_t_5, __pyx_t_14, __pyx_mstate_global->__pyx_kp_b__10) < (0)) __PYX_ERR(0, 1075, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

    /* "pkcs11/_pkcs11.pyx":1076
 *             public_template_.update({
 *                 Attribute.PUBLIC_EXPONENT: b'\1\0\1',
 *                 Attribute.MODULUS_BITS: key_length,             # <<<<<<<<<<<<<<
 *             })
 * 
*/
    __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_Attribute); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1076, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_MODULUS_BITS); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1076, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    if (PyDict_SetItem(__pyx_t_5, __pyx_t_12, __pyx_v_key_length) < (0)) __PYX_ERR(0, 1075, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1074, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pyx":1068
 *         )
 * 
 *         if key_type is KeyType.RSA:             # <<<<<<<<<<<<<<
 *             if key_length is None:
 *                 raise ArgumentsBad("Must provide `key_length'")
*/
    goto __pyx_L16;
  }

  /* "pkcs11/_pkcs11.pyx":1079
 *             })
 * 
 *         elif key_type is KeyType.ML_DSA:             # <<<<<<<<<<<<<<
 *             if public_template is None or Attribute.PARAMETER_SET not in public_template:
 *                 raise ArgumentsBad(
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_KeyType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1079, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_ML_DSA); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1079, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_v_key_type == __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_3) {

    /* "pkcs11/_pkcs11.pyx":1080
 * 
 *         elif key_type is KeyType.ML_DSA:
 *             if public_template is None or Attribute.PARAMETER_SET not in public_template:             # <<<<<<<<<<<<<<
 *                 raise ArgumentsBad(
 *                     "ML-DSA key generation requires `Attribute.PARAMETER_SET` "
*/
    __pyx_t_7 = (__pyx_v_public_template == Py_None);
    if (!__pyx_t_7) {
    } else {
      __pyx_t_3 = __pyx_t_7;
      goto __pyx_L19_bool_binop_done;
    }
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Attribute); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1080, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_PARAMETER_SET); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1080, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_v_public_template, Py_NE)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 1080, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = __pyx_t_7;
    __pyx_L19_bool_binop_done:;
    if (unlikely(__pyx_t_3)) {

      /* "pkcs11/_pkcs11.pyx":1081
 *         elif key_type is KeyType.ML_DSA:
 *             if public_template is None or Attribute.PARAMETER_SET not in public_template:
 *                 raise ArgumentsBad(             # <<<<<<<<<<<<<<
 *                     "ML-DSA key generation requires `Attribute.PARAMETER_SET` "
 *                     "in `public_template` (e.g. MLDSAParameterSet.ML_DSA_65)."
*/
      __pyx_t_5 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_ArgumentsBad); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1081, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        assert(__pyx_t_5);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
        __pyx_t_6 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_ML_DSA_key_generation_requires_A};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1081, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(0, 1081, __pyx_L1_error)

      /* "pkcs11/_pkcs11.pyx":1080
 * 
 *         elif key_type is KeyType.ML_DSA:
 *             if public_template is None or Attribute.PARAMETER_SET not in public_template:             # <<<<<<<<<<<<<<
 *                 raise ArgumentsBad(
 *                     "ML-DSA key generation requires `Attribute.PARAMETER_SET` "
*/
    }

    /* "pkcs11/_pkcs11.pyx":1079
 *             })
 * 
 *         elif key_type is KeyType.ML_DSA:             # <<<<<<<<<<<<<<
 *             if public_template is None or Attribute.PARAMETER_SET not in public_template:
 *                 raise ArgumentsBad(
*/
  }
  __pyx_L16:;

  /* "pkcs11/_pkcs11.pyx":1086
 *                 )
 * 
 *         public_attrs = self.make_attribute_list(merge_templates(public_template_, public_template))             # <<<<<<<<<<<<<<
 * 
 *         private_template_ = self.attribute_mapper.private_key_template(
*/
  __pyx_t_4 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_merge_templates); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1086, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    assert(__pyx_t_4);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_public_template_, __pyx_v_public_template};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1086, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_5 = ((PyObject *)((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_Session *)__pyx_v_self->__pyx_vtab)->make_attribute_list(__pyx_v_self, __pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1086, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_public_attrs = ((struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":1088
 *         public_attrs = self.make_attribute_list(merge_templates(public_template_, public_template))
 * 
 *         private_template_ = self.attribute_mapper.private_key_template(             # <<<<<<<<<<<<<<
 *             id_=id, label=label, store=store, capabilities=capabilities,
 *         )
*/
  __pyx_t_1 = __pyx_v_self->attribute_mapper;
  __Pyx_INCREF(__pyx_t_1);

  /* "pkcs11/_pkcs11.pyx":1089
 * 
 *         private_template_ = self.attribute_mapper.private_key_template(
 *             id_=id, label=label, store=store, capabilities=capabilities,             # <<<<<<<<<<<<<<
 *         )
 *         private_attrs = self.make_attribute_list(merge_templates(private_template_, private_template))
*/
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 4 : 0)] = {__pyx_t_1, NULL};
    __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1088, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_id_2, __pyx_v_id, __pyx_t_4, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 1088, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_label, __pyx_v_label, __pyx_t_4, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 1088, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_store, __pyx_v_store, __pyx_t_4, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 1088, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_capabilities, __pyx_v_capabilities, __pyx_t_4, __pyx_callargs+1, 3) < (0)) __PYX_ERR(0, 1088, __pyx_L1_error)
    __pyx_t_5 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_private_key_template, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1088, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __pyx_v_private_template_ = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":1091
 *             id_=id, label=label, store=store, capabilities=capabilities,
 *         )
 *         private_attrs = self.make_attribute_list(merge_templates(private_template_, private_template))             # <<<<<<<<<<<<<<
 *         return self.generate_keypair_from_attrs(public_attrs, private_attrs, mech)
 * 
*/
  __pyx_t_4 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_merge_templates); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1091, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    assert(__pyx_t_4);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_private_template_, __pyx_v_private_template};
    __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1091, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_Session *)__pyx_v_self->__pyx_vtab)->make_attribute_list(__pyx_v_self, __pyx_t_5)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1091, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_private_attrs = ((struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1092
 *         )
 *         private_attrs = self.make_attribute_list(merge_templates(private_template_, private_template))
 *         return self.generate_keypair_from_attrs(public_attrs, private_attrs, mech)             # <<<<<<<<<<<<<<
 * 
 *     cdef tuple generate_keypair_from_attrs(
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_Session *)__pyx_v_self->__pyx_vtab)->generate_keypair_from_attrs(__pyx_v_self, __pyx_v_public_attrs, __pyx_v_private_attrs, __pyx_v_mech); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1092, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":1041
 * 
 * 
 *     def _generate_keypair(self, key_type, key_length=None,             # <<<<<<<<<<<<<<
 *                           id=None, label=None,
 *                           store=False, capabilities=None,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("pkcs11._pkcs11.Session._generate_keypair", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mech);
  __Pyx_XDECREF(__pyx_v_public_template_);
  __Pyx_XDECREF((PyObject *)__pyx_v_public_attrs);
  __Pyx_XDECREF(__pyx_v_private_template_);
  __Pyx_XDECREF((PyObject *)__pyx_v_private_attrs);
  __Pyx_XDECREF(__pyx_v_capabilities);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1094
 *         return self.generate_keypair_from_attrs(public_attrs, private_attrs, mech)
 * 
 *     cdef tuple generate_keypair_from_attrs(             # <<<<<<<<<<<<<<
 *             self,
 *             AttributeList public_attrs,
*/

static PyObject *__pyx_f_6pkcs11_7_pkcs11_7Session_generate_keypair_from_attrs(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_public_attrs, struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_private_attrs, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_mech) {
  CK_SESSION_HANDLE __pyx_v_handle;
  CK_MECHANISM *__pyx_v_mech_data;
  CK_ATTRIBUTE *__pyx_v_public_attr_data;
  CK_ULONG __pyx_v_public_attr_count;
  CK_ATTRIBUTE *__pyx_v_private_attr_data;
  CK_ULONG __pyx_v_private_attr_count;
  CK_OBJECT_HANDLE __pyx_v_public_key;
  CK_OBJECT_HANDLE __pyx_v_private_key;
  CK_RV __pyx_v_retval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  CK_SESSION_HANDLE __pyx_t_1;
  CK_MECHANISM *__pyx_t_2;
  CK_ATTRIBUTE *__pyx_t_3;
  CK_ULONG __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("generate_keypair_from_attrs", 0);

  /* "pkcs11/_pkcs11.pyx":1101
 *     ):
 * 
 *         cdef CK_SESSION_HANDLE handle = self.handle             # <<<<<<<<<<<<<<
 *         cdef CK_MECHANISM *mech_data = mech.data
 *         cdef CK_ATTRIBUTE *public_attr_data = public_attrs.data
*/
  __pyx_t_1 = __pyx_v_self->handle;
  __pyx_v_handle = __pyx_t_1;

  /* "pkcs11/_pkcs11.pyx":1102
 * 
 *         cdef CK_SESSION_HANDLE handle = self.handle
 *         cdef CK_MECHANISM *mech_data = mech.data             # <<<<<<<<<<<<<<
 *         cdef CK_ATTRIBUTE *public_attr_data = public_attrs.data
 *         cdef CK_ULONG public_attr_count = public_attrs.count
*/
  __pyx_t_2 = __pyx_v_mech->data;
  __pyx_v_mech_data = __pyx_t_2;

  /* "pkcs11/_pkcs11.pyx":1103
 *         cdef CK_SESSION_HANDLE handle = self.handle
 *         cdef CK_MECHANISM *mech_data = mech.data
 *         cdef CK_ATTRIBUTE *public_attr_data = public_attrs.data             # <<<<<<<<<<<<<<
 *         cdef CK_ULONG public_attr_count = public_attrs.count
 *         cdef CK_ATTRIBUTE *private_attr_data = private_attrs.data
*/
  __pyx_t_3 = __pyx_v_public_attrs->data;
  __pyx_v_public_attr_data = __pyx_t_3;

  /* "pkcs11/_pkcs11.pyx":1104
 *         cdef CK_MECHANISM *mech_data = mech.data
 *         cdef CK_ATTRIBUTE *public_attr_data = public_attrs.data
 *         cdef CK_ULONG public_attr_count = public_attrs.count             # <<<<<<<<<<<<<<
 *         cdef CK_ATTRIBUTE *private_attr_data = private_attrs.data
 *         cdef CK_ULONG private_attr_count = private_attrs.count
*/
  __pyx_t_4 = __pyx_v_public_attrs->count;
  __pyx_v_public_attr_count = __pyx_t_4;

  /* "pkcs11/_pkcs11.pyx":1105
 *         cdef CK_ATTRIBUTE *public_attr_data = public_attrs.data
 *         cdef CK_ULONG public_attr_count = public_attrs.count
 *         cdef CK_ATTRIBUTE *private_attr_data = private_attrs.data             # <<<<<<<<<<<<<<
 *         cdef CK_ULONG private_attr_count = private_attrs.count
 *         cdef CK_OBJECT_HANDLE public_key
*/
  __pyx_t_3 = __pyx_v_private_attrs->data;
  __pyx_v_private_attr_data = __pyx_t_3;

  /* "pkcs11/_pkcs11.pyx":1106
 *         cdef CK_ULONG public_attr_count = public_attrs.count
 *         cdef CK_ATTRIBUTE *private_attr_data = private_attrs.data
 *         cdef CK_ULONG private_attr_count = private_attrs.count             # <<<<<<<<<<<<<<
 *         cdef CK_OBJECT_HANDLE public_key
 *         cdef CK_OBJECT_HANDLE private_key
*/
  __pyx_t_4 = __pyx_v_private_attrs->count;
  __pyx_v_private_attr_count = __pyx_t_4;

  /* "pkcs11/_pkcs11.pyx":1111
 *         cdef CK_RV retval
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_GenerateKeyPair(handle, mech_data, public_attr_data, public_attr_count, private_attr_data, private_attr_count, &public_key, &private_key)
 *         assertRV(retval)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":1112
 * 
 *         with nogil:
 *             retval = self.funclist.C_GenerateKeyPair(handle, mech_data, public_attr_data, public_attr_count, private_attr_data, private_attr_count, &public_key, &private_key)             # <<<<<<<<<<<<<<
 *         assertRV(retval)
 * 
*/
        __pyx_v_retval = __pyx_v_self->__pyx_base.funclist->C_GenerateKeyPair(__pyx_v_handle, __pyx_v_mech_data, __pyx_v_public_attr_data, __pyx_v_public_attr_count, __pyx_v_private_attr_data, __pyx_v_private_attr_count, (&__pyx_v_public_key), (&__pyx_v_private_key));
      }

      /* "pkcs11/_pkcs11.pyx":1111
 *         cdef CK_RV retval
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_GenerateKeyPair(handle, mech_data, public_attr_data, public_attr_count, private_attr_data, private_attr_count, &public_key, &private_key)
 *         assertRV(retval)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":1113
 *         with nogil:
 *             retval = self.funclist.C_GenerateKeyPair(handle, mech_data, public_attr_data, public_attr_count, private_attr_data, private_attr_count, &public_key, &private_key)
 *         assertRV(retval)             # <<<<<<<<<<<<<<
 * 
 *         return (make_object(self, public_key),
*/
  __pyx_t_5 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "pkcs11/_pkcs11.pyx":1115
 *         assertRV(retval)
 * 
 *         return (make_object(self, public_key),             # <<<<<<<<<<<<<<
 *                 make_object(self, private_key))
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = __pyx_f_6pkcs11_7_pkcs11_make_object(__pyx_v_self, __pyx_v_public_key); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);

  /* "pkcs11/_pkcs11.pyx":1116
 * 
 *         return (make_object(self, public_key),
 *                 make_object(self, private_key))             # <<<<<<<<<<<<<<
 * 
 *     def seed_random(self, seed):
*/
  __pyx_t_5 = __pyx_f_6pkcs11_7_pkcs11_make_object(__pyx_v_self, __pyx_v_private_key); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "pkcs11/_pkcs11.pyx":1115
 *         assertRV(retval)
 * 
 *         return (make_object(self, public_key),             # <<<<<<<<<<<<<<
 *                 make_object(self, private_key))
 * 
*/
  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_6);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6) != (0)) __PYX_ERR(0, 1115, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_5);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5) != (0)) __PYX_ERR(0, 1115, __pyx_L1_error);
  __pyx_t_6 = 0;
  __pyx_t_5 = 0;
  __pyx_r = ((PyObject*)__pyx_t_7);
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":1094
 *         return self.generate_keypair_from_attrs(public_attrs, private_attrs, mech)
 * 
 *     cdef tuple generate_keypair_from_attrs(             # <<<<<<<<<<<<<<
 *             self,
 *             AttributeList public_attrs,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pkcs11._pkcs11.Session.generate_keypair_from_attrs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1118
 *                 make_object(self, private_key))
 * 
 *     def seed_random(self, seed):             # <<<<<<<<<<<<<<
 *         cdef CK_SESSION_HANDLE handle = self.handle
 *         cdef CK_BYTE *seed_data = seed
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_22seed_random(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_7Session_22seed_random = {"seed_random", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_22seed_random, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_22seed_random(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_seed = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("seed_random (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_seed,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1118, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1118, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "seed_random", 0) < (0)) __PYX_ERR(0, 1118, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("seed_random", 1, 1, 1, i); __PYX_ERR(0, 1118, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1118, __pyx_L3_error)
    }
    __pyx_v_seed = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("seed_random", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1118, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.Session.seed_random", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_7Session_21seed_random(((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_v_self), __pyx_v_seed);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_21seed_random(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, PyObject *__pyx_v_seed) {
  CK_SESSION_HANDLE __pyx_v_handle;
  CK_BYTE *__pyx_v_seed_data;
  CK_ULONG __pyx_v_seed_len;
  CK_RV __pyx_v_retval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  CK_SESSION_HANDLE __pyx_t_1;
  CK_BYTE *__pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("seed_random", 0);

  /* "pkcs11/_pkcs11.pyx":1119
 * 
 *     def seed_random(self, seed):
 *         cdef CK_SESSION_HANDLE handle = self.handle             # <<<<<<<<<<<<<<
 *         cdef CK_BYTE *seed_data = seed
 *         cdef CK_ULONG seed_len = <CK_ULONG> len(seed)
*/
  __pyx_t_1 = __pyx_v_self->handle;
  __pyx_v_handle = __pyx_t_1;

  /* "pkcs11/_pkcs11.pyx":1120
 *     def seed_random(self, seed):
 *         cdef CK_SESSION_HANDLE handle = self.handle
 *         cdef CK_BYTE *seed_data = seed             # <<<<<<<<<<<<<<
 *         cdef CK_ULONG seed_len = <CK_ULONG> len(seed)
 *         cdef CK_RV retval
*/
  __pyx_t_2 = __Pyx_PyObject_AsWritableUString(__pyx_v_seed); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 1120, __pyx_L1_error)
  __pyx_v_seed_data = __pyx_t_2;

  /* "pkcs11/_pkcs11.pyx":1121
 *         cdef CK_SESSION_HANDLE handle = self.handle
 *         cdef CK_BYTE *seed_data = seed
 *         cdef CK_ULONG seed_len = <CK_ULONG> len(seed)             # <<<<<<<<<<<<<<
 *         cdef CK_RV retval
 * 
*/
  __pyx_t_3 = PyObject_Length(__pyx_v_seed); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1121, __pyx_L1_error)
  __pyx_v_seed_len = ((CK_ULONG)__pyx_t_3);

  /* "pkcs11/_pkcs11.pyx":1124
 *         cdef CK_RV retval
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_SeedRandom(handle, seed_data, seed_len)
 *         assertRV(retval)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":1125
 * 
 *         with nogil:
 *             retval = self.funclist.C_SeedRandom(handle, seed_data, seed_len)             # <<<<<<<<<<<<<<
 *         assertRV(retval)
 * 
*/
        __pyx_v_retval = __pyx_v_self->__pyx_base.funclist->C_SeedRandom(__pyx_v_handle, __pyx_v_seed_data, __pyx_v_seed_len);
      }

      /* "pkcs11/_pkcs11.pyx":1124
 *         cdef CK_RV retval
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_SeedRandom(handle, seed_data, seed_len)
 *         assertRV(retval)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":1126
 *         with nogil:
 *             retval = self.funclist.C_SeedRandom(handle, seed_data, seed_len)
 *         assertRV(retval)             # <<<<<<<<<<<<<<
 * 
 *     def generate_random(self, nbits):
*/
  __pyx_t_4 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":1118
 *                 make_object(self, private_key))
 * 
 *     def seed_random(self, seed):             # <<<<<<<<<<<<<<
 *         cdef CK_SESSION_HANDLE handle = self.handle
 *         cdef CK_BYTE *seed_data = seed
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pkcs11._pkcs11.Session.seed_random", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1128
 *         assertRV(retval)
 * 
 *     def generate_random(self, nbits):             # <<<<<<<<<<<<<<
 *         cdef CK_SESSION_HANDLE handle = self.handle
 *         cdef CK_ULONG length = nbits // 8
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_24generate_random(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_7Session_24generate_random = {"generate_random", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_24generate_random, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_24generate_random(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_nbits = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("generate_random (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_nbits,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1128, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1128, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "generate_random", 0) < (0)) __PYX_ERR(0, 1128, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("generate_random", 1, 1, 1, i); __PYX_ERR(0, 1128, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1128, __pyx_L3_error)
    }
    __pyx_v_nbits = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("generate_random", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1128, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.Session.generate_random", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_7Session_23generate_random(((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_v_self), __pyx_v_nbits);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_23generate_random(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, PyObject *__pyx_v_nbits) {
  CK_SESSION_HANDLE __pyx_v_handle;
  CK_ULONG __pyx_v_length;
  __Pyx_memviewslice __pyx_v_random = { 0, 0, { 0 }, { 0 }, { 0 } };
  CK_RV __pyx_v_retval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  CK_SESSION_HANDLE __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  CK_ULONG __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  size_t __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("generate_random", 0);

  /* "pkcs11/_pkcs11.pyx":1129
 * 
 *     def generate_random(self, nbits):
 *         cdef CK_SESSION_HANDLE handle = self.handle             # <<<<<<<<<<<<<<
 *         cdef CK_ULONG length = nbits // 8
 *         cdef CK_CHAR [:] random = CK_BYTE_buffer(length)
*/
  __pyx_t_1 = __pyx_v_self->handle;
  __pyx_v_handle = __pyx_t_1;

  /* "pkcs11/_pkcs11.pyx":1130
 *     def generate_random(self, nbits):
 *         cdef CK_SESSION_HANDLE handle = self.handle
 *         cdef CK_ULONG length = nbits // 8             # <<<<<<<<<<<<<<
 *         cdef CK_CHAR [:] random = CK_BYTE_buffer(length)
 *         cdef CK_RV retval
*/
  __pyx_t_2 = __Pyx_PyLong_FloorDivideObjC(__pyx_v_nbits, __pyx_mstate_global->__pyx_int_8, 8, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyLong_As_CK_ULONG(__pyx_t_2); if (unlikely((__pyx_t_3 == ((CK_ULONG)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1130, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_length = __pyx_t_3;

  /* "pkcs11/_pkcs11.pyx":1131
 *         cdef CK_SESSION_HANDLE handle = self.handle
 *         cdef CK_ULONG length = nbits // 8
 *         cdef CK_CHAR [:] random = CK_BYTE_buffer(length)             # <<<<<<<<<<<<<<
 *         cdef CK_RV retval
 * 
*/
  __pyx_t_2 = __Pyx_PyLong_From_CK_ULONG(__pyx_v_length); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __pyx_f_6pkcs11_7_pkcs11_CK_BYTE_buffer(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn_CK_CHAR(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 1131, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_random = __pyx_t_5;
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "pkcs11/_pkcs11.pyx":1134
 *         cdef CK_RV retval
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_GenerateRandom(handle, &random[0], length)
 *         assertRV(retval)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":1135
 * 
 *         with nogil:
 *             retval = self.funclist.C_GenerateRandom(handle, &random[0], length)             # <<<<<<<<<<<<<<
 *         assertRV(retval)
 * 
*/
        __pyx_t_6 = 0;
        __pyx_t_7 = -1;
        if (__pyx_t_6 < 0) {
          __pyx_t_6 += __pyx_v_random.shape[0];
          if (unlikely(__pyx_t_6 < 0)) __pyx_t_7 = 0;
        } else if (unlikely(__pyx_t_6 >= __pyx_v_random.shape[0])) __pyx_t_7 = 0;
        if (unlikely(__pyx_t_7 != -1)) {
          __Pyx_RaiseBufferIndexErrorNogil(__pyx_t_7);
          __PYX_ERR(0, 1135, __pyx_L4_error)
        }
        __pyx_v_retval = __pyx_v_self->__pyx_base.funclist->C_GenerateRandom(__pyx_v_handle, (&(*((CK_CHAR *) ( /* dim=0 */ (__pyx_v_random.data + __pyx_t_6 * __pyx_v_random.strides[0]) )))), __pyx_v_length);
      }

      /* "pkcs11/_pkcs11.pyx":1134
 *         cdef CK_RV retval
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_GenerateRandom(handle, &random[0], length)
 *         assertRV(retval)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L5;
        }
        __pyx_L4_error: {
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L1_error;
        }
        __pyx_L5:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":1136
 *         with nogil:
 *             retval = self.funclist.C_GenerateRandom(handle, &random[0], length)
 *         assertRV(retval)             # <<<<<<<<<<<<<<
 * 
 *         return bytes(random)
*/
  __pyx_t_4 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pkcs11/_pkcs11.pyx":1138
 *         assertRV(retval)
 * 
 *         return bytes(random)             # <<<<<<<<<<<<<<
 * 
 *     def __digest_operation(self, mechanism, mechanism_param):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = NULL;
  __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v_random, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn_CK_CHAR, (int (*)(char *, PyObject *)) __pyx_memview_set_nn_CK_CHAR, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_8};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(&PyBytes_Type), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1138, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":1128
 *         assertRV(retval)
 * 
 *     def generate_random(self, nbits):             # <<<<<<<<<<<<<<
 *         cdef CK_SESSION_HANDLE handle = self.handle
 *         cdef CK_ULONG length = nbits // 8
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pkcs11._pkcs11.Session.generate_random", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_random, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1140
 *         return bytes(random)
 * 
 *     def __digest_operation(self, mechanism, mechanism_param):             # <<<<<<<<<<<<<<
 *         mech = MechanismWithParam(
 *             None, {},
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_26_Session__digest_operation(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_7Session_26_Session__digest_operation = {"_Session__digest_operation", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_26_Session__digest_operation, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_26_Session__digest_operation(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_mechanism = 0;
  PyObject *__pyx_v_mechanism_param = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_Session__digest_operation (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_mechanism,&__pyx_mstate_global->__pyx_n_u_mechanism_param,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1140, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1140, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1140, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_Session__digest_operation", 0) < (0)) __PYX_ERR(0, 1140, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_Session__digest_operation", 1, 2, 2, i); __PYX_ERR(0, 1140, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1140, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1140, __pyx_L3_error)
    }
    __pyx_v_mechanism = values[0];
    __pyx_v_mechanism_param = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_Session__digest_operation", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1140, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.Session._Session__digest_operation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_7Session_25__digest_operation(((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_v_self), __pyx_v_mechanism, __pyx_v_mechanism_param);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_25__digest_operation(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param) {
  struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_mech = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_Session__digest_operation", 0);

  /* "pkcs11/_pkcs11.pyx":1141
 * 
 *     def __digest_operation(self, mechanism, mechanism_param):
 *         mech = MechanismWithParam(             # <<<<<<<<<<<<<<
 *             None, {},
 *             mechanism, mechanism_param)
*/
  __pyx_t_2 = NULL;

  /* "pkcs11/_pkcs11.pyx":1142
 *     def __digest_operation(self, mechanism, mechanism_param):
 *         mech = MechanismWithParam(
 *             None, {},             # <<<<<<<<<<<<<<
 *             mechanism, mechanism_param)
 *         return DigestOperation.setup(self, mech, 1024)
*/
  __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "pkcs11/_pkcs11.pyx":1143
 *         mech = MechanismWithParam(
 *             None, {},
 *             mechanism, mechanism_param)             # <<<<<<<<<<<<<<
 *         return DigestOperation.setup(self, mech, 1024)
 * 
*/
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[5] = {__pyx_t_2, Py_None, __pyx_t_3, __pyx_v_mechanism, __pyx_v_mechanism_param};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_MechanismWithParam, __pyx_callargs+__pyx_t_4, (5-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1141, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_mech = ((struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1144
 *             None, {},
 *             mechanism, mechanism_param)
 *         return DigestOperation.setup(self, mech, 1024)             # <<<<<<<<<<<<<<
 * 
 *     def _digest(self, data, mechanism=None, mechanism_param=None):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6pkcs11_7_pkcs11_15DigestOperation_setup(__pyx_v_self, __pyx_v_mech, 0x400)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":1140
 *         return bytes(random)
 * 
 *     def __digest_operation(self, mechanism, mechanism_param):             # <<<<<<<<<<<<<<
 *         mech = MechanismWithParam(
 *             None, {},
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pkcs11._pkcs11.Session._Session__digest_operation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mech);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1146
 *         return DigestOperation.setup(self, mech, 1024)
 * 
 *     def _digest(self, data, mechanism=None, mechanism_param=None):             # <<<<<<<<<<<<<<
 *         cdef CK_BYTE *data_ptr = data
 *         cdef CK_ULONG data_len = <CK_ULONG> len(data)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_28_digest(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_7Session_28_digest = {"_digest", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_28_digest, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_28_digest(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_data = 0;
  PyObject *__pyx_v_mechanism = 0;
  PyObject *__pyx_v_mechanism_param = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_digest (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_data,&__pyx_mstate_global->__pyx_n_u_mechanism,&__pyx_mstate_global->__pyx_n_u_mechanism_param,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1146, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1146, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1146, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1146, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_digest", 0) < (0)) __PYX_ERR(0, 1146, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_digest", 0, 1, 3, i); __PYX_ERR(0, 1146, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1146, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1146, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1146, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_data = values[0];
    __pyx_v_mechanism = values[1];
    __pyx_v_mechanism_param = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_digest", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 1146, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.Session._digest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_7Session_27_digest(((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_v_self), __pyx_v_data, __pyx_v_mechanism, __pyx_v_mechanism_param);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_27_digest(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param) {
  CK_BYTE *__pyx_v_data_ptr;
  CK_ULONG __pyx_v_data_len;
  struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *__pyx_v_op = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  CK_BYTE *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_digest", 0);

  /* "pkcs11/_pkcs11.pyx":1147
 * 
 *     def _digest(self, data, mechanism=None, mechanism_param=None):
 *         cdef CK_BYTE *data_ptr = data             # <<<<<<<<<<<<<<
 *         cdef CK_ULONG data_len = <CK_ULONG> len(data)
 *         cdef CK_RV retval
*/
  __pyx_t_1 = __Pyx_PyObject_AsWritableUString(__pyx_v_data); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 1147, __pyx_L1_error)
  __pyx_v_data_ptr = __pyx_t_1;

  /* "pkcs11/_pkcs11.pyx":1148
 *     def _digest(self, data, mechanism=None, mechanism_param=None):
 *         cdef CK_BYTE *data_ptr = data
 *         cdef CK_ULONG data_len = <CK_ULONG> len(data)             # <<<<<<<<<<<<<<
 *         cdef CK_RV retval
 * 
*/
  __pyx_t_2 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1148, __pyx_L1_error)
  __pyx_v_data_len = ((CK_ULONG)__pyx_t_2);

  /* "pkcs11/_pkcs11.pyx":1151
 *         cdef CK_RV retval
 * 
 *         cdef DigestOperation op =  self.__digest_operation(mechanism, mechanism_param)             # <<<<<<<<<<<<<<
 *         with op:
 *             return op.digest_process_fully(data_ptr, data_len)
*/
  __pyx_t_4 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_mechanism, __pyx_v_mechanism_param};
    __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_Session__digest_operation, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1151, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_DigestOperation))))) __PYX_ERR(0, 1151, __pyx_L1_error)
  __pyx_v_op = ((struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pkcs11/_pkcs11.pyx":1152
 * 
 *         cdef DigestOperation op =  self.__digest_operation(mechanism, mechanism_param)
 *         with op:             # <<<<<<<<<<<<<<
 *             return op.digest_process_fully(data_ptr, data_len)
 * 
*/
  /*with:*/ {
    __pyx_t_6 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_op), __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1152, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = NULL;
    __pyx_t_7 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_op), __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1152, __pyx_L3_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1152, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    /*try:*/ {
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_10);
        /*try:*/ {

          /* "pkcs11/_pkcs11.pyx":1153
 *         cdef DigestOperation op =  self.__digest_operation(mechanism, mechanism_param)
 *         with op:
 *             return op.digest_process_fully(data_ptr, data_len)             # <<<<<<<<<<<<<<
 * 
 *     def _digest_generator(self, data, mechanism=None, mechanism_param=None):
*/
          __Pyx_XDECREF(__pyx_r);
          __pyx_t_3 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DigestOperation *)__pyx_v_op->__pyx_base.__pyx_base.__pyx_vtab)->digest_process_fully(__pyx_v_op, __pyx_v_data_ptr, __pyx_v_data_len); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1153, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_r = __pyx_t_3;
          __pyx_t_3 = 0;
          goto __pyx_L11_try_return;

          /* "pkcs11/_pkcs11.pyx":1152
 * 
 *         cdef DigestOperation op =  self.__digest_operation(mechanism, mechanism_param)
 *         with op:             # <<<<<<<<<<<<<<
 *             return op.digest_process_fully(data_ptr, data_len)
 * 
*/
        }
        __pyx_L7_error:;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        /*except:*/ {
          __Pyx_AddTraceback("pkcs11._pkcs11.Session._digest", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_7, &__pyx_t_4) < 0) __PYX_ERR(0, 1152, __pyx_L9_except_error)
          __Pyx_XGOTREF(__pyx_t_3);
          __Pyx_XGOTREF(__pyx_t_7);
          __Pyx_XGOTREF(__pyx_t_4);
          __pyx_t_11 = PyTuple_Pack(3, __pyx_t_3, __pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1152, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_11, NULL);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1152, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          if (__pyx_t_13 < (0)) __PYX_ERR(0, 1152, __pyx_L9_except_error)
          __pyx_t_14 = (!__pyx_t_13);
          if (unlikely(__pyx_t_14)) {
            __Pyx_GIVEREF(__pyx_t_3);
            __Pyx_GIVEREF(__pyx_t_7);
            __Pyx_XGIVEREF(__pyx_t_4);
            __Pyx_ErrRestoreWithState(__pyx_t_3, __pyx_t_7, __pyx_t_4);
            __pyx_t_3 = 0;  __pyx_t_7 = 0;  __pyx_t_4 = 0; 
            __PYX_ERR(0, 1152, __pyx_L9_except_error)
          }
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          goto __pyx_L8_exception_handled;
        }
        __pyx_L9_except_error:;
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        goto __pyx_L1_error;
        __pyx_L11_try_return:;
        __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_L4_return;
        __pyx_L8_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);
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_6) {
          __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_mstate_global->__pyx_tuple[2], NULL);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1152, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        }
        goto __pyx_L6;
      }
      __pyx_L4_return: {
        __pyx_t_10 = __pyx_r;
        __pyx_r = 0;
        if (__pyx_t_6) {
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_mstate_global->__pyx_tuple[2], NULL);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1152, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        }
        __pyx_r = __pyx_t_10;
        __pyx_t_10 = 0;
        goto __pyx_L0;
      }
      __pyx_L6:;
    }
    goto __pyx_L16;
    __pyx_L3_error:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L1_error;
    __pyx_L16:;
  }

  /* "pkcs11/_pkcs11.pyx":1146
 *         return DigestOperation.setup(self, mech, 1024)
 * 
 *     def _digest(self, data, mechanism=None, mechanism_param=None):             # <<<<<<<<<<<<<<
 *         cdef CK_BYTE *data_ptr = data
 *         cdef CK_ULONG data_len = <CK_ULONG> len(data)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("pkcs11._pkcs11.Session._digest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_op);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1155
 *             return op.digest_process_fully(data_ptr, data_len)
 * 
 *     def _digest_generator(self, data, mechanism=None, mechanism_param=None):             # <<<<<<<<<<<<<<
 * 
 *         cdef DigestOperation op = self.__digest_operation(mechanism, mechanism_param)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_30_digest_generator(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_7Session_30_digest_generator = {"_digest_generator", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_30_digest_generator, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_30_digest_generator(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_data = 0;
  PyObject *__pyx_v_mechanism = 0;
  PyObject *__pyx_v_mechanism_param = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_digest_generator (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_data,&__pyx_mstate_global->__pyx_n_u_mechanism,&__pyx_mstate_global->__pyx_n_u_mechanism_param,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1155, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1155, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1155, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1155, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_digest_generator", 0) < (0)) __PYX_ERR(0, 1155, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_digest_generator", 0, 1, 3, i); __PYX_ERR(0, 1155, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1155, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1155, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1155, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_data = values[0];
    __pyx_v_mechanism = values[1];
    __pyx_v_mechanism_param = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_digest_generator", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 1155, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.Session._digest_generator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_7Session_29_digest_generator(((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_v_self), __pyx_v_data, __pyx_v_mechanism, __pyx_v_mechanism_param);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_29_digest_generator(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param) {
  struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *__pyx_v_op = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_digest_generator", 0);

  /* "pkcs11/_pkcs11.pyx":1157
 *     def _digest_generator(self, data, mechanism=None, mechanism_param=None):
 * 
 *         cdef DigestOperation op = self.__digest_operation(mechanism, mechanism_param)             # <<<<<<<<<<<<<<
 *         with op:
 *             op.ingest_chunks(data)
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_mechanism, __pyx_v_mechanism_param};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_Session__digest_operation, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1157, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_DigestOperation))))) __PYX_ERR(0, 1157, __pyx_L1_error)
  __pyx_v_op = ((struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1158
 * 
 *         cdef DigestOperation op = self.__digest_operation(mechanism, mechanism_param)
 *         with op:             # <<<<<<<<<<<<<<
 *             op.ingest_chunks(data)
 *             return op.finish()
*/
  /*with:*/ {
    __pyx_t_4 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_op), __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1158, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = NULL;
    __pyx_t_5 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_op), __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1158, __pyx_L3_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_3 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1158, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    /*try:*/ {
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        /*try:*/ {

          /* "pkcs11/_pkcs11.pyx":1159
 *         cdef DigestOperation op = self.__digest_operation(mechanism, mechanism_param)
 *         with op:
 *             op.ingest_chunks(data)             # <<<<<<<<<<<<<<
 *             return op.finish()
 * 
*/
          __pyx_t_5 = ((PyObject *)__pyx_v_op);
          __Pyx_INCREF(__pyx_t_5);
          __pyx_t_3 = 0;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_data};
            __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_ingest_chunks, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1159, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_1);
          }
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

          /* "pkcs11/_pkcs11.pyx":1160
 *         with op:
 *             op.ingest_chunks(data)
 *             return op.finish()             # <<<<<<<<<<<<<<
 * 
 *     def set_pin(self, old_pin, new_pin):
*/
          __Pyx_XDECREF(__pyx_r);
          __pyx_t_1 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DigestOperation *)__pyx_v_op->__pyx_base.__pyx_base.__pyx_vtab)->finish(__pyx_v_op); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1160, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_r = __pyx_t_1;
          __pyx_t_1 = 0;
          goto __pyx_L11_try_return;

          /* "pkcs11/_pkcs11.pyx":1158
 * 
 *         cdef DigestOperation op = self.__digest_operation(mechanism, mechanism_param)
 *         with op:             # <<<<<<<<<<<<<<
 *             op.ingest_chunks(data)
 *             return op.finish()
*/
        }
        __pyx_L7_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        /*except:*/ {
          __Pyx_AddTraceback("pkcs11._pkcs11.Session._digest_generator", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_2) < 0) __PYX_ERR(0, 1158, __pyx_L9_except_error)
          __Pyx_XGOTREF(__pyx_t_1);
          __Pyx_XGOTREF(__pyx_t_5);
          __Pyx_XGOTREF(__pyx_t_2);
          __pyx_t_9 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1158, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1158, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          if (__pyx_t_11 < (0)) __PYX_ERR(0, 1158, __pyx_L9_except_error)
          __pyx_t_12 = (!__pyx_t_11);
          if (unlikely(__pyx_t_12)) {
            __Pyx_GIVEREF(__pyx_t_1);
            __Pyx_GIVEREF(__pyx_t_5);
            __Pyx_XGIVEREF(__pyx_t_2);
            __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_5, __pyx_t_2);
            __pyx_t_1 = 0;  __pyx_t_5 = 0;  __pyx_t_2 = 0; 
            __PYX_ERR(0, 1158, __pyx_L9_except_error)
          }
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          goto __pyx_L8_exception_handled;
        }
        __pyx_L9_except_error:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        goto __pyx_L1_error;
        __pyx_L11_try_return:;
        __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_L4_return;
        __pyx_L8_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_4) {
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[2], NULL);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1158, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        goto __pyx_L6;
      }
      __pyx_L4_return: {
        __pyx_t_8 = __pyx_r;
        __pyx_r = 0;
        if (__pyx_t_4) {
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[2], NULL);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1158, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
        __pyx_r = __pyx_t_8;
        __pyx_t_8 = 0;
        goto __pyx_L0;
      }
      __pyx_L6:;
    }
    goto __pyx_L16;
    __pyx_L3_error:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L1_error;
    __pyx_L16:;
  }

  /* "pkcs11/_pkcs11.pyx":1155
 *             return op.digest_process_fully(data_ptr, data_len)
 * 
 *     def _digest_generator(self, data, mechanism=None, mechanism_param=None):             # <<<<<<<<<<<<<<
 * 
 *         cdef DigestOperation op = self.__digest_operation(mechanism, mechanism_param)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pkcs11._pkcs11.Session._digest_generator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_op);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1162
 *             return op.finish()
 * 
 *     def set_pin(self, old_pin, new_pin):             # <<<<<<<<<<<<<<
 *         cdef CK_ULONG old_pin_length
 *         cdef CK_ULONG new_pin_length
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_32set_pin(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_7Session_32set_pin = {"set_pin", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_32set_pin, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_32set_pin(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_old_pin = 0;
  PyObject *__pyx_v_new_pin = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_pin (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_old_pin,&__pyx_mstate_global->__pyx_n_u_new_pin,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1162, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1162, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1162, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "set_pin", 0) < (0)) __PYX_ERR(0, 1162, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("set_pin", 1, 2, 2, i); __PYX_ERR(0, 1162, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1162, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1162, __pyx_L3_error)
    }
    __pyx_v_old_pin = values[0];
    __pyx_v_new_pin = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_pin", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1162, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.Session.set_pin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_7Session_31set_pin(((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_v_self), __pyx_v_old_pin, __pyx_v_new_pin);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_31set_pin(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, PyObject *__pyx_v_old_pin, PyObject *__pyx_v_new_pin) {
  CK_ULONG __pyx_v_old_pin_length;
  CK_ULONG __pyx_v_new_pin_length;
  CK_OBJECT_HANDLE __pyx_v_handle;
  CK_UTF8CHAR *__pyx_v_old_pin_data;
  CK_UTF8CHAR *__pyx_v_new_pin_data;
  CK_RV __pyx_v_retval;
  PyObject *__pyx_v_pin_old = NULL;
  PyObject *__pyx_v_pin_new = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  CK_SESSION_HANDLE __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  CK_UTF8CHAR *__pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_pin", 0);

  /* "pkcs11/_pkcs11.pyx":1165
 *         cdef CK_ULONG old_pin_length
 *         cdef CK_ULONG new_pin_length
 *         cdef CK_OBJECT_HANDLE handle = self.handle             # <<<<<<<<<<<<<<
 *         cdef CK_UTF8CHAR *old_pin_data
 *         cdef CK_UTF8CHAR *new_pin_data
*/
  __pyx_t_1 = __pyx_v_self->handle;
  __pyx_v_handle = __pyx_t_1;

  /* "pkcs11/_pkcs11.pyx":1170
 *         cdef CK_RV retval
 * 
 *         pin_old = old_pin.encode('utf-8')             # <<<<<<<<<<<<<<
 *         pin_new = new_pin.encode('utf-8')
 * 
*/
  __pyx_t_3 = __pyx_v_old_pin;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_utf_8};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1170, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_v_pin_old = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pkcs11/_pkcs11.pyx":1171
 * 
 *         pin_old = old_pin.encode('utf-8')
 *         pin_new = new_pin.encode('utf-8')             # <<<<<<<<<<<<<<
 * 
 *         old_pin_data = pin_old
*/
  __pyx_t_3 = __pyx_v_new_pin;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_utf_8};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1171, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_v_pin_new = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pkcs11/_pkcs11.pyx":1173
 *         pin_new = new_pin.encode('utf-8')
 * 
 *         old_pin_data = pin_old             # <<<<<<<<<<<<<<
 *         new_pin_data = pin_new
 *         old_pin_length = len(pin_old)
*/
  __pyx_t_5 = __Pyx_PyObject_AsWritableUString(__pyx_v_pin_old); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 1173, __pyx_L1_error)
  __pyx_v_old_pin_data = __pyx_t_5;

  /* "pkcs11/_pkcs11.pyx":1174
 * 
 *         old_pin_data = pin_old
 *         new_pin_data = pin_new             # <<<<<<<<<<<<<<
 *         old_pin_length = len(pin_old)
 *         new_pin_length = len(pin_new)
*/
  __pyx_t_5 = __Pyx_PyObject_AsWritableUString(__pyx_v_pin_new); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 1174, __pyx_L1_error)
  __pyx_v_new_pin_data = __pyx_t_5;

  /* "pkcs11/_pkcs11.pyx":1175
 *         old_pin_data = pin_old
 *         new_pin_data = pin_new
 *         old_pin_length = len(pin_old)             # <<<<<<<<<<<<<<
 *         new_pin_length = len(pin_new)
 * 
*/
  __pyx_t_6 = PyObject_Length(__pyx_v_pin_old); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1175, __pyx_L1_error)
  __pyx_v_old_pin_length = __pyx_t_6;

  /* "pkcs11/_pkcs11.pyx":1176
 *         new_pin_data = pin_new
 *         old_pin_length = len(pin_old)
 *         new_pin_length = len(pin_new)             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
*/
  __pyx_t_6 = PyObject_Length(__pyx_v_pin_new); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1176, __pyx_L1_error)
  __pyx_v_new_pin_length = __pyx_t_6;

  /* "pkcs11/_pkcs11.pyx":1178
 *         new_pin_length = len(pin_new)
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_SetPIN(handle, old_pin_data, old_pin_length, new_pin_data, new_pin_length)
 *         assertRV(retval)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":1179
 * 
 *         with nogil:
 *             retval = self.funclist.C_SetPIN(handle, old_pin_data, old_pin_length, new_pin_data, new_pin_length)             # <<<<<<<<<<<<<<
 *         assertRV(retval)
 * 
*/
        __pyx_v_retval = __pyx_v_self->__pyx_base.funclist->C_SetPIN(__pyx_v_handle, __pyx_v_old_pin_data, __pyx_v_old_pin_length, __pyx_v_new_pin_data, __pyx_v_new_pin_length);
      }

      /* "pkcs11/_pkcs11.pyx":1178
 *         new_pin_length = len(pin_new)
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_SetPIN(handle, old_pin_data, old_pin_length, new_pin_data, new_pin_length)
 *         assertRV(retval)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":1180
 *         with nogil:
 *             retval = self.funclist.C_SetPIN(handle, old_pin_data, old_pin_length, new_pin_data, new_pin_length)
 *         assertRV(retval)             # <<<<<<<<<<<<<<
 * 
 *     def init_pin(self, pin):
*/
  __pyx_t_2 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pkcs11/_pkcs11.pyx":1162
 *             return op.finish()
 * 
 *     def set_pin(self, old_pin, new_pin):             # <<<<<<<<<<<<<<
 *         cdef CK_ULONG old_pin_length
 *         cdef CK_ULONG new_pin_length
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pkcs11._pkcs11.Session.set_pin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pin_old);
  __Pyx_XDECREF(__pyx_v_pin_new);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1182
 *         assertRV(retval)
 * 
 *     def init_pin(self, pin):             # <<<<<<<<<<<<<<
 *         cdef CK_OBJECT_HANDLE handle = self.handle
 *         cdef CK_UTF8CHAR *pin_data
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_34init_pin(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_7Session_34init_pin = {"init_pin", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_34init_pin, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_34init_pin(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_pin = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("init_pin (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pin,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1182, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1182, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "init_pin", 0) < (0)) __PYX_ERR(0, 1182, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("init_pin", 1, 1, 1, i); __PYX_ERR(0, 1182, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1182, __pyx_L3_error)
    }
    __pyx_v_pin = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("init_pin", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1182, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.Session.init_pin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_7Session_33init_pin(((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_v_self), __pyx_v_pin);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_33init_pin(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, PyObject *__pyx_v_pin) {
  CK_OBJECT_HANDLE __pyx_v_handle;
  CK_UTF8CHAR *__pyx_v_pin_data;
  CK_ULONG __pyx_v_pin_length;
  CK_RV __pyx_v_retval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  CK_SESSION_HANDLE __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  CK_UTF8CHAR *__pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("init_pin", 0);
  __Pyx_INCREF(__pyx_v_pin);

  /* "pkcs11/_pkcs11.pyx":1183
 * 
 *     def init_pin(self, pin):
 *         cdef CK_OBJECT_HANDLE handle = self.handle             # <<<<<<<<<<<<<<
 *         cdef CK_UTF8CHAR *pin_data
 *         cdef CK_ULONG pin_length
*/
  __pyx_t_1 = __pyx_v_self->handle;
  __pyx_v_handle = __pyx_t_1;

  /* "pkcs11/_pkcs11.pyx":1188
 *         cdef CK_RV retval
 * 
 *         pin = pin.encode('utf-8')             # <<<<<<<<<<<<<<
 * 
 *         pin_data = pin
*/
  __pyx_t_3 = __pyx_v_pin;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_utf_8};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1188, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF_SET(__pyx_v_pin, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "pkcs11/_pkcs11.pyx":1190
 *         pin = pin.encode('utf-8')
 * 
 *         pin_data = pin             # <<<<<<<<<<<<<<
 *         pin_length = len(pin)
 * 
*/
  __pyx_t_5 = __Pyx_PyObject_AsWritableUString(__pyx_v_pin); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 1190, __pyx_L1_error)
  __pyx_v_pin_data = __pyx_t_5;

  /* "pkcs11/_pkcs11.pyx":1191
 * 
 *         pin_data = pin
 *         pin_length = len(pin)             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
*/
  __pyx_t_6 = PyObject_Length(__pyx_v_pin); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1191, __pyx_L1_error)
  __pyx_v_pin_length = __pyx_t_6;

  /* "pkcs11/_pkcs11.pyx":1193
 *         pin_length = len(pin)
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_InitPIN(handle, pin_data, pin_length)
 *         assertRV(retval)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":1194
 * 
 *         with nogil:
 *             retval = self.funclist.C_InitPIN(handle, pin_data, pin_length)             # <<<<<<<<<<<<<<
 *         assertRV(retval)
 * 
*/
        __pyx_v_retval = __pyx_v_self->__pyx_base.funclist->C_InitPIN(__pyx_v_handle, __pyx_v_pin_data, __pyx_v_pin_length);
      }

      /* "pkcs11/_pkcs11.pyx":1193
 *         pin_length = len(pin)
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_InitPIN(handle, pin_data, pin_length)
 *         assertRV(retval)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":1195
 *         with nogil:
 *             retval = self.funclist.C_InitPIN(handle, pin_data, pin_length)
 *         assertRV(retval)             # <<<<<<<<<<<<<<
 * 
 * cdef class ObjectHandleWrapper(HasFuncList):
*/
  __pyx_t_2 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pkcs11/_pkcs11.pyx":1182
 *         assertRV(retval)
 * 
 *     def init_pin(self, pin):             # <<<<<<<<<<<<<<
 *         cdef CK_OBJECT_HANDLE handle = self.handle
 *         cdef CK_UTF8CHAR *pin_data
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pkcs11._pkcs11.Session.init_pin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pin);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":853
 *     """Extend Session with implementation."""
 * 
 *     cdef readonly CK_SESSION_HANDLE handle             # <<<<<<<<<<<<<<
 *     cdef readonly Token token
 *     cdef readonly bint rw
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_6handle_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_6handle_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_7Session_6handle___get__(((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_6handle___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_CK_ULONG(__pyx_v_self->handle); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 853, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pkcs11._pkcs11.Session.handle.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":854
 * 
 *     cdef readonly CK_SESSION_HANDLE handle
 *     cdef readonly Token token             # <<<<<<<<<<<<<<
 *     cdef readonly bint rw
 *     cdef CK_USER_TYPE _user_type
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_5token_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_5token_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_7Session_5token___get__(((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_5token___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self->token);
  __pyx_r = ((PyObject *)__pyx_v_self->token);
  goto __pyx_L0;

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

/* "pkcs11/_pkcs11.pyx":855
 *     cdef readonly CK_SESSION_HANDLE handle
 *     cdef readonly Token token
 *     cdef readonly bint rw             # <<<<<<<<<<<<<<
 *     cdef CK_USER_TYPE _user_type
 *     cdef object operation_lock
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_2rw_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_2rw_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_7Session_2rw___get__(((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_2rw___get__(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->rw); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 855, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pkcs11._pkcs11.Session.rw.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_36__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_7Session_36__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_36__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_36__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_7Session_35__reduce_cython__(((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_35__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 2, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.Session.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_38__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_7Session_38__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_38__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_7Session_38__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.Session.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_7Session_37__setstate_cython__(((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_v_self), __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_7Session_37__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 4, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.Session.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1205
 *     cdef readonly CK_OBJECT_HANDLE handle
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef ObjectHandleWrapper wrap(Session session, CK_OBJECT_HANDLE handle):
 *         cdef ObjectHandleWrapper obj = ObjectHandleWrapper.__new__(ObjectHandleWrapper)
*/

static struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *__pyx_f_6pkcs11_7_pkcs11_19ObjectHandleWrapper_wrap(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session, CK_OBJECT_HANDLE __pyx_v_handle) {
  struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *__pyx_v_obj = 0;
  struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct CK_FUNCTION_LIST *__pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("wrap", 0);

  /* "pkcs11/_pkcs11.pyx":1207
 *     @staticmethod
 *     cdef ObjectHandleWrapper wrap(Session session, CK_OBJECT_HANDLE handle):
 *         cdef ObjectHandleWrapper obj = ObjectHandleWrapper.__new__(ObjectHandleWrapper)             # <<<<<<<<<<<<<<
 *         obj.funclist = session.funclist
 *         obj.session = session
*/
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_6pkcs11_7_pkcs11_ObjectHandleWrapper(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_ObjectHandleWrapper), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1207, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_1);
  __pyx_v_obj = ((struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1208
 *     cdef ObjectHandleWrapper wrap(Session session, CK_OBJECT_HANDLE handle):
 *         cdef ObjectHandleWrapper obj = ObjectHandleWrapper.__new__(ObjectHandleWrapper)
 *         obj.funclist = session.funclist             # <<<<<<<<<<<<<<
 *         obj.session = session
 *         obj.handle = handle
*/
  __pyx_t_2 = __pyx_v_session->__pyx_base.funclist;
  __pyx_v_obj->__pyx_base.funclist = __pyx_t_2;

  /* "pkcs11/_pkcs11.pyx":1209
 *         cdef ObjectHandleWrapper obj = ObjectHandleWrapper.__new__(ObjectHandleWrapper)
 *         obj.funclist = session.funclist
 *         obj.session = session             # <<<<<<<<<<<<<<
 *         obj.handle = handle
 *         return obj
*/
  __Pyx_INCREF((PyObject *)__pyx_v_session);
  __Pyx_GIVEREF((PyObject *)__pyx_v_session);
  __Pyx_GOTREF((PyObject *)__pyx_v_obj->session);
  __Pyx_DECREF((PyObject *)__pyx_v_obj->session);
  __pyx_v_obj->session = __pyx_v_session;

  /* "pkcs11/_pkcs11.pyx":1210
 *         obj.funclist = session.funclist
 *         obj.session = session
 *         obj.handle = handle             # <<<<<<<<<<<<<<
 *         return obj
 * 
*/
  __pyx_v_obj->handle = __pyx_v_handle;

  /* "pkcs11/_pkcs11.pyx":1211
 *         obj.session = session
 *         obj.handle = handle
 *         return obj             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self):
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_obj);
  __pyx_r = __pyx_v_obj;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":1205
 *     cdef readonly CK_OBJECT_HANDLE handle
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef ObjectHandleWrapper wrap(Session session, CK_OBJECT_HANDLE handle):
 *         cdef ObjectHandleWrapper obj = ObjectHandleWrapper.__new__(ObjectHandleWrapper)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pkcs11._pkcs11.ObjectHandleWrapper.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_obj);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1213
 *         return obj
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         raise TypeError
 * 
*/

/* Python wrapper */
static int __pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, __pyx_nargs); return -1; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__init__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_19ObjectHandleWrapper___init__(((struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *)__pyx_v_self));

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

static int __pyx_pf_6pkcs11_7_pkcs11_19ObjectHandleWrapper___init__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *__pyx_v_self) {
  int __pyx_r;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "pkcs11/_pkcs11.pyx":1214
 * 
 *     def __init__(self):
 *         raise TypeError             # <<<<<<<<<<<<<<
 * 
 *     cdef AttributeList get_attribute_list(self, CK_ATTRIBUTE_TYPE * keys, CK_ULONG total) with gil:
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), 0, 0, 0);
  __PYX_ERR(0, 1214, __pyx_L1_error)

  /* "pkcs11/_pkcs11.pyx":1213
 *         return obj
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         raise TypeError
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.ObjectHandleWrapper.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1216
 *         raise TypeError
 * 
 *     cdef AttributeList get_attribute_list(self, CK_ATTRIBUTE_TYPE * keys, CK_ULONG total) with gil:             # <<<<<<<<<<<<<<
 *         cdef CK_SESSION_HANDLE handle = self.session.handle
 *         cdef CK_OBJECT_HANDLE obj = self.handle
*/

static struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_f_6pkcs11_7_pkcs11_19ObjectHandleWrapper_get_attribute_list(struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *__pyx_v_self, CK_ATTRIBUTE_TYPE *__pyx_v_keys, CK_ULONG __pyx_v_total) {
  CK_SESSION_HANDLE __pyx_v_handle;
  CK_OBJECT_HANDLE __pyx_v_obj;
  CK_ULONG __pyx_v_ix;
  CK_ULONG __pyx_v_retrievable;
  CK_ATTRIBUTE *__pyx_v_tpl;
  CK_RV __pyx_v_retval;
  struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_result = NULL;
  struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  CK_SESSION_HANDLE __pyx_t_1;
  CK_OBJECT_HANDLE __pyx_t_2;
  CK_ULONG __pyx_t_3;
  CK_ULONG __pyx_t_4;
  CK_ULONG __pyx_t_5;
  int __pyx_t_6;
  CK_ATTRIBUTE_TYPE __pyx_t_7;
  CK_ULONG __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("get_attribute_list", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_self);

  /* "pkcs11/_pkcs11.pyx":1217
 * 
 *     cdef AttributeList get_attribute_list(self, CK_ATTRIBUTE_TYPE * keys, CK_ULONG total) with gil:
 *         cdef CK_SESSION_HANDLE handle = self.session.handle             # <<<<<<<<<<<<<<
 *         cdef CK_OBJECT_HANDLE obj = self.handle
 *         cdef CK_ULONG ix = 0
*/
  __pyx_t_1 = __pyx_v_self->session->handle;
  __pyx_v_handle = __pyx_t_1;

  /* "pkcs11/_pkcs11.pyx":1218
 *     cdef AttributeList get_attribute_list(self, CK_ATTRIBUTE_TYPE * keys, CK_ULONG total) with gil:
 *         cdef CK_SESSION_HANDLE handle = self.session.handle
 *         cdef CK_OBJECT_HANDLE obj = self.handle             # <<<<<<<<<<<<<<
 *         cdef CK_ULONG ix = 0
 *         cdef CK_ULONG retrievable = 0
*/
  __pyx_t_2 = __pyx_v_self->handle;
  __pyx_v_obj = __pyx_t_2;

  /* "pkcs11/_pkcs11.pyx":1219
 *         cdef CK_SESSION_HANDLE handle = self.session.handle
 *         cdef CK_OBJECT_HANDLE obj = self.handle
 *         cdef CK_ULONG ix = 0             # <<<<<<<<<<<<<<
 *         cdef CK_ULONG retrievable = 0
 *         cdef CK_ATTRIBUTE *tpl = <CK_ATTRIBUTE *> PyMem_Malloc(total * sizeof(CK_ATTRIBUTE))
*/
  __pyx_v_ix = 0;

  /* "pkcs11/_pkcs11.pyx":1220
 *         cdef CK_OBJECT_HANDLE obj = self.handle
 *         cdef CK_ULONG ix = 0
 *         cdef CK_ULONG retrievable = 0             # <<<<<<<<<<<<<<
 *         cdef CK_ATTRIBUTE *tpl = <CK_ATTRIBUTE *> PyMem_Malloc(total * sizeof(CK_ATTRIBUTE))
 *         cdef CK_RV retval
*/
  __pyx_v_retrievable = 0;

  /* "pkcs11/_pkcs11.pyx":1221
 *         cdef CK_ULONG ix = 0
 *         cdef CK_ULONG retrievable = 0
 *         cdef CK_ATTRIBUTE *tpl = <CK_ATTRIBUTE *> PyMem_Malloc(total * sizeof(CK_ATTRIBUTE))             # <<<<<<<<<<<<<<
 *         cdef CK_RV retval
 * 
*/
  __pyx_v_tpl = ((CK_ATTRIBUTE *)PyMem_Malloc((__pyx_v_total * (sizeof(CK_ATTRIBUTE)))));

  /* "pkcs11/_pkcs11.pyx":1224
 *         cdef CK_RV retval
 * 
 *         for ix in range(total):             # <<<<<<<<<<<<<<
 *             tpl[ix].type = keys[ix]
 *             tpl[ix].pValue = NULL
*/
  __pyx_t_3 = __pyx_v_total;
  __pyx_t_4 = __pyx_t_3;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
    __pyx_v_ix = __pyx_t_5;

    /* "pkcs11/_pkcs11.pyx":1225
 * 
 *         for ix in range(total):
 *             tpl[ix].type = keys[ix]             # <<<<<<<<<<<<<<
 *             tpl[ix].pValue = NULL
 *             tpl[ix].ulValueLen = <CK_ULONG> 0
*/
    (__pyx_v_tpl[__pyx_v_ix]).type = (__pyx_v_keys[__pyx_v_ix]);

    /* "pkcs11/_pkcs11.pyx":1226
 *         for ix in range(total):
 *             tpl[ix].type = keys[ix]
 *             tpl[ix].pValue = NULL             # <<<<<<<<<<<<<<
 *             tpl[ix].ulValueLen = <CK_ULONG> 0
 * 
*/
    (__pyx_v_tpl[__pyx_v_ix]).pValue = NULL;

    /* "pkcs11/_pkcs11.pyx":1227
 *             tpl[ix].type = keys[ix]
 *             tpl[ix].pValue = NULL
 *             tpl[ix].ulValueLen = <CK_ULONG> 0             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
*/
    (__pyx_v_tpl[__pyx_v_ix]).ulValueLen = ((CK_ULONG)0);
  }

  /* "pkcs11/_pkcs11.pyx":1229
 *             tpl[ix].ulValueLen = <CK_ULONG> 0
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_GetAttributeValue(handle, obj, tpl, total)
 * 
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":1230
 * 
 *         with nogil:
 *             retval = self.funclist.C_GetAttributeValue(handle, obj, tpl, total)             # <<<<<<<<<<<<<<
 * 
 *         for ix in range(total):
*/
        __pyx_v_retval = __pyx_v_self->__pyx_base.funclist->C_GetAttributeValue(__pyx_v_handle, __pyx_v_obj, __pyx_v_tpl, __pyx_v_total);
      }

      /* "pkcs11/_pkcs11.pyx":1229
 *             tpl[ix].ulValueLen = <CK_ULONG> 0
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_GetAttributeValue(handle, obj, tpl, total)
 * 
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L7;
        }
        __pyx_L7:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":1232
 *             retval = self.funclist.C_GetAttributeValue(handle, obj, tpl, total)
 * 
 *         for ix in range(total):             # <<<<<<<<<<<<<<
 *             if tpl[ix].ulValueLen != CK_UNAVAILABLE_INFORMATION:
 *                 # overwrite the template at position 'retrievable' in the buffer
*/
  __pyx_t_3 = __pyx_v_total;
  __pyx_t_4 = __pyx_t_3;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
    __pyx_v_ix = __pyx_t_5;

    /* "pkcs11/_pkcs11.pyx":1233
 * 
 *         for ix in range(total):
 *             if tpl[ix].ulValueLen != CK_UNAVAILABLE_INFORMATION:             # <<<<<<<<<<<<<<
 *                 # overwrite the template at position 'retrievable' in the buffer
 *                 tpl[retrievable].type = tpl[ix].type
*/
    __pyx_t_6 = ((__pyx_v_tpl[__pyx_v_ix]).ulValueLen != CK_UNAVAILABLE_INFORMATION);
    if (__pyx_t_6) {

      /* "pkcs11/_pkcs11.pyx":1235
 *             if tpl[ix].ulValueLen != CK_UNAVAILABLE_INFORMATION:
 *                 # overwrite the template at position 'retrievable' in the buffer
 *                 tpl[retrievable].type = tpl[ix].type             # <<<<<<<<<<<<<<
 *                 tpl[retrievable].pValue = PyMem_Malloc(tpl[ix].ulValueLen)
 *                 if tpl[retrievable].pValue is NULL:
*/
      __pyx_t_7 = (__pyx_v_tpl[__pyx_v_ix]).type;
      (__pyx_v_tpl[__pyx_v_retrievable]).type = __pyx_t_7;

      /* "pkcs11/_pkcs11.pyx":1236
 *                 # overwrite the template at position 'retrievable' in the buffer
 *                 tpl[retrievable].type = tpl[ix].type
 *                 tpl[retrievable].pValue = PyMem_Malloc(tpl[ix].ulValueLen)             # <<<<<<<<<<<<<<
 *                 if tpl[retrievable].pValue is NULL:
 *                     raise MemoryError()
*/
      (__pyx_v_tpl[__pyx_v_retrievable]).pValue = PyMem_Malloc((__pyx_v_tpl[__pyx_v_ix]).ulValueLen);

      /* "pkcs11/_pkcs11.pyx":1237
 *                 tpl[retrievable].type = tpl[ix].type
 *                 tpl[retrievable].pValue = PyMem_Malloc(tpl[ix].ulValueLen)
 *                 if tpl[retrievable].pValue is NULL:             # <<<<<<<<<<<<<<
 *                     raise MemoryError()
 *                 tpl[retrievable].ulValueLen = tpl[ix].ulValueLen
*/
      __pyx_t_6 = ((__pyx_v_tpl[__pyx_v_retrievable]).pValue == NULL);
      if (unlikely(__pyx_t_6)) {

        /* "pkcs11/_pkcs11.pyx":1238
 *                 tpl[retrievable].pValue = PyMem_Malloc(tpl[ix].ulValueLen)
 *                 if tpl[retrievable].pValue is NULL:
 *                     raise MemoryError()             # <<<<<<<<<<<<<<
 *                 tpl[retrievable].ulValueLen = tpl[ix].ulValueLen
 *                 retrievable += 1
*/
        PyErr_NoMemory(); __PYX_ERR(0, 1238, __pyx_L1_error)

        /* "pkcs11/_pkcs11.pyx":1237
 *                 tpl[retrievable].type = tpl[ix].type
 *                 tpl[retrievable].pValue = PyMem_Malloc(tpl[ix].ulValueLen)
 *                 if tpl[retrievable].pValue is NULL:             # <<<<<<<<<<<<<<
 *                     raise MemoryError()
 *                 tpl[retrievable].ulValueLen = tpl[ix].ulValueLen
*/
      }

      /* "pkcs11/_pkcs11.pyx":1239
 *                 if tpl[retrievable].pValue is NULL:
 *                     raise MemoryError()
 *                 tpl[retrievable].ulValueLen = tpl[ix].ulValueLen             # <<<<<<<<<<<<<<
 *                 retrievable += 1
 *             # The spec prohibits returning CK_UNAVAILABLE_INFORMATION
*/
      __pyx_t_8 = (__pyx_v_tpl[__pyx_v_ix]).ulValueLen;
      (__pyx_v_tpl[__pyx_v_retrievable]).ulValueLen = __pyx_t_8;

      /* "pkcs11/_pkcs11.pyx":1240
 *                     raise MemoryError()
 *                 tpl[retrievable].ulValueLen = tpl[ix].ulValueLen
 *                 retrievable += 1             # <<<<<<<<<<<<<<
 *             # The spec prohibits returning CK_UNAVAILABLE_INFORMATION
 *             #  together with CKR_OK, but some tokens do that anyway.
*/
      __pyx_v_retrievable = (__pyx_v_retrievable + 1);

      /* "pkcs11/_pkcs11.pyx":1233
 * 
 *         for ix in range(total):
 *             if tpl[ix].ulValueLen != CK_UNAVAILABLE_INFORMATION:             # <<<<<<<<<<<<<<
 *                 # overwrite the template at position 'retrievable' in the buffer
 *                 tpl[retrievable].type = tpl[ix].type
*/
    }

    /* "pkcs11/_pkcs11.pyx":1244
 *             #  together with CKR_OK, but some tokens do that anyway.
 *             #  Let's be defensive and map that to a proper error,
 *             if tpl[ix].ulValueLen == CK_UNAVAILABLE_INFORMATION and retval == CKR_OK:             # <<<<<<<<<<<<<<
 *                 retval = CKR_FUNCTION_FAILED
 *                 break
*/
    __pyx_t_9 = ((__pyx_v_tpl[__pyx_v_ix]).ulValueLen == CK_UNAVAILABLE_INFORMATION);
    if (__pyx_t_9) {
    } else {
      __pyx_t_6 = __pyx_t_9;
      goto __pyx_L13_bool_binop_done;
    }
    __pyx_t_9 = (__pyx_v_retval == CKR_OK);
    __pyx_t_6 = __pyx_t_9;
    __pyx_L13_bool_binop_done:;
    if (__pyx_t_6) {

      /* "pkcs11/_pkcs11.pyx":1245
 *             #  Let's be defensive and map that to a proper error,
 *             if tpl[ix].ulValueLen == CK_UNAVAILABLE_INFORMATION and retval == CKR_OK:
 *                 retval = CKR_FUNCTION_FAILED             # <<<<<<<<<<<<<<
 *                 break
 * 
*/
      __pyx_v_retval = CKR_FUNCTION_FAILED;

      /* "pkcs11/_pkcs11.pyx":1246
 *             if tpl[ix].ulValueLen == CK_UNAVAILABLE_INFORMATION and retval == CKR_OK:
 *                 retval = CKR_FUNCTION_FAILED
 *                 break             # <<<<<<<<<<<<<<
 * 
 *         # when this gets GC'd, the __dealloc__ will clean up our buffers
*/
      goto __pyx_L9_break;

      /* "pkcs11/_pkcs11.pyx":1244
 *             #  together with CKR_OK, but some tokens do that anyway.
 *             #  Let's be defensive and map that to a proper error,
 *             if tpl[ix].ulValueLen == CK_UNAVAILABLE_INFORMATION and retval == CKR_OK:             # <<<<<<<<<<<<<<
 *                 retval = CKR_FUNCTION_FAILED
 *                 break
*/
    }
  }
  __pyx_L9_break:;

  /* "pkcs11/_pkcs11.pyx":1249
 * 
 *         # when this gets GC'd, the __dealloc__ will clean up our buffers
 *         result = AttributeList.from_owned_pointer(tpl, retrievable)             # <<<<<<<<<<<<<<
 *         if retrievable:
 *             with nogil:
*/
  __pyx_t_10 = ((PyObject *)__pyx_f_6pkcs11_7_pkcs11_13AttributeList_from_owned_pointer(__pyx_v_tpl, __pyx_v_retrievable)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_v_result = ((struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *)__pyx_t_10);
  __pyx_t_10 = 0;

  /* "pkcs11/_pkcs11.pyx":1250
 *         # when this gets GC'd, the __dealloc__ will clean up our buffers
 *         result = AttributeList.from_owned_pointer(tpl, retrievable)
 *         if retrievable:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 retval = self.funclist.C_GetAttributeValue(handle, obj, tpl, retrievable)
*/
  __pyx_t_6 = (__pyx_v_retrievable != 0);
  if (__pyx_t_6) {

    /* "pkcs11/_pkcs11.pyx":1251
 *         result = AttributeList.from_owned_pointer(tpl, retrievable)
 *         if retrievable:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 retval = self.funclist.C_GetAttributeValue(handle, obj, tpl, retrievable)
 *             for ix in range(retrievable):
*/
    {
        PyThreadState * _save;
        _save = PyEval_SaveThread();
        __Pyx_FastGIL_Remember();
        /*try:*/ {

          /* "pkcs11/_pkcs11.pyx":1252
 *         if retrievable:
 *             with nogil:
 *                 retval = self.funclist.C_GetAttributeValue(handle, obj, tpl, retrievable)             # <<<<<<<<<<<<<<
 *             for ix in range(retrievable):
 *                 # Ensure the data returned from the token is sane
*/
          __pyx_v_retval = __pyx_v_self->__pyx_base.funclist->C_GetAttributeValue(__pyx_v_handle, __pyx_v_obj, __pyx_v_tpl, __pyx_v_retrievable);
        }

        /* "pkcs11/_pkcs11.pyx":1251
 *         result = AttributeList.from_owned_pointer(tpl, retrievable)
 *         if retrievable:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 retval = self.funclist.C_GetAttributeValue(handle, obj, tpl, retrievable)
 *             for ix in range(retrievable):
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_FastGIL_Forget();
            PyEval_RestoreThread(_save);
            goto __pyx_L18;
          }
          __pyx_L18:;
        }
    }

    /* "pkcs11/_pkcs11.pyx":1253
 *             with nogil:
 *                 retval = self.funclist.C_GetAttributeValue(handle, obj, tpl, retrievable)
 *             for ix in range(retrievable):             # <<<<<<<<<<<<<<
 *                 # Ensure the data returned from the token is sane
 *                 if tpl[ix].ulValueLen == CK_UNAVAILABLE_INFORMATION or tpl[ix].pValue is NULL:
*/
    __pyx_t_3 = __pyx_v_retrievable;
    __pyx_t_4 = __pyx_t_3;
    for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
      __pyx_v_ix = __pyx_t_5;

      /* "pkcs11/_pkcs11.pyx":1255
 *             for ix in range(retrievable):
 *                 # Ensure the data returned from the token is sane
 *                 if tpl[ix].ulValueLen == CK_UNAVAILABLE_INFORMATION or tpl[ix].pValue is NULL:             # <<<<<<<<<<<<<<
 *                     retval = CKR_FUNCTION_FAILED
 *                     break
*/
      __pyx_t_9 = ((__pyx_v_tpl[__pyx_v_ix]).ulValueLen == CK_UNAVAILABLE_INFORMATION);
      if (!__pyx_t_9) {
      } else {
        __pyx_t_6 = __pyx_t_9;
        goto __pyx_L22_bool_binop_done;
      }
      __pyx_t_9 = ((__pyx_v_tpl[__pyx_v_ix]).pValue == NULL);
      __pyx_t_6 = __pyx_t_9;
      __pyx_L22_bool_binop_done:;
      if (__pyx_t_6) {

        /* "pkcs11/_pkcs11.pyx":1256
 *                 # Ensure the data returned from the token is sane
 *                 if tpl[ix].ulValueLen == CK_UNAVAILABLE_INFORMATION or tpl[ix].pValue is NULL:
 *                     retval = CKR_FUNCTION_FAILED             # <<<<<<<<<<<<<<
 *                     break
 *         assertRV(retval)
*/
        __pyx_v_retval = CKR_FUNCTION_FAILED;

        /* "pkcs11/_pkcs11.pyx":1257
 *                 if tpl[ix].ulValueLen == CK_UNAVAILABLE_INFORMATION or tpl[ix].pValue is NULL:
 *                     retval = CKR_FUNCTION_FAILED
 *                     break             # <<<<<<<<<<<<<<
 *         assertRV(retval)
 *         return result
*/
        goto __pyx_L20_break;

        /* "pkcs11/_pkcs11.pyx":1255
 *             for ix in range(retrievable):
 *                 # Ensure the data returned from the token is sane
 *                 if tpl[ix].ulValueLen == CK_UNAVAILABLE_INFORMATION or tpl[ix].pValue is NULL:             # <<<<<<<<<<<<<<
 *                     retval = CKR_FUNCTION_FAILED
 *                     break
*/
      }
    }
    __pyx_L20_break:;

    /* "pkcs11/_pkcs11.pyx":1250
 *         # when this gets GC'd, the __dealloc__ will clean up our buffers
 *         result = AttributeList.from_owned_pointer(tpl, retrievable)
 *         if retrievable:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 retval = self.funclist.C_GetAttributeValue(handle, obj, tpl, retrievable)
*/
  }

  /* "pkcs11/_pkcs11.pyx":1258
 *                     retval = CKR_FUNCTION_FAILED
 *                     break
 *         assertRV(retval)             # <<<<<<<<<<<<<<
 *         return result
 * 
*/
  __pyx_t_10 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "pkcs11/_pkcs11.pyx":1259
 *                     break
 *         assertRV(retval)
 *         return result             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":1216
 *         raise TypeError
 * 
 *     cdef AttributeList get_attribute_list(self, CK_ATTRIBUTE_TYPE * keys, CK_ULONG total) with gil:             # <<<<<<<<<<<<<<
 *         cdef CK_SESSION_HANDLE handle = self.session.handle
 *         cdef CK_OBJECT_HANDLE obj = self.handle
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("pkcs11._pkcs11.ObjectHandleWrapper.get_attribute_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XDECREF((PyObject *)__pyx_v_self);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1262
 * 
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef CK_ATTRIBUTE_TYPE key_t = key
 *         return self.get_attribute_list(&key_t, 1).at_index(0, self.session.attribute_mapper)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_19ObjectHandleWrapper_2__getitem__(((struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_19ObjectHandleWrapper_2__getitem__(struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *__pyx_v_self, PyObject *__pyx_v_key) {
  CK_ATTRIBUTE_TYPE __pyx_v_key_t;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  CK_ATTRIBUTE_TYPE __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "pkcs11/_pkcs11.pyx":1263
 * 
 *     def __getitem__(self, key):
 *         cdef CK_ATTRIBUTE_TYPE key_t = key             # <<<<<<<<<<<<<<
 *         return self.get_attribute_list(&key_t, 1).at_index(0, self.session.attribute_mapper)
 * 
*/
  __pyx_t_1 = __Pyx_PyLong_As_CK_ULONG(__pyx_v_key); if (unlikely((__pyx_t_1 == ((CK_ATTRIBUTE_TYPE)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1263, __pyx_L1_error)
  __pyx_v_key_t = __pyx_t_1;

  /* "pkcs11/_pkcs11.pyx":1264
 *     def __getitem__(self, key):
 *         cdef CK_ATTRIBUTE_TYPE key_t = key
 *         return self.get_attribute_list(&key_t, 1).at_index(0, self.session.attribute_mapper)             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, key, value):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_ObjectHandleWrapper *)__pyx_v_self->__pyx_vtab)->get_attribute_list(__pyx_v_self, (&__pyx_v_key_t), 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_v_self->session->attribute_mapper;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_AttributeList *)((struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *)__pyx_t_2)->__pyx_vtab)->at_index(((struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *)__pyx_t_2), 0, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":1262
 * 
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef CK_ATTRIBUTE_TYPE key_t = key
 *         return self.get_attribute_list(&key_t, 1).at_index(0, self.session.attribute_mapper)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pkcs11._pkcs11.ObjectHandleWrapper.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1266
 *         return self.get_attribute_list(&key_t, 1).at_index(0, self.session.attribute_mapper)
 * 
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         cdef CK_SESSION_HANDLE handle = self.session.handle
 *         cdef CK_OBJECT_HANDLE obj = self.handle
*/

/* Python wrapper */
static int __pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_5__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_5__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_19ObjectHandleWrapper_4__setitem__(((struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *)__pyx_v_self), ((PyObject *)__pyx_v_key), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_6pkcs11_7_pkcs11_19ObjectHandleWrapper_4__setitem__(struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  CK_SESSION_HANDLE __pyx_v_handle;
  CK_OBJECT_HANDLE __pyx_v_obj;
  CK_ATTRIBUTE __pyx_v_template;
  CK_RV __pyx_v_retval;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  CK_SESSION_HANDLE __pyx_t_1;
  CK_OBJECT_HANDLE __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  CK_ATTRIBUTE_TYPE __pyx_t_6;
  CK_CHAR *__pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);
  __Pyx_INCREF(__pyx_v_value);

  /* "pkcs11/_pkcs11.pyx":1267
 * 
 *     def __setitem__(self, key, value):
 *         cdef CK_SESSION_HANDLE handle = self.session.handle             # <<<<<<<<<<<<<<
 *         cdef CK_OBJECT_HANDLE obj = self.handle
 *         cdef CK_ATTRIBUTE template
*/
  __pyx_t_1 = __pyx_v_self->session->handle;
  __pyx_v_handle = __pyx_t_1;

  /* "pkcs11/_pkcs11.pyx":1268
 *     def __setitem__(self, key, value):
 *         cdef CK_SESSION_HANDLE handle = self.session.handle
 *         cdef CK_OBJECT_HANDLE obj = self.handle             # <<<<<<<<<<<<<<
 *         cdef CK_ATTRIBUTE template
 *         cdef CK_RV retval
*/
  __pyx_t_2 = __pyx_v_self->handle;
  __pyx_v_obj = __pyx_t_2;

  /* "pkcs11/_pkcs11.pyx":1272
 *         cdef CK_RV retval
 * 
 *         value = self.session.attribute_mapper.pack_attribute(key, value)             # <<<<<<<<<<<<<<
 * 
 *         template.type = key
*/
  __pyx_t_4 = __pyx_v_self->session->attribute_mapper;
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_key, __pyx_v_value};
    __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_pack_attribute, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1272, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "pkcs11/_pkcs11.pyx":1274
 *         value = self.session.attribute_mapper.pack_attribute(key, value)
 * 
 *         template.type = key             # <<<<<<<<<<<<<<
 *         template.pValue = <CK_CHAR *> value
 *         template.ulValueLen = <CK_ULONG>len(value)
*/
  __pyx_t_6 = __Pyx_PyLong_As_CK_ULONG(__pyx_v_key); if (unlikely((__pyx_t_6 == ((CK_ATTRIBUTE_TYPE)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1274, __pyx_L1_error)
  __pyx_v_template.type = __pyx_t_6;

  /* "pkcs11/_pkcs11.pyx":1275
 * 
 *         template.type = key
 *         template.pValue = <CK_CHAR *> value             # <<<<<<<<<<<<<<
 *         template.ulValueLen = <CK_ULONG>len(value)
 * 
*/
  __pyx_t_7 = __Pyx_PyObject_AsWritableUString(__pyx_v_value); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 1275, __pyx_L1_error)
  __pyx_v_template.pValue = ((CK_CHAR *)__pyx_t_7);

  /* "pkcs11/_pkcs11.pyx":1276
 *         template.type = key
 *         template.pValue = <CK_CHAR *> value
 *         template.ulValueLen = <CK_ULONG>len(value)             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
*/
  __pyx_t_8 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1276, __pyx_L1_error)
  __pyx_v_template.ulValueLen = ((CK_ULONG)__pyx_t_8);

  /* "pkcs11/_pkcs11.pyx":1278
 *         template.ulValueLen = <CK_ULONG>len(value)
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_SetAttributeValue(handle, obj, &template, 1)
 *         assertRV(retval)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":1279
 * 
 *         with nogil:
 *             retval = self.funclist.C_SetAttributeValue(handle, obj, &template, 1)             # <<<<<<<<<<<<<<
 *         assertRV(retval)
 * 
*/
        __pyx_v_retval = __pyx_v_self->__pyx_base.funclist->C_SetAttributeValue(__pyx_v_handle, __pyx_v_obj, (&__pyx_v_template), 1);
      }

      /* "pkcs11/_pkcs11.pyx":1278
 *         template.ulValueLen = <CK_ULONG>len(value)
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_SetAttributeValue(handle, obj, &template, 1)
 *         assertRV(retval)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":1280
 *         with nogil:
 *             retval = self.funclist.C_SetAttributeValue(handle, obj, &template, 1)
 *         assertRV(retval)             # <<<<<<<<<<<<<<
 * 
 *     def destroy(self):
*/
  __pyx_t_3 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":1266
 *         return self.get_attribute_list(&key_t, 1).at_index(0, self.session.attribute_mapper)
 * 
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         cdef CK_SESSION_HANDLE handle = self.session.handle
 *         cdef CK_OBJECT_HANDLE obj = self.handle
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pkcs11._pkcs11.ObjectHandleWrapper.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1282
 *         assertRV(retval)
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         cdef CK_SESSION_HANDLE handle = self.session.handle
 *         cdef CK_OBJECT_HANDLE obj = self.handle
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_7destroy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_19ObjectHandleWrapper_7destroy = {"destroy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_7destroy, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_7destroy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroy (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("destroy", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("destroy", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_19ObjectHandleWrapper_6destroy(((struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_19ObjectHandleWrapper_6destroy(struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *__pyx_v_self) {
  CK_SESSION_HANDLE __pyx_v_handle;
  CK_OBJECT_HANDLE __pyx_v_obj;
  CK_RV __pyx_v_retval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  CK_SESSION_HANDLE __pyx_t_1;
  CK_OBJECT_HANDLE __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("destroy", 0);

  /* "pkcs11/_pkcs11.pyx":1283
 * 
 *     def destroy(self):
 *         cdef CK_SESSION_HANDLE handle = self.session.handle             # <<<<<<<<<<<<<<
 *         cdef CK_OBJECT_HANDLE obj = self.handle
 *         cdef CK_RV retval
*/
  __pyx_t_1 = __pyx_v_self->session->handle;
  __pyx_v_handle = __pyx_t_1;

  /* "pkcs11/_pkcs11.pyx":1284
 *     def destroy(self):
 *         cdef CK_SESSION_HANDLE handle = self.session.handle
 *         cdef CK_OBJECT_HANDLE obj = self.handle             # <<<<<<<<<<<<<<
 *         cdef CK_RV retval
 * 
*/
  __pyx_t_2 = __pyx_v_self->handle;
  __pyx_v_obj = __pyx_t_2;

  /* "pkcs11/_pkcs11.pyx":1287
 *         cdef CK_RV retval
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.session.funclist.C_DestroyObject(handle, obj)
 *         assertRV(retval)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":1288
 * 
 *         with nogil:
 *             retval = self.session.funclist.C_DestroyObject(handle, obj)             # <<<<<<<<<<<<<<
 *         assertRV(retval)
 * 
*/
        __pyx_v_retval = __pyx_v_self->session->__pyx_base.funclist->C_DestroyObject(__pyx_v_handle, __pyx_v_obj);
      }

      /* "pkcs11/_pkcs11.pyx":1287
 *         cdef CK_RV retval
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.session.funclist.C_DestroyObject(handle, obj)
 *         assertRV(retval)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":1289
 *         with nogil:
 *             retval = self.session.funclist.C_DestroyObject(handle, obj)
 *         assertRV(retval)             # <<<<<<<<<<<<<<
 * 
 *     def copy(self, attrs):
*/
  __pyx_t_3 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":1282
 *         assertRV(retval)
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         cdef CK_SESSION_HANDLE handle = self.session.handle
 *         cdef CK_OBJECT_HANDLE obj = self.handle
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pkcs11._pkcs11.ObjectHandleWrapper.destroy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1291
 *         assertRV(retval)
 * 
 *     def copy(self, attrs):             # <<<<<<<<<<<<<<
 *         template = self.session.make_attribute_list(attrs)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_9copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_19ObjectHandleWrapper_9copy = {"copy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_9copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_9copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_attrs = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_attrs,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1291, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1291, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "copy", 0) < (0)) __PYX_ERR(0, 1291, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("copy", 1, 1, 1, i); __PYX_ERR(0, 1291, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1291, __pyx_L3_error)
    }
    __pyx_v_attrs = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("copy", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1291, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.ObjectHandleWrapper.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_19ObjectHandleWrapper_8copy(((struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *)__pyx_v_self), __pyx_v_attrs);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_19ObjectHandleWrapper_8copy(struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *__pyx_v_self, PyObject *__pyx_v_attrs) {
  struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_template = NULL;
  CK_SESSION_HANDLE __pyx_v_handle;
  CK_OBJECT_HANDLE __pyx_v_obj;
  CK_ATTRIBUTE *__pyx_v_attr_data;
  CK_ULONG __pyx_v_attr_count;
  CK_OBJECT_HANDLE __pyx_v_new_obj;
  CK_RV __pyx_v_retval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  CK_SESSION_HANDLE __pyx_t_2;
  CK_OBJECT_HANDLE __pyx_t_3;
  CK_ATTRIBUTE *__pyx_t_4;
  CK_ULONG __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);

  /* "pkcs11/_pkcs11.pyx":1292
 * 
 *     def copy(self, attrs):
 *         template = self.session.make_attribute_list(attrs)             # <<<<<<<<<<<<<<
 * 
 *         cdef CK_SESSION_HANDLE handle = self.session.handle
*/
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_Session *)__pyx_v_self->session->__pyx_vtab)->make_attribute_list(__pyx_v_self->session, __pyx_v_attrs)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_template = ((struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1294
 *         template = self.session.make_attribute_list(attrs)
 * 
 *         cdef CK_SESSION_HANDLE handle = self.session.handle             # <<<<<<<<<<<<<<
 *         cdef CK_OBJECT_HANDLE obj = self.handle
 *         cdef CK_ATTRIBUTE *attr_data = template.data
*/
  __pyx_t_2 = __pyx_v_self->session->handle;
  __pyx_v_handle = __pyx_t_2;

  /* "pkcs11/_pkcs11.pyx":1295
 * 
 *         cdef CK_SESSION_HANDLE handle = self.session.handle
 *         cdef CK_OBJECT_HANDLE obj = self.handle             # <<<<<<<<<<<<<<
 *         cdef CK_ATTRIBUTE *attr_data = template.data
 *         cdef CK_ULONG attr_count = template.count
*/
  __pyx_t_3 = __pyx_v_self->handle;
  __pyx_v_obj = __pyx_t_3;

  /* "pkcs11/_pkcs11.pyx":1296
 *         cdef CK_SESSION_HANDLE handle = self.session.handle
 *         cdef CK_OBJECT_HANDLE obj = self.handle
 *         cdef CK_ATTRIBUTE *attr_data = template.data             # <<<<<<<<<<<<<<
 *         cdef CK_ULONG attr_count = template.count
 *         cdef CK_OBJECT_HANDLE new_obj
*/
  __pyx_t_4 = __pyx_v_template->data;
  __pyx_v_attr_data = __pyx_t_4;

  /* "pkcs11/_pkcs11.pyx":1297
 *         cdef CK_OBJECT_HANDLE obj = self.handle
 *         cdef CK_ATTRIBUTE *attr_data = template.data
 *         cdef CK_ULONG attr_count = template.count             # <<<<<<<<<<<<<<
 *         cdef CK_OBJECT_HANDLE new_obj
 *         cdef CK_RV retval
*/
  __pyx_t_5 = __pyx_v_template->count;
  __pyx_v_attr_count = __pyx_t_5;

  /* "pkcs11/_pkcs11.pyx":1301
 *         cdef CK_RV retval
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.session.funclist.C_CopyObject(handle, obj, attr_data, attr_count, &new_obj)
 *         assertRV(retval)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":1302
 * 
 *         with nogil:
 *             retval = self.session.funclist.C_CopyObject(handle, obj, attr_data, attr_count, &new_obj)             # <<<<<<<<<<<<<<
 *         assertRV(retval)
 *         return new_obj
*/
        __pyx_v_retval = __pyx_v_self->session->__pyx_base.funclist->C_CopyObject(__pyx_v_handle, __pyx_v_obj, __pyx_v_attr_data, __pyx_v_attr_count, (&__pyx_v_new_obj));
      }

      /* "pkcs11/_pkcs11.pyx":1301
 *         cdef CK_RV retval
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.session.funclist.C_CopyObject(handle, obj, attr_data, attr_count, &new_obj)
 *         assertRV(retval)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":1303
 *         with nogil:
 *             retval = self.session.funclist.C_CopyObject(handle, obj, attr_data, attr_count, &new_obj)
 *         assertRV(retval)             # <<<<<<<<<<<<<<
 *         return new_obj
 * 
*/
  __pyx_t_1 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "pkcs11/_pkcs11.pyx":1304
 *             retval = self.session.funclist.C_CopyObject(handle, obj, attr_data, attr_count, &new_obj)
 *         assertRV(retval)
 *         return new_obj             # <<<<<<<<<<<<<<
 * 
 *     def identity(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = __Pyx_PyLong_From_CK_ULONG(__pyx_v_new_obj); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":1291
 *         assertRV(retval)
 * 
 *     def copy(self, attrs):             # <<<<<<<<<<<<<<
 *         template = self.session.make_attribute_list(attrs)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pkcs11._pkcs11.ObjectHandleWrapper.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_template);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1306
 *         return new_obj
 * 
 *     def identity(self):             # <<<<<<<<<<<<<<
 *         return ObjectHandleWrapper.__name__, self.session, self.handle
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_11identity(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_19ObjectHandleWrapper_11identity = {"identity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_11identity, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_11identity(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("identity (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("identity", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("identity", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_19ObjectHandleWrapper_10identity(((struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_19ObjectHandleWrapper_10identity(struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("identity", 0);

  /* "pkcs11/_pkcs11.pyx":1307
 * 
 *     def identity(self):
 *         return ObjectHandleWrapper.__name__, self.session, self.handle             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_ObjectHandleWrapper), __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1307, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyLong_From_CK_ULONG(__pyx_v_self->handle); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1307, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1307, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 1307, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_v_self->session);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self->session);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self->session)) != (0)) __PYX_ERR(0, 1307, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2) != (0)) __PYX_ERR(0, 1307, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":1306
 *         return new_obj
 * 
 *     def identity(self):             # <<<<<<<<<<<<<<
 *         return ObjectHandleWrapper.__name__, self.session, self.handle
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pkcs11._pkcs11.ObjectHandleWrapper.identity", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1202
 *     """
 * 
 *     cdef readonly Session session             # <<<<<<<<<<<<<<
 *     cdef readonly CK_OBJECT_HANDLE handle
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_7session_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_7session_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_19ObjectHandleWrapper_7session___get__(((struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_19ObjectHandleWrapper_7session___get__(struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self->session);
  __pyx_r = ((PyObject *)__pyx_v_self->session);
  goto __pyx_L0;

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

/* "pkcs11/_pkcs11.pyx":1203
 * 
 *     cdef readonly Session session
 *     cdef readonly CK_OBJECT_HANDLE handle             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_6handle_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_6handle_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_19ObjectHandleWrapper_6handle___get__(((struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_19ObjectHandleWrapper_6handle___get__(struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_CK_ULONG(__pyx_v_self->handle); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pkcs11._pkcs11.ObjectHandleWrapper.handle.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_13__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_19ObjectHandleWrapper_13__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_13__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_13__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_19ObjectHandleWrapper_12__reduce_cython__(((struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_19ObjectHandleWrapper_12__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 2, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.ObjectHandleWrapper.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_15__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_19ObjectHandleWrapper_15__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_15__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_15__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.ObjectHandleWrapper.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_19ObjectHandleWrapper_14__setstate_cython__(((struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *)__pyx_v_self), __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_19ObjectHandleWrapper_14__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 4, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.ObjectHandleWrapper.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1313
 *     """Expand Object with an implementation."""
 * 
 *     def __init__(self, wrapper: ObjectHandleWrapper):             # <<<<<<<<<<<<<<
 *         self.wrapper = wrapper
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_6Object_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_6Object_1__init__ = {"__init__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_6Object_1__init__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_6Object_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *__pyx_v_wrapper = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_wrapper,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1313, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1313, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1313, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 1313, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, i); __PYX_ERR(0, 1313, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1313, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1313, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_wrapper = ((struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *)values[1]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1313, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.Object.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_wrapper), __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_ObjectHandleWrapper, 0, "wrapper", 0))) __PYX_ERR(0, 1313, __pyx_L1_error)
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_6Object___init__(__pyx_self, __pyx_v_self, __pyx_v_wrapper);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_6Object___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *__pyx_v_wrapper) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pkcs11/_pkcs11.pyx":1314
 * 
 *     def __init__(self, wrapper: ObjectHandleWrapper):
 *         self.wrapper = wrapper             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, item):
*/
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_wrapper, ((PyObject *)__pyx_v_wrapper)) < (0)) __PYX_ERR(0, 1314, __pyx_L1_error)

  /* "pkcs11/_pkcs11.pyx":1313
 *     """Expand Object with an implementation."""
 * 
 *     def __init__(self, wrapper: ObjectHandleWrapper):             # <<<<<<<<<<<<<<
 *         self.wrapper = wrapper
 * 
*/

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

/* "pkcs11/_pkcs11.pyx":1316
 *         self.wrapper = wrapper
 * 
 *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
 *         return self.wrapper[item]
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_6Object_3__getitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_6Object_3__getitem__ = {"__getitem__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_6Object_3__getitem__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_6Object_3__getitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_item = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_item,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1316, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1316, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1316, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__getitem__", 0) < (0)) __PYX_ERR(0, 1316, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__getitem__", 1, 2, 2, i); __PYX_ERR(0, 1316, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1316, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1316, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_item = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__getitem__", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1316, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.Object.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_6Object_2__getitem__(__pyx_self, __pyx_v_self, __pyx_v_item);

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

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

  /* "pkcs11/_pkcs11.pyx":1317
 * 
 *     def __getitem__(self, item):
 *         return self.wrapper[item]             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, key, value):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_wrapper); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1317, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1317, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":1316
 *         self.wrapper = wrapper
 * 
 *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
 *         return self.wrapper[item]
 * 
*/

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

/* "pkcs11/_pkcs11.pyx":1319
 *         return self.wrapper[item]
 * 
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         self.wrapper[key] = value
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_6Object_5__setitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_6Object_5__setitem__ = {"__setitem__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_6Object_5__setitem__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_6Object_5__setitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_value = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_key,&__pyx_mstate_global->__pyx_n_u_value,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1319, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1319, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1319, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1319, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setitem__", 0) < (0)) __PYX_ERR(0, 1319, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setitem__", 1, 3, 3, i); __PYX_ERR(0, 1319, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1319, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1319, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1319, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_key = values[1];
    __pyx_v_value = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setitem__", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 1319, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.Object.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_6Object_4__setitem__(__pyx_self, __pyx_v_self, __pyx_v_key, __pyx_v_value);

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

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

  /* "pkcs11/_pkcs11.pyx":1320
 * 
 *     def __setitem__(self, key, value):
 *         self.wrapper[key] = value             # <<<<<<<<<<<<<<
 * 
 *     def get_attributes(self, keys):
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_wrapper); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely((PyObject_SetItem(__pyx_t_1, __pyx_v_key, __pyx_v_value) < 0))) __PYX_ERR(0, 1320, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1319
 *         return self.wrapper[item]
 * 
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         self.wrapper[key] = value
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pkcs11._pkcs11.Object.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1322
 *         self.wrapper[key] = value
 * 
 *     def get_attributes(self, keys):             # <<<<<<<<<<<<<<
 *         cdef ObjectHandleWrapper wrapper = self.wrapper
 *         cdef CK_ULONG total = len(keys)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_6Object_7get_attributes(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_6Object_7get_attributes = {"get_attributes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_6Object_7get_attributes, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_6Object_7get_attributes(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_keys = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_attributes (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_keys,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1322, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1322, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1322, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_attributes", 0) < (0)) __PYX_ERR(0, 1322, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_attributes", 1, 2, 2, i); __PYX_ERR(0, 1322, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1322, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1322, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_keys = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_attributes", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1322, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.Object.get_attributes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_6Object_6get_attributes(__pyx_self, __pyx_v_self, __pyx_v_keys);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_6Object_6get_attributes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_keys) {
  struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *__pyx_v_wrapper = 0;
  CK_ULONG __pyx_v_total;
  CK_ATTRIBUTE_TYPE *__pyx_v_key_ptr;
  CK_ULONG __pyx_v_ix;
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  CK_ULONG __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  CK_ATTRIBUTE_TYPE __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  size_t __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  char const *__pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_attributes", 0);

  /* "pkcs11/_pkcs11.pyx":1323
 * 
 *     def get_attributes(self, keys):
 *         cdef ObjectHandleWrapper wrapper = self.wrapper             # <<<<<<<<<<<<<<
 *         cdef CK_ULONG total = len(keys)
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_wrapper); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_ObjectHandleWrapper))))) __PYX_ERR(0, 1323, __pyx_L1_error)
  __pyx_v_wrapper = ((struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1324
 *     def get_attributes(self, keys):
 *         cdef ObjectHandleWrapper wrapper = self.wrapper
 *         cdef CK_ULONG total = len(keys)             # <<<<<<<<<<<<<<
 * 
 *         if not total:
*/
  __pyx_t_2 = PyObject_Length(__pyx_v_keys); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1324, __pyx_L1_error)
  __pyx_v_total = __pyx_t_2;

  /* "pkcs11/_pkcs11.pyx":1326
 *         cdef CK_ULONG total = len(keys)
 * 
 *         if not total:             # <<<<<<<<<<<<<<
 *             return {}
 * 
*/
  __pyx_t_3 = (!(__pyx_v_total != 0));
  if (__pyx_t_3) {

    /* "pkcs11/_pkcs11.pyx":1327
 * 
 *         if not total:
 *             return {}             # <<<<<<<<<<<<<<
 * 
 *         cdef CK_ATTRIBUTE_TYPE * key_ptr = <CK_ATTRIBUTE_TYPE *> PyMem_Malloc(total * sizeof(CK_ATTRIBUTE_TYPE))
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1327, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "pkcs11/_pkcs11.pyx":1326
 *         cdef CK_ULONG total = len(keys)
 * 
 *         if not total:             # <<<<<<<<<<<<<<
 *             return {}
 * 
*/
  }

  /* "pkcs11/_pkcs11.pyx":1329
 *             return {}
 * 
 *         cdef CK_ATTRIBUTE_TYPE * key_ptr = <CK_ATTRIBUTE_TYPE *> PyMem_Malloc(total * sizeof(CK_ATTRIBUTE_TYPE))             # <<<<<<<<<<<<<<
 *         cdef CK_ULONG ix = 0
 *         for ix, key in enumerate(keys):
*/
  __pyx_v_key_ptr = ((CK_ATTRIBUTE_TYPE *)PyMem_Malloc((__pyx_v_total * (sizeof(CK_ATTRIBUTE_TYPE)))));

  /* "pkcs11/_pkcs11.pyx":1330
 * 
 *         cdef CK_ATTRIBUTE_TYPE * key_ptr = <CK_ATTRIBUTE_TYPE *> PyMem_Malloc(total * sizeof(CK_ATTRIBUTE_TYPE))
 *         cdef CK_ULONG ix = 0             # <<<<<<<<<<<<<<
 *         for ix, key in enumerate(keys):
 *             key_ptr[ix] = <CK_ATTRIBUTE_TYPE> key
*/
  __pyx_v_ix = 0;

  /* "pkcs11/_pkcs11.pyx":1331
 *         cdef CK_ATTRIBUTE_TYPE * key_ptr = <CK_ATTRIBUTE_TYPE *> PyMem_Malloc(total * sizeof(CK_ATTRIBUTE_TYPE))
 *         cdef CK_ULONG ix = 0
 *         for ix, key in enumerate(keys):             # <<<<<<<<<<<<<<
 *             key_ptr[ix] = <CK_ATTRIBUTE_TYPE> key
 * 
*/
  __pyx_t_4 = 0;
  if (likely(PyList_CheckExact(__pyx_v_keys)) || PyTuple_CheckExact(__pyx_v_keys)) {
    __pyx_t_1 = __pyx_v_keys; __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_keys); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1331, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1331, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1331, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_6 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_2;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1331, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
        #else
        __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
        #endif
        ++__pyx_t_2;
      }
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1331, __pyx_L1_error)
    } else {
      __pyx_t_6 = __pyx_t_5(__pyx_t_1);
      if (unlikely(!__pyx_t_6)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1331, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_v_ix = __pyx_t_4;
    __pyx_t_4 = (__pyx_t_4 + 1);

    /* "pkcs11/_pkcs11.pyx":1332
 *         cdef CK_ULONG ix = 0
 *         for ix, key in enumerate(keys):
 *             key_ptr[ix] = <CK_ATTRIBUTE_TYPE> key             # <<<<<<<<<<<<<<
 * 
 *         try:
*/
    __pyx_t_7 = __Pyx_PyLong_As_CK_ULONG(__pyx_v_key); if (unlikely((__pyx_t_7 == ((CK_ATTRIBUTE_TYPE)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1332, __pyx_L1_error)
    (__pyx_v_key_ptr[__pyx_v_ix]) = ((CK_ATTRIBUTE_TYPE)__pyx_t_7);

    /* "pkcs11/_pkcs11.pyx":1331
 *         cdef CK_ATTRIBUTE_TYPE * key_ptr = <CK_ATTRIBUTE_TYPE *> PyMem_Malloc(total * sizeof(CK_ATTRIBUTE_TYPE))
 *         cdef CK_ULONG ix = 0
 *         for ix, key in enumerate(keys):             # <<<<<<<<<<<<<<
 *             key_ptr[ix] = <CK_ATTRIBUTE_TYPE> key
 * 
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1334
 *             key_ptr[ix] = <CK_ATTRIBUTE_TYPE> key
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             result = wrapper.get_attribute_list(key_ptr, total).as_dict(wrapper.session.attribute_mapper)
 *         finally:
*/
  /*try:*/ {

    /* "pkcs11/_pkcs11.pyx":1335
 * 
 *         try:
 *             result = wrapper.get_attribute_list(key_ptr, total).as_dict(wrapper.session.attribute_mapper)             # <<<<<<<<<<<<<<
 *         finally:
 *             PyMem_Free(key_ptr)
*/
    __pyx_t_8 = ((PyObject *)((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_ObjectHandleWrapper *)__pyx_v_wrapper->__pyx_vtab)->get_attribute_list(__pyx_v_wrapper, __pyx_v_key_ptr, __pyx_v_total)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1335, __pyx_L8_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_6 = __pyx_t_8;
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_9 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_wrapper->session->attribute_mapper};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_as_dict, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1335, __pyx_L8_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_result = __pyx_t_1;
    __pyx_t_1 = 0;
  }

  /* "pkcs11/_pkcs11.pyx":1337
 *             result = wrapper.get_attribute_list(key_ptr, total).as_dict(wrapper.session.attribute_mapper)
 *         finally:
 *             PyMem_Free(key_ptr)             # <<<<<<<<<<<<<<
 *         return result
 * 
*/
  /*finally:*/ {
    /*normal exit:*/{
      PyMem_Free(__pyx_v_key_ptr);
      goto __pyx_L9;
    }
    __pyx_L8_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if ( unlikely(__Pyx_GetException(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15) < 0)) __Pyx_ErrFetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_16);
      __Pyx_XGOTREF(__pyx_t_17);
      __Pyx_XGOTREF(__pyx_t_18);
      __pyx_t_10 = __pyx_lineno; __pyx_t_11 = __pyx_clineno; __pyx_t_12 = __pyx_filename;
      {
        PyMem_Free(__pyx_v_key_ptr);
      }
      __Pyx_XGIVEREF(__pyx_t_16);
      __Pyx_XGIVEREF(__pyx_t_17);
      __Pyx_XGIVEREF(__pyx_t_18);
      __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_ErrRestore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
      __pyx_lineno = __pyx_t_10; __pyx_clineno = __pyx_t_11; __pyx_filename = __pyx_t_12;
      goto __pyx_L1_error;
    }
    __pyx_L9:;
  }

  /* "pkcs11/_pkcs11.pyx":1338
 *         finally:
 *             PyMem_Free(key_ptr)
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":1322
 *         self.wrapper[key] = value
 * 
 *     def get_attributes(self, keys):             # <<<<<<<<<<<<<<
 *         cdef ObjectHandleWrapper wrapper = self.wrapper
 *         cdef CK_ULONG total = len(keys)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pkcs11._pkcs11.Object.get_attributes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_wrapper);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1340
 *         return result
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def session(self):
 *         return self.wrapper.session
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_6Object_9session(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_6Object_9session = {"session", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_6Object_9session, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_6Object_9session(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("session (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1340, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1340, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "session", 0) < (0)) __PYX_ERR(0, 1340, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("session", 1, 1, 1, i); __PYX_ERR(0, 1340, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1340, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("session", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1340, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.Object.session", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_6Object_8session(__pyx_self, __pyx_v_self);

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

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

  /* "pkcs11/_pkcs11.pyx":1342
 *     @property
 *     def session(self):
 *         return self.wrapper.session             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_wrapper); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_session); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":1340
 *         return result
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def session(self):
 *         return self.wrapper.session
*/

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

/* "pkcs11/_pkcs11.pyx":1344
 *         return self.wrapper.session
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def handle(self):
 *         return self.wrapper.handle
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_6Object_11handle(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_6Object_11handle = {"handle", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_6Object_11handle, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_6Object_11handle(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("handle (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1344, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1344, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "handle", 0) < (0)) __PYX_ERR(0, 1344, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("handle", 1, 1, 1, i); __PYX_ERR(0, 1344, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1344, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("handle", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1344, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.Object.handle", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_6Object_10handle(__pyx_self, __pyx_v_self);

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

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

  /* "pkcs11/_pkcs11.pyx":1346
 *     @property
 *     def handle(self):
 *         return self.wrapper.handle             # <<<<<<<<<<<<<<
 * 
 *     def copy(self, attrs):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_wrapper); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_handle); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":1344
 *         return self.wrapper.session
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def handle(self):
 *         return self.wrapper.handle
*/

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

/* "pkcs11/_pkcs11.pyx":1348
 *         return self.wrapper.handle
 * 
 *     def copy(self, attrs):             # <<<<<<<<<<<<<<
 *         new_obj = self.wrapper.copy(attrs)
 *         return make_object(self.wrapper.session, new_obj)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_6Object_13copy(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_6Object_13copy = {"copy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_6Object_13copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_6Object_13copy(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_attrs = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_attrs,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1348, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1348, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1348, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "copy", 0) < (0)) __PYX_ERR(0, 1348, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("copy", 1, 2, 2, i); __PYX_ERR(0, 1348, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1348, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1348, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_attrs = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("copy", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1348, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.Object.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_6Object_12copy(__pyx_self, __pyx_v_self, __pyx_v_attrs);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_6Object_12copy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_attrs) {
  PyObject *__pyx_v_new_obj = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  CK_OBJECT_HANDLE __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);

  /* "pkcs11/_pkcs11.pyx":1349
 * 
 *     def copy(self, attrs):
 *         new_obj = self.wrapper.copy(attrs)             # <<<<<<<<<<<<<<
 *         return make_object(self.wrapper.session, new_obj)
 * 
*/
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_wrapper); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1349, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_attrs};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_copy, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_new_obj = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1350
 *     def copy(self, attrs):
 *         new_obj = self.wrapper.copy(attrs)
 *         return make_object(self.wrapper.session, new_obj)             # <<<<<<<<<<<<<<
 * 
 *     def destroy(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_wrapper); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1350, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_session); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1350, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Session))))) __PYX_ERR(0, 1350, __pyx_L1_error)
  __pyx_t_5 = __Pyx_PyLong_As_CK_ULONG(__pyx_v_new_obj); if (unlikely((__pyx_t_5 == ((CK_OBJECT_HANDLE)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1350, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_6pkcs11_7_pkcs11_make_object(((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_t_3), __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1350, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":1348
 *         return self.wrapper.handle
 * 
 *     def copy(self, attrs):             # <<<<<<<<<<<<<<
 *         new_obj = self.wrapper.copy(attrs)
 *         return make_object(self.wrapper.session, new_obj)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pkcs11._pkcs11.Object.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_new_obj);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1352
 *         return make_object(self.wrapper.session, new_obj)
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         self.wrapper.destroy()
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_6Object_15destroy(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_6Object_15destroy = {"destroy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_6Object_15destroy, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_6Object_15destroy(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroy (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1352, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1352, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "destroy", 0) < (0)) __PYX_ERR(0, 1352, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("destroy", 1, 1, 1, i); __PYX_ERR(0, 1352, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1352, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("destroy", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1352, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.Object.destroy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_6Object_14destroy(__pyx_self, __pyx_v_self);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_6Object_14destroy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("destroy", 0);

  /* "pkcs11/_pkcs11.pyx":1353
 * 
 *     def destroy(self):
 *         self.wrapper.destroy()             # <<<<<<<<<<<<<<
 * 
 *     def _identity(self):
*/
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_wrapper); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1353, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_destroy, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1353, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1352
 *         return make_object(self.wrapper.session, new_obj)
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         self.wrapper.destroy()
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pkcs11._pkcs11.Object.destroy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1355
 *         self.wrapper.destroy()
 * 
 *     def _identity(self):             # <<<<<<<<<<<<<<
 *         return Object.__name__, self.wrapper.identity()
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_6Object_17_identity(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_6Object_17_identity = {"_identity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_6Object_17_identity, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_6Object_17_identity(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_identity (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1355, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1355, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_identity", 0) < (0)) __PYX_ERR(0, 1355, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_identity", 1, 1, 1, i); __PYX_ERR(0, 1355, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1355, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_identity", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1355, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.Object._identity", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_6Object_16_identity(__pyx_self, __pyx_v_self);

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

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

  /* "pkcs11/_pkcs11.pyx":1356
 * 
 *     def _identity(self):
 *         return Object.__name__, self.wrapper.identity()             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Object); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_wrapper); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __pyx_t_4;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_identity, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1356, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 1356, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 1356, __pyx_L1_error);
  __pyx_t_2 = 0;
  __pyx_t_1 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":1355
 *         self.wrapper.destroy()
 * 
 *     def _identity(self):             # <<<<<<<<<<<<<<
 *         return Object.__name__, self.wrapper.identity()
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pkcs11._pkcs11.Object._identity", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1359
 * 
 * 
 * cdef object make_object(Session session, CK_OBJECT_HANDLE handle) with gil:             # <<<<<<<<<<<<<<
 *     """
 *     Make an object with the right bases for its class and capabilities.
*/

static PyObject *__pyx_f_6pkcs11_7_pkcs11_make_object(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session, CK_OBJECT_HANDLE __pyx_v_handle) {
  struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *__pyx_v_wrapper = NULL;
  CK_ATTRIBUTE_TYPE __pyx_v_attr_keys[8];
  PyObject *__pyx_v_attributes = NULL;
  CK_ATTRIBUTE_TYPE __pyx_v_key;
  PyObject *__pyx_v_object_class = NULL;
  PyObject *__pyx_v_bases = NULL;
  PyObject *__pyx_v_attribute = NULL;
  PyObject *__pyx_v_mixin = NULL;
  PyTypeObject *__pyx_v_klass = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  CK_ATTRIBUTE_TYPE __pyx_t_3;
  CK_ATTRIBUTE_TYPE __pyx_t_4;
  CK_ATTRIBUTE_TYPE __pyx_t_5;
  CK_ATTRIBUTE_TYPE __pyx_t_6;
  CK_ATTRIBUTE_TYPE __pyx_t_7;
  CK_ATTRIBUTE_TYPE __pyx_t_8;
  CK_ATTRIBUTE_TYPE __pyx_t_9;
  CK_ATTRIBUTE_TYPE __pyx_t_10;
  CK_ATTRIBUTE_TYPE __pyx_t_11[8];
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  int __pyx_t_20;
  CK_ATTRIBUTE_TYPE *__pyx_t_21;
  CK_ATTRIBUTE_TYPE *__pyx_t_22;
  CK_ATTRIBUTE_TYPE *__pyx_t_23;
  PyObject *__pyx_t_24 = NULL;
  PyObject *__pyx_t_25 = NULL;
  PyObject *__pyx_t_26 = NULL;
  PyObject *__pyx_t_27 = NULL;
  PyObject *__pyx_t_28 = NULL;
  PyObject *__pyx_t_29 = NULL;
  PyObject *__pyx_t_30 = NULL;
  PyObject *__pyx_t_31 = NULL;
  size_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  int __pyx_t_34;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("make_object", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_session);

  /* "pkcs11/_pkcs11.pyx":1363
 *     Make an object with the right bases for its class and capabilities.
 *     """
 *     wrapper = ObjectHandleWrapper.wrap(session, handle)             # <<<<<<<<<<<<<<
 * 
 *     cdef CK_ATTRIBUTE_TYPE[8] attr_keys = [
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_6pkcs11_7_pkcs11_19ObjectHandleWrapper_wrap(__pyx_v_session, __pyx_v_handle)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_wrapper = ((struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1366
 * 
 *     cdef CK_ATTRIBUTE_TYPE[8] attr_keys = [
 *         Attribute.CLASS,             # <<<<<<<<<<<<<<
 *         Attribute.ENCRYPT,
 *         Attribute.DECRYPT,
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Attribute); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1366, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_CLASS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1366, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyLong_As_CK_ULONG(__pyx_t_2); if (unlikely((__pyx_t_3 == ((CK_ATTRIBUTE_TYPE)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1366, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pkcs11/_pkcs11.pyx":1367
 *     cdef CK_ATTRIBUTE_TYPE[8] attr_keys = [
 *         Attribute.CLASS,
 *         Attribute.ENCRYPT,             # <<<<<<<<<<<<<<
 *         Attribute.DECRYPT,
 *         Attribute.SIGN,
*/
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Attribute); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1367, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ENCRYPT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1367, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyLong_As_CK_ULONG(__pyx_t_1); if (unlikely((__pyx_t_4 == ((CK_ATTRIBUTE_TYPE)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1367, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1368
 *         Attribute.CLASS,
 *         Attribute.ENCRYPT,
 *         Attribute.DECRYPT,             # <<<<<<<<<<<<<<
 *         Attribute.SIGN,
 *         Attribute.VERIFY,
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Attribute); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1368, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_DECRYPT); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1368, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyLong_As_CK_ULONG(__pyx_t_2); if (unlikely((__pyx_t_5 == ((CK_ATTRIBUTE_TYPE)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1368, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pkcs11/_pkcs11.pyx":1369
 *         Attribute.ENCRYPT,
 *         Attribute.DECRYPT,
 *         Attribute.SIGN,             # <<<<<<<<<<<<<<
 *         Attribute.VERIFY,
 *         Attribute.WRAP,
*/
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Attribute); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1369, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_SIGN); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1369, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = __Pyx_PyLong_As_CK_ULONG(__pyx_t_1); if (unlikely((__pyx_t_6 == ((CK_ATTRIBUTE_TYPE)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1369, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1370
 *         Attribute.DECRYPT,
 *         Attribute.SIGN,
 *         Attribute.VERIFY,             # <<<<<<<<<<<<<<
 *         Attribute.WRAP,
 *         Attribute.UNWRAP,
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Attribute); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1370, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_VERIFY); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1370, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_7 = __Pyx_PyLong_As_CK_ULONG(__pyx_t_2); if (unlikely((__pyx_t_7 == ((CK_ATTRIBUTE_TYPE)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1370, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pkcs11/_pkcs11.pyx":1371
 *         Attribute.SIGN,
 *         Attribute.VERIFY,
 *         Attribute.WRAP,             # <<<<<<<<<<<<<<
 *         Attribute.UNWRAP,
 *         Attribute.DERIVE
*/
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Attribute); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_WRAP); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_8 = __Pyx_PyLong_As_CK_ULONG(__pyx_t_1); if (unlikely((__pyx_t_8 == ((CK_ATTRIBUTE_TYPE)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1371, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1372
 *         Attribute.VERIFY,
 *         Attribute.WRAP,
 *         Attribute.UNWRAP,             # <<<<<<<<<<<<<<
 *         Attribute.DERIVE
 *     ]
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Attribute); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1372, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_UNWRAP); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1372, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_9 = __Pyx_PyLong_As_CK_ULONG(__pyx_t_2); if (unlikely((__pyx_t_9 == ((CK_ATTRIBUTE_TYPE)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1372, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pkcs11/_pkcs11.pyx":1373
 *         Attribute.WRAP,
 *         Attribute.UNWRAP,
 *         Attribute.DERIVE             # <<<<<<<<<<<<<<
 *     ]
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Attribute); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1373, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DERIVE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1373, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_10 = __Pyx_PyLong_As_CK_ULONG(__pyx_t_1); if (unlikely((__pyx_t_10 == ((CK_ATTRIBUTE_TYPE)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1373, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1365
 *     wrapper = ObjectHandleWrapper.wrap(session, handle)
 * 
 *     cdef CK_ATTRIBUTE_TYPE[8] attr_keys = [             # <<<<<<<<<<<<<<
 *         Attribute.CLASS,
 *         Attribute.ENCRYPT,
*/
  __pyx_t_11[0] = __pyx_t_3;
  __pyx_t_11[1] = __pyx_t_4;
  __pyx_t_11[2] = __pyx_t_5;
  __pyx_t_11[3] = __pyx_t_6;
  __pyx_t_11[4] = __pyx_t_7;
  __pyx_t_11[5] = __pyx_t_8;
  __pyx_t_11[6] = __pyx_t_9;
  __pyx_t_11[7] = __pyx_t_10;
  memcpy(&(__pyx_v_attr_keys[0]), __pyx_t_11, sizeof(__pyx_v_attr_keys[0]) * (8));

  /* "pkcs11/_pkcs11.pyx":1376
 *     ]
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         # Determine a list of base classes to manufacture our class with
 *         try:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
    __Pyx_XGOTREF(__pyx_t_12);
    __Pyx_XGOTREF(__pyx_t_13);
    __Pyx_XGOTREF(__pyx_t_14);
    /*try:*/ {

      /* "pkcs11/_pkcs11.pyx":1378
 *     try:
 *         # Determine a list of base classes to manufacture our class with
 *         try:             # <<<<<<<<<<<<<<
 *             attributes = wrapper.get_attribute_list(&attr_keys[0], 8)
 *         except PKCS11Error:
*/
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
        __Pyx_XGOTREF(__pyx_t_15);
        __Pyx_XGOTREF(__pyx_t_16);
        __Pyx_XGOTREF(__pyx_t_17);
        /*try:*/ {

          /* "pkcs11/_pkcs11.pyx":1379
 *         # Determine a list of base classes to manufacture our class with
 *         try:
 *             attributes = wrapper.get_attribute_list(&attr_keys[0], 8)             # <<<<<<<<<<<<<<
 *         except PKCS11Error:
 *             # retry fetching the flags one by one, some tokens do not implement error handling
*/
          __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_ObjectHandleWrapper *)__pyx_v_wrapper->__pyx_vtab)->get_attribute_list(__pyx_v_wrapper, (&(__pyx_v_attr_keys[0])), 8)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1379, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_v_attributes = __pyx_t_1;
          __pyx_t_1 = 0;

          /* "pkcs11/_pkcs11.pyx":1378
 *     try:
 *         # Determine a list of base classes to manufacture our class with
 *         try:             # <<<<<<<<<<<<<<
 *             attributes = wrapper.get_attribute_list(&attr_keys[0], 8)
 *         except PKCS11Error:
*/
        }
        __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
        goto __pyx_L14_try_end;
        __pyx_L9_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "pkcs11/_pkcs11.pyx":1380
 *         try:
 *             attributes = wrapper.get_attribute_list(&attr_keys[0], 8)
 *         except PKCS11Error:             # <<<<<<<<<<<<<<
 *             # retry fetching the flags one by one, some tokens do not implement error handling
 *             # on bulk fetches correctly.
*/
        __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_2, &__pyx_t_18);
        __Pyx_GetModuleGlobalName(__pyx_t_19, __pyx_mstate_global->__pyx_n_u_PKCS11Error); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1380, __pyx_L11_except_error)
        __Pyx_GOTREF(__pyx_t_19);
        __pyx_t_20 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_19);
        __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
        __Pyx_ErrRestore(__pyx_t_1, __pyx_t_2, __pyx_t_18);
        __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_18 = 0;
        if (__pyx_t_20) {
          __Pyx_AddTraceback("pkcs11._pkcs11.make_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_18, &__pyx_t_2, &__pyx_t_1) < 0) __PYX_ERR(0, 1380, __pyx_L11_except_error)
          __Pyx_XGOTREF(__pyx_t_18);
          __Pyx_XGOTREF(__pyx_t_2);
          __Pyx_XGOTREF(__pyx_t_1);

          /* "pkcs11/_pkcs11.pyx":1383
 *             # retry fetching the flags one by one, some tokens do not implement error handling
 *             # on bulk fetches correctly.
 *             attributes = {}             # <<<<<<<<<<<<<<
 *             for key in attr_keys:
 *                 try:
*/
          __pyx_t_19 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1383, __pyx_L11_except_error)
          __Pyx_GOTREF(__pyx_t_19);
          __Pyx_XDECREF_SET(__pyx_v_attributes, __pyx_t_19);
          __pyx_t_19 = 0;

          /* "pkcs11/_pkcs11.pyx":1384
 *             # on bulk fetches correctly.
 *             attributes = {}
 *             for key in attr_keys:             # <<<<<<<<<<<<<<
 *                 try:
 *                     attributes[key] = wrapper[key]
*/
          __pyx_t_22 = (__pyx_v_attr_keys + 8);
          for (__pyx_t_23 = __pyx_v_attr_keys; __pyx_t_23 < __pyx_t_22; __pyx_t_23++) {
            __pyx_t_21 = __pyx_t_23;
            __pyx_v_key = (__pyx_t_21[0]);

            /* "pkcs11/_pkcs11.pyx":1385
 *             attributes = {}
 *             for key in attr_keys:
 *                 try:             # <<<<<<<<<<<<<<
 *                     attributes[key] = wrapper[key]
 *                 except (AttributeTypeInvalid, AttributeSensitive, FunctionFailed):
*/
            {
              __Pyx_PyThreadState_declare
              __Pyx_PyThreadState_assign
              __Pyx_ExceptionSave(&__pyx_t_24, &__pyx_t_25, &__pyx_t_26);
              __Pyx_XGOTREF(__pyx_t_24);
              __Pyx_XGOTREF(__pyx_t_25);
              __Pyx_XGOTREF(__pyx_t_26);
              /*try:*/ {

                /* "pkcs11/_pkcs11.pyx":1386
 *             for key in attr_keys:
 *                 try:
 *                     attributes[key] = wrapper[key]             # <<<<<<<<<<<<<<
 *                 except (AttributeTypeInvalid, AttributeSensitive, FunctionFailed):
 *                     continue
*/
                __pyx_t_19 = __Pyx_GetItemInt(((PyObject *)__pyx_v_wrapper), __pyx_v_key, CK_ATTRIBUTE_TYPE, 0, __Pyx_PyLong_From_CK_ULONG, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1386, __pyx_L19_error)
                __Pyx_GOTREF(__pyx_t_19);
                if (unlikely((__Pyx_SetItemInt(__pyx_v_attributes, __pyx_v_key, __pyx_t_19, CK_ATTRIBUTE_TYPE, 0, __Pyx_PyLong_From_CK_ULONG, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(0, 1386, __pyx_L19_error)
                __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;

                /* "pkcs11/_pkcs11.pyx":1385
 *             attributes = {}
 *             for key in attr_keys:
 *                 try:             # <<<<<<<<<<<<<<
 *                     attributes[key] = wrapper[key]
 *                 except (AttributeTypeInvalid, AttributeSensitive, FunctionFailed):
*/
              }
              __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
              __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
              __Pyx_XDECREF(__pyx_t_26); __pyx_t_26 = 0;
              goto __pyx_L26_try_end;
              __pyx_L19_error:;
              __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;

              /* "pkcs11/_pkcs11.pyx":1387
 *                 try:
 *                     attributes[key] = wrapper[key]
 *                 except (AttributeTypeInvalid, AttributeSensitive, FunctionFailed):             # <<<<<<<<<<<<<<
 *                     continue
 * 
*/
              __Pyx_ErrFetch(&__pyx_t_19, &__pyx_t_27, &__pyx_t_28);
              __Pyx_GetModuleGlobalName(__pyx_t_29, __pyx_mstate_global->__pyx_n_u_AttributeTypeInvalid); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 1387, __pyx_L21_except_error)
              __Pyx_GOTREF(__pyx_t_29);
              __Pyx_GetModuleGlobalName(__pyx_t_30, __pyx_mstate_global->__pyx_n_u_AttributeSensitive); if (unlikely(!__pyx_t_30)) __PYX_ERR(0, 1387, __pyx_L21_except_error)
              __Pyx_GOTREF(__pyx_t_30);
              __Pyx_GetModuleGlobalName(__pyx_t_31, __pyx_mstate_global->__pyx_n_u_FunctionFailed); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 1387, __pyx_L21_except_error)
              __Pyx_GOTREF(__pyx_t_31);
              __pyx_t_20 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_19, __pyx_t_29) || __Pyx_PyErr_GivenExceptionMatches(__pyx_t_19, __pyx_t_30) || __Pyx_PyErr_GivenExceptionMatches(__pyx_t_19, __pyx_t_31);
              __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
              __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
              __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
              __Pyx_ErrRestore(__pyx_t_19, __pyx_t_27, __pyx_t_28);
              __pyx_t_19 = 0; __pyx_t_27 = 0; __pyx_t_28 = 0;
              if (__pyx_t_20) {
                __Pyx_AddTraceback("pkcs11._pkcs11.make_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
                if (__Pyx_GetException(&__pyx_t_28, &__pyx_t_27, &__pyx_t_19) < 0) __PYX_ERR(0, 1387, __pyx_L21_except_error)
                __Pyx_XGOTREF(__pyx_t_28);
                __Pyx_XGOTREF(__pyx_t_27);
                __Pyx_XGOTREF(__pyx_t_19);

                /* "pkcs11/_pkcs11.pyx":1388
 *                     attributes[key] = wrapper[key]
 *                 except (AttributeTypeInvalid, AttributeSensitive, FunctionFailed):
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *         object_class = attributes.get(Attribute.CLASS, session.attribute_mapper)
*/
                goto __pyx_L27_except_continue;
                __pyx_L27_except_continue:;
                __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0;
                __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
                __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
                goto __pyx_L25_try_continue;
              }
              goto __pyx_L21_except_error;

              /* "pkcs11/_pkcs11.pyx":1385
 *             attributes = {}
 *             for key in attr_keys:
 *                 try:             # <<<<<<<<<<<<<<
 *                     attributes[key] = wrapper[key]
 *                 except (AttributeTypeInvalid, AttributeSensitive, FunctionFailed):
*/
              __pyx_L21_except_error:;
              __Pyx_XGIVEREF(__pyx_t_24);
              __Pyx_XGIVEREF(__pyx_t_25);
              __Pyx_XGIVEREF(__pyx_t_26);
              __Pyx_ExceptionReset(__pyx_t_24, __pyx_t_25, __pyx_t_26);
              goto __pyx_L11_except_error;
              __pyx_L25_try_continue:;
              __Pyx_XGIVEREF(__pyx_t_24);
              __Pyx_XGIVEREF(__pyx_t_25);
              __Pyx_XGIVEREF(__pyx_t_26);
              __Pyx_ExceptionReset(__pyx_t_24, __pyx_t_25, __pyx_t_26);
              goto __pyx_L17_continue;
              __pyx_L26_try_end:;
            }
            __pyx_L17_continue:;
          }
          __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          goto __pyx_L10_exception_handled;
        }
        goto __pyx_L11_except_error;

        /* "pkcs11/_pkcs11.pyx":1378
 *     try:
 *         # Determine a list of base classes to manufacture our class with
 *         try:             # <<<<<<<<<<<<<<
 *             attributes = wrapper.get_attribute_list(&attr_keys[0], 8)
 *         except PKCS11Error:
*/
        __pyx_L11_except_error:;
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_XGIVEREF(__pyx_t_17);
        __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
        goto __pyx_L3_error;
        __pyx_L10_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_XGIVEREF(__pyx_t_17);
        __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
        __pyx_L14_try_end:;
      }

      /* "pkcs11/_pkcs11.pyx":1390
 *                     continue
 * 
 *         object_class = attributes.get(Attribute.CLASS, session.attribute_mapper)             # <<<<<<<<<<<<<<
 *         bases = (_CLASS_MAP[object_class],)
 * 
*/
      __pyx_t_2 = __pyx_v_attributes;
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_GetModuleGlobalName(__pyx_t_18, __pyx_mstate_global->__pyx_n_u_Attribute); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1390, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_18);
      __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_mstate_global->__pyx_n_u_CLASS); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1390, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_19);
      __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
      __pyx_t_32 = 0;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_19, __pyx_v_session->attribute_mapper};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get, __pyx_callargs+__pyx_t_32, (3-__pyx_t_32) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1390, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_v_object_class = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "pkcs11/_pkcs11.pyx":1391
 * 
 *         object_class = attributes.get(Attribute.CLASS, session.attribute_mapper)
 *         bases = (_CLASS_MAP[object_class],)             # <<<<<<<<<<<<<<
 * 
 *         # Build a list of mixins for this new class
*/
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_CLASS_MAP); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1391, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_19 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_object_class); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1391, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_19);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1391, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_19);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_19) != (0)) __PYX_ERR(0, 1391, __pyx_L3_error);
      __pyx_t_19 = 0;
      __pyx_v_bases = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "pkcs11/_pkcs11.pyx":1395
 *         # Build a list of mixins for this new class
 *         for attribute, mixin in (
 *                 (Attribute.ENCRYPT, EncryptMixin),             # <<<<<<<<<<<<<<
 *                 (Attribute.DECRYPT, DecryptMixin),
 *                 (Attribute.SIGN, SignMixin),
*/
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Attribute); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1395, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_ENCRYPT); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1395, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_19);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_EncryptMixin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1395, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1395, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_19);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_19) != (0)) __PYX_ERR(0, 1395, __pyx_L3_error);
      __Pyx_GIVEREF(__pyx_t_1);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 1395, __pyx_L3_error);
      __pyx_t_19 = 0;
      __pyx_t_1 = 0;

      /* "pkcs11/_pkcs11.pyx":1396
 *         for attribute, mixin in (
 *                 (Attribute.ENCRYPT, EncryptMixin),
 *                 (Attribute.DECRYPT, DecryptMixin),             # <<<<<<<<<<<<<<
 *                 (Attribute.SIGN, SignMixin),
 *                 (Attribute.VERIFY, VerifyMixin),
*/
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Attribute); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1396, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_DECRYPT); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1396, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_19);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_DecryptMixin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1396, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1396, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_18);
      __Pyx_GIVEREF(__pyx_t_19);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_19) != (0)) __PYX_ERR(0, 1396, __pyx_L3_error);
      __Pyx_GIVEREF(__pyx_t_1);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 1396, __pyx_L3_error);
      __pyx_t_19 = 0;
      __pyx_t_1 = 0;

      /* "pkcs11/_pkcs11.pyx":1397
 *                 (Attribute.ENCRYPT, EncryptMixin),
 *                 (Attribute.DECRYPT, DecryptMixin),
 *                 (Attribute.SIGN, SignMixin),             # <<<<<<<<<<<<<<
 *                 (Attribute.VERIFY, VerifyMixin),
 *                 (Attribute.WRAP, WrapMixin),
*/
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Attribute); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1397, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_SIGN); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1397, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_19);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_SignMixin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1397, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_27 = PyTuple_New(2); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1397, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_27);
      __Pyx_GIVEREF(__pyx_t_19);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_27, 0, __pyx_t_19) != (0)) __PYX_ERR(0, 1397, __pyx_L3_error);
      __Pyx_GIVEREF(__pyx_t_1);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_27, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 1397, __pyx_L3_error);
      __pyx_t_19 = 0;
      __pyx_t_1 = 0;

      /* "pkcs11/_pkcs11.pyx":1398
 *                 (Attribute.DECRYPT, DecryptMixin),
 *                 (Attribute.SIGN, SignMixin),
 *                 (Attribute.VERIFY, VerifyMixin),             # <<<<<<<<<<<<<<
 *                 (Attribute.WRAP, WrapMixin),
 *                 (Attribute.UNWRAP, UnwrapMixin),
*/
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Attribute); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1398, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_VERIFY); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1398, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_19);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_VerifyMixin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1398, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_28 = PyTuple_New(2); if (unlikely(!__pyx_t_28)) __PYX_ERR(0, 1398, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_28);
      __Pyx_GIVEREF(__pyx_t_19);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_28, 0, __pyx_t_19) != (0)) __PYX_ERR(0, 1398, __pyx_L3_error);
      __Pyx_GIVEREF(__pyx_t_1);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_28, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 1398, __pyx_L3_error);
      __pyx_t_19 = 0;
      __pyx_t_1 = 0;

      /* "pkcs11/_pkcs11.pyx":1399
 *                 (Attribute.SIGN, SignMixin),
 *                 (Attribute.VERIFY, VerifyMixin),
 *                 (Attribute.WRAP, WrapMixin),             # <<<<<<<<<<<<<<
 *                 (Attribute.UNWRAP, UnwrapMixin),
 *                 (Attribute.DERIVE, DeriveMixin),
*/
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Attribute); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1399, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_WRAP); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1399, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_19);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_WrapMixin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1399, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_31 = PyTuple_New(2); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 1399, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_31);
      __Pyx_GIVEREF(__pyx_t_19);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_31, 0, __pyx_t_19) != (0)) __PYX_ERR(0, 1399, __pyx_L3_error);
      __Pyx_GIVEREF(__pyx_t_1);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_31, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 1399, __pyx_L3_error);
      __pyx_t_19 = 0;
      __pyx_t_1 = 0;

      /* "pkcs11/_pkcs11.pyx":1400
 *                 (Attribute.VERIFY, VerifyMixin),
 *                 (Attribute.WRAP, WrapMixin),
 *                 (Attribute.UNWRAP, UnwrapMixin),             # <<<<<<<<<<<<<<
 *                 (Attribute.DERIVE, DeriveMixin),
 *         ):
*/
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Attribute); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1400, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_UNWRAP); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1400, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_19);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_UnwrapMixin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1400, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_30 = PyTuple_New(2); if (unlikely(!__pyx_t_30)) __PYX_ERR(0, 1400, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_30);
      __Pyx_GIVEREF(__pyx_t_19);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_30, 0, __pyx_t_19) != (0)) __PYX_ERR(0, 1400, __pyx_L3_error);
      __Pyx_GIVEREF(__pyx_t_1);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_30, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 1400, __pyx_L3_error);
      __pyx_t_19 = 0;
      __pyx_t_1 = 0;

      /* "pkcs11/_pkcs11.pyx":1401
 *                 (Attribute.WRAP, WrapMixin),
 *                 (Attribute.UNWRAP, UnwrapMixin),
 *                 (Attribute.DERIVE, DeriveMixin),             # <<<<<<<<<<<<<<
 *         ):
 *             try:
*/
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Attribute); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1401, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_DERIVE); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1401, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_19);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_DeriveMixin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1401, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_29 = PyTuple_New(2); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 1401, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_29);
      __Pyx_GIVEREF(__pyx_t_19);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_29, 0, __pyx_t_19) != (0)) __PYX_ERR(0, 1401, __pyx_L3_error);
      __Pyx_GIVEREF(__pyx_t_1);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_29, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 1401, __pyx_L3_error);
      __pyx_t_19 = 0;
      __pyx_t_1 = 0;

      /* "pkcs11/_pkcs11.pyx":1395
 *         # Build a list of mixins for this new class
 *         for attribute, mixin in (
 *                 (Attribute.ENCRYPT, EncryptMixin),             # <<<<<<<<<<<<<<
 *                 (Attribute.DECRYPT, DecryptMixin),
 *                 (Attribute.SIGN, SignMixin),
*/
      __pyx_t_1 = PyTuple_New(7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1395, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_2);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 1395, __pyx_L3_error);
      __Pyx_GIVEREF(__pyx_t_18);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_18) != (0)) __PYX_ERR(0, 1395, __pyx_L3_error);
      __Pyx_GIVEREF(__pyx_t_27);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_27) != (0)) __PYX_ERR(0, 1395, __pyx_L3_error);
      __Pyx_GIVEREF(__pyx_t_28);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_28) != (0)) __PYX_ERR(0, 1395, __pyx_L3_error);
      __Pyx_GIVEREF(__pyx_t_31);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_t_31) != (0)) __PYX_ERR(0, 1395, __pyx_L3_error);
      __Pyx_GIVEREF(__pyx_t_30);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_30) != (0)) __PYX_ERR(0, 1395, __pyx_L3_error);
      __Pyx_GIVEREF(__pyx_t_29);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_t_29) != (0)) __PYX_ERR(0, 1395, __pyx_L3_error);
      __pyx_t_2 = 0;
      __pyx_t_18 = 0;
      __pyx_t_27 = 0;
      __pyx_t_28 = 0;
      __pyx_t_31 = 0;
      __pyx_t_30 = 0;
      __pyx_t_29 = 0;

      /* "pkcs11/_pkcs11.pyx":1394
 * 
 *         # Build a list of mixins for this new class
 *         for attribute, mixin in (             # <<<<<<<<<<<<<<
 *                 (Attribute.ENCRYPT, EncryptMixin),
 *                 (Attribute.DECRYPT, DecryptMixin),
*/
      __pyx_t_29 = __pyx_t_1; __Pyx_INCREF(__pyx_t_29);
      __pyx_t_33 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      for (;;) {
        if (__pyx_t_33 >= 7) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_29, __pyx_t_33));
        #else
        __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_29, __pyx_t_33);
        #endif
        ++__pyx_t_33;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1394, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (likely(__pyx_t_1 != Py_None)) {
          PyObject* sequence = __pyx_t_1;
          Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
          if (unlikely(size != 2)) {
            if (size > 2) __Pyx_RaiseTooManyValuesError(2);
            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
            __PYX_ERR(0, 1394, __pyx_L3_error)
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_30 = PyTuple_GET_ITEM(sequence, 0);
          __Pyx_INCREF(__pyx_t_30);
          __pyx_t_31 = PyTuple_GET_ITEM(sequence, 1);
          __Pyx_INCREF(__pyx_t_31);
          #else
          __pyx_t_30 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_30)) __PYX_ERR(0, 1394, __pyx_L3_error)
          __Pyx_GOTREF(__pyx_t_30);
          __pyx_t_31 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 1394, __pyx_L3_error)
          __Pyx_GOTREF(__pyx_t_31);
          #endif
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        } else {
          __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1394, __pyx_L3_error)
        }
        __Pyx_XDECREF_SET(__pyx_v_attribute, __pyx_t_30);
        __pyx_t_30 = 0;
        __Pyx_XDECREF_SET(__pyx_v_mixin, __pyx_t_31);
        __pyx_t_31 = 0;

        /* "pkcs11/_pkcs11.pyx":1403
 *                 (Attribute.DERIVE, DeriveMixin),
 *         ):
 *             try:             # <<<<<<<<<<<<<<
 *                 if attributes.get(attribute, session.attribute_mapper):
 *                     bases += (mixin,)
*/
        {
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __Pyx_ExceptionSave(&__pyx_t_17, &__pyx_t_16, &__pyx_t_15);
          __Pyx_XGOTREF(__pyx_t_17);
          __Pyx_XGOTREF(__pyx_t_16);
          __Pyx_XGOTREF(__pyx_t_15);
          /*try:*/ {

            /* "pkcs11/_pkcs11.pyx":1404
 *         ):
 *             try:
 *                 if attributes.get(attribute, session.attribute_mapper):             # <<<<<<<<<<<<<<
 *                     bases += (mixin,)
 *             except KeyError:
*/
            __pyx_t_31 = __pyx_v_attributes;
            __Pyx_INCREF(__pyx_t_31);
            __pyx_t_32 = 0;
            {
              PyObject *__pyx_callargs[3] = {__pyx_t_31, __pyx_v_attribute, __pyx_v_session->attribute_mapper};
              __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get, __pyx_callargs+__pyx_t_32, (3-__pyx_t_32) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_31); __pyx_t_31 = 0;
              if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1404, __pyx_L31_error)
              __Pyx_GOTREF(__pyx_t_1);
            }
            __pyx_t_34 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_34 < 0))) __PYX_ERR(0, 1404, __pyx_L31_error)
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            if (__pyx_t_34) {

              /* "pkcs11/_pkcs11.pyx":1405
 *             try:
 *                 if attributes.get(attribute, session.attribute_mapper):
 *                     bases += (mixin,)             # <<<<<<<<<<<<<<
 *             except KeyError:
 *                 pass
*/
              __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1405, __pyx_L31_error)
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_INCREF(__pyx_v_mixin);
              __Pyx_GIVEREF(__pyx_v_mixin);
              if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_mixin) != (0)) __PYX_ERR(0, 1405, __pyx_L31_error);
              __pyx_t_31 = PyNumber_InPlaceAdd(__pyx_v_bases, __pyx_t_1); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 1405, __pyx_L31_error)
              __Pyx_GOTREF(__pyx_t_31);
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
              __Pyx_DECREF_SET(__pyx_v_bases, ((PyObject*)__pyx_t_31));
              __pyx_t_31 = 0;

              /* "pkcs11/_pkcs11.pyx":1404
 *         ):
 *             try:
 *                 if attributes.get(attribute, session.attribute_mapper):             # <<<<<<<<<<<<<<
 *                     bases += (mixin,)
 *             except KeyError:
*/
            }

            /* "pkcs11/_pkcs11.pyx":1403
 *                 (Attribute.DERIVE, DeriveMixin),
 *         ):
 *             try:             # <<<<<<<<<<<<<<
 *                 if attributes.get(attribute, session.attribute_mapper):
 *                     bases += (mixin,)
*/
          }
          __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
          __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
          __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
          goto __pyx_L38_try_end;
          __pyx_L31_error:;
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
          __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF(__pyx_t_27); __pyx_t_27 = 0;
          __Pyx_XDECREF(__pyx_t_28); __pyx_t_28 = 0;
          __Pyx_XDECREF(__pyx_t_30); __pyx_t_30 = 0;
          __Pyx_XDECREF(__pyx_t_31); __pyx_t_31 = 0;

          /* "pkcs11/_pkcs11.pyx":1406
 *                 if attributes.get(attribute, session.attribute_mapper):
 *                     bases += (mixin,)
 *             except KeyError:             # <<<<<<<<<<<<<<
 *                 pass
 * 
*/
          __pyx_t_20 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_KeyError))));
          if (__pyx_t_20) {
            __Pyx_ErrRestore(0,0,0);
            goto __pyx_L32_exception_handled;
          }
          goto __pyx_L33_except_error;

          /* "pkcs11/_pkcs11.pyx":1403
 *                 (Attribute.DERIVE, DeriveMixin),
 *         ):
 *             try:             # <<<<<<<<<<<<<<
 *                 if attributes.get(attribute, session.attribute_mapper):
 *                     bases += (mixin,)
*/
          __pyx_L33_except_error:;
          __Pyx_XGIVEREF(__pyx_t_17);
          __Pyx_XGIVEREF(__pyx_t_16);
          __Pyx_XGIVEREF(__pyx_t_15);
          __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_16, __pyx_t_15);
          goto __pyx_L3_error;
          __pyx_L32_exception_handled:;
          __Pyx_XGIVEREF(__pyx_t_17);
          __Pyx_XGIVEREF(__pyx_t_16);
          __Pyx_XGIVEREF(__pyx_t_15);
          __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_16, __pyx_t_15);
          __pyx_L38_try_end:;
        }

        /* "pkcs11/_pkcs11.pyx":1394
 * 
 *         # Build a list of mixins for this new class
 *         for attribute, mixin in (             # <<<<<<<<<<<<<<
 *                 (Attribute.ENCRYPT, EncryptMixin),
 *                 (Attribute.DECRYPT, DecryptMixin),
*/
      }
      __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;

      /* "pkcs11/_pkcs11.pyx":1409
 *                 pass
 * 
 *         bases += (Object,)             # <<<<<<<<<<<<<<
 * 
 *         # Manufacture a class with the right capabilities.
*/
      __Pyx_GetModuleGlobalName(__pyx_t_29, __pyx_mstate_global->__pyx_n_u_Object); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 1409, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_29);
      __pyx_t_31 = PyTuple_New(1); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 1409, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_31);
      __Pyx_GIVEREF(__pyx_t_29);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_31, 0, __pyx_t_29) != (0)) __PYX_ERR(0, 1409, __pyx_L3_error);
      __pyx_t_29 = 0;
      __pyx_t_29 = PyNumber_InPlaceAdd(__pyx_v_bases, __pyx_t_31); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 1409, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_29);
      __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
      __Pyx_DECREF_SET(__pyx_v_bases, ((PyObject*)__pyx_t_29));
      __pyx_t_29 = 0;

      /* "pkcs11/_pkcs11.pyx":1412
 * 
 *         # Manufacture a class with the right capabilities.
 *         klass = type(bases[0].__name__, bases, {})             # <<<<<<<<<<<<<<
 * 
 *         return klass(wrapper)
*/
      __pyx_t_31 = NULL;
      __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_bases, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1412, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_30 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_30)) __PYX_ERR(0, 1412, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_30);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1412, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_32 = 1;
      {
        PyObject *__pyx_callargs[4] = {__pyx_t_31, __pyx_t_30, __pyx_v_bases, __pyx_t_1};
        __pyx_t_29 = __Pyx_PyObject_FastCall((PyObject*)(&PyType_Type), __pyx_callargs+__pyx_t_32, (4-__pyx_t_32) | (__pyx_t_32*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_31); __pyx_t_31 = 0;
        __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 1412, __pyx_L3_error)
        __Pyx_GOTREF((PyObject *)__pyx_t_29);
      }
      __pyx_v_klass = ((PyTypeObject*)__pyx_t_29);
      __pyx_t_29 = 0;

      /* "pkcs11/_pkcs11.pyx":1414
 *         klass = type(bases[0].__name__, bases, {})
 * 
 *         return klass(wrapper)             # <<<<<<<<<<<<<<
 * 
 *     except KeyError:
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = NULL;
      __pyx_t_32 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_1, ((PyObject *)__pyx_v_wrapper)};
        __pyx_t_29 = __Pyx_PyObject_FastCall((PyObject*)__pyx_v_klass, __pyx_callargs+__pyx_t_32, (2-__pyx_t_32) | (__pyx_t_32*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 1414, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_29);
      }
      __pyx_r = __pyx_t_29;
      __pyx_t_29 = 0;
      goto __pyx_L7_try_return;

      /* "pkcs11/_pkcs11.pyx":1376
 *     ]
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         # Determine a list of base classes to manufacture our class with
 *         try:
*/
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
    __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_27); __pyx_t_27 = 0;
    __Pyx_XDECREF(__pyx_t_28); __pyx_t_28 = 0;
    __Pyx_XDECREF(__pyx_t_29); __pyx_t_29 = 0;
    __Pyx_XDECREF(__pyx_t_30); __pyx_t_30 = 0;
    __Pyx_XDECREF(__pyx_t_31); __pyx_t_31 = 0;

    /* "pkcs11/_pkcs11.pyx":1416
 *         return klass(wrapper)
 * 
 *     except KeyError:             # <<<<<<<<<<<<<<
 *         return Object(wrapper)
 * 
*/
    __pyx_t_20 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_KeyError))));
    if (__pyx_t_20) {
      __Pyx_AddTraceback("pkcs11._pkcs11.make_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_29, &__pyx_t_1, &__pyx_t_30) < 0) __PYX_ERR(0, 1416, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_29);
      __Pyx_XGOTREF(__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_30);

      /* "pkcs11/_pkcs11.pyx":1417
 * 
 *     except KeyError:
 *         return Object(wrapper)             # <<<<<<<<<<<<<<
 * 
 * 
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_28 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_27, __pyx_mstate_global->__pyx_n_u_Object); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1417, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_27);
      __pyx_t_32 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_27))) {
        __pyx_t_28 = PyMethod_GET_SELF(__pyx_t_27);
        assert(__pyx_t_28);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_27);
        __Pyx_INCREF(__pyx_t_28);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_27, __pyx__function);
        __pyx_t_32 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_28, ((PyObject *)__pyx_v_wrapper)};
        __pyx_t_31 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_27, __pyx_callargs+__pyx_t_32, (2-__pyx_t_32) | (__pyx_t_32*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_28); __pyx_t_28 = 0;
        __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
        if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 1417, __pyx_L5_except_error)
        __Pyx_GOTREF(__pyx_t_31);
      }
      __pyx_r = __pyx_t_31;
      __pyx_t_31 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
      __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;

    /* "pkcs11/_pkcs11.pyx":1376
 *     ]
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         # Determine a list of base classes to manufacture our class with
 *         try:
*/
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_12);
    __Pyx_XGIVEREF(__pyx_t_13);
    __Pyx_XGIVEREF(__pyx_t_14);
    __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
    goto __pyx_L1_error;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_t_12);
    __Pyx_XGIVEREF(__pyx_t_13);
    __Pyx_XGIVEREF(__pyx_t_14);
    __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
    goto __pyx_L0;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_12);
    __Pyx_XGIVEREF(__pyx_t_13);
    __Pyx_XGIVEREF(__pyx_t_14);
    __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
    goto __pyx_L0;
  }

  /* "pkcs11/_pkcs11.pyx":1359
 * 
 * 
 * cdef object make_object(Session session, CK_OBJECT_HANDLE handle) with gil:             # <<<<<<<<<<<<<<
 *     """
 *     Make an object with the right bases for its class and capabilities.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_18);
  __Pyx_XDECREF(__pyx_t_19);
  __Pyx_XDECREF(__pyx_t_27);
  __Pyx_XDECREF(__pyx_t_28);
  __Pyx_XDECREF(__pyx_t_29);
  __Pyx_XDECREF(__pyx_t_30);
  __Pyx_XDECREF(__pyx_t_31);
  __Pyx_AddTraceback("pkcs11._pkcs11.make_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_wrapper);
  __Pyx_XDECREF(__pyx_v_attributes);
  __Pyx_XDECREF(__pyx_v_object_class);
  __Pyx_XDECREF(__pyx_v_bases);
  __Pyx_XDECREF(__pyx_v_attribute);
  __Pyx_XDECREF(__pyx_v_mixin);
  __Pyx_XDECREF((PyObject *)__pyx_v_klass);
  __Pyx_XDECREF((PyObject *)__pyx_v_session);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1433
 * 
 * class GenerateWithParametersMixin(types.DomainParameters):
 *     def generate_keypair(self,             # <<<<<<<<<<<<<<
 *                          id=None, label=None,
 *                          store=False, capabilities=None,
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_27GenerateWithParametersMixin_1generate_keypair(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_27GenerateWithParametersMixin_1generate_keypair = {"generate_keypair", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_27GenerateWithParametersMixin_1generate_keypair, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_27GenerateWithParametersMixin_1generate_keypair(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_id = 0;
  PyObject *__pyx_v_label = 0;
  PyObject *__pyx_v_store = 0;
  PyObject *__pyx_v_capabilities = 0;
  PyObject *__pyx_v_mechanism = 0;
  PyObject *__pyx_v_mechanism_param = 0;
  PyObject *__pyx_v_public_template = 0;
  PyObject *__pyx_v_private_template = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("generate_keypair (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_id,&__pyx_mstate_global->__pyx_n_u_label,&__pyx_mstate_global->__pyx_n_u_store,&__pyx_mstate_global->__pyx_n_u_capabilities,&__pyx_mstate_global->__pyx_n_u_mechanism,&__pyx_mstate_global->__pyx_n_u_mechanism_param,&__pyx_mstate_global->__pyx_n_u_public_template,&__pyx_mstate_global->__pyx_n_u_private_template,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1433, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  9:
        values[8] = __Pyx_ArgRef_FASTCALL(__pyx_args, 8);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[8])) __PYX_ERR(0, 1433, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  8:
        values[7] = __Pyx_ArgRef_FASTCALL(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 1433, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 1433, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 1433, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1433, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1433, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1433, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1433, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1433, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "generate_keypair", 0) < (0)) __PYX_ERR(0, 1433, __pyx_L3_error)

      /* "pkcs11/_pkcs11.pyx":1434
 * class GenerateWithParametersMixin(types.DomainParameters):
 *     def generate_keypair(self,
 *                          id=None, label=None,             # <<<<<<<<<<<<<<
 *                          store=False, capabilities=None,
 *                          mechanism=None, mechanism_param=None,
*/
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":1435
 *     def generate_keypair(self,
 *                          id=None, label=None,
 *                          store=False, capabilities=None,             # <<<<<<<<<<<<<<
 *                          mechanism=None, mechanism_param=None,
 *                          public_template=None, private_template=None):
*/
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_False)));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":1436
 *                          id=None, label=None,
 *                          store=False, capabilities=None,
 *                          mechanism=None, mechanism_param=None,             # <<<<<<<<<<<<<<
 *                          public_template=None, private_template=None):
 * 
*/
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":1437
 *                          store=False, capabilities=None,
 *                          mechanism=None, mechanism_param=None,
 *                          public_template=None, private_template=None):             # <<<<<<<<<<<<<<
 * 
 *         cdef Session session = self.session
*/
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[8]) values[8] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("generate_keypair", 0, 1, 9, i); __PYX_ERR(0, 1433, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  9:
        values[8] = __Pyx_ArgRef_FASTCALL(__pyx_args, 8);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[8])) __PYX_ERR(0, 1433, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  8:
        values[7] = __Pyx_ArgRef_FASTCALL(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 1433, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 1433, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 1433, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1433, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1433, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1433, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1433, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1433, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }

      /* "pkcs11/_pkcs11.pyx":1434
 * class GenerateWithParametersMixin(types.DomainParameters):
 *     def generate_keypair(self,
 *                          id=None, label=None,             # <<<<<<<<<<<<<<
 *                          store=False, capabilities=None,
 *                          mechanism=None, mechanism_param=None,
*/
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_False)));

      /* "pkcs11/_pkcs11.pyx":1435
 *     def generate_keypair(self,
 *                          id=None, label=None,
 *                          store=False, capabilities=None,             # <<<<<<<<<<<<<<
 *                          mechanism=None, mechanism_param=None,
 *                          public_template=None, private_template=None):
*/
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":1436
 *                          id=None, label=None,
 *                          store=False, capabilities=None,
 *                          mechanism=None, mechanism_param=None,             # <<<<<<<<<<<<<<
 *                          public_template=None, private_template=None):
 * 
*/
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":1437
 *                          store=False, capabilities=None,
 *                          mechanism=None, mechanism_param=None,
 *                          public_template=None, private_template=None):             # <<<<<<<<<<<<<<
 * 
 *         cdef Session session = self.session
*/
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[8]) values[8] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_self = values[0];
    __pyx_v_id = values[1];
    __pyx_v_label = values[2];
    __pyx_v_store = values[3];
    __pyx_v_capabilities = values[4];
    __pyx_v_mechanism = values[5];
    __pyx_v_mechanism_param = values[6];
    __pyx_v_public_template = values[7];
    __pyx_v_private_template = values[8];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("generate_keypair", 0, 1, 9, __pyx_nargs); __PYX_ERR(0, 1433, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.GenerateWithParametersMixin.generate_keypair", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_27GenerateWithParametersMixin_generate_keypair(__pyx_self, __pyx_v_self, __pyx_v_id, __pyx_v_label, __pyx_v_store, __pyx_v_capabilities, __pyx_v_mechanism, __pyx_v_mechanism_param, __pyx_v_public_template, __pyx_v_private_template);

  /* "pkcs11/_pkcs11.pyx":1433
 * 
 * class GenerateWithParametersMixin(types.DomainParameters):
 *     def generate_keypair(self,             # <<<<<<<<<<<<<<
 *                          id=None, label=None,
 *                          store=False, capabilities=None,
*/

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_27GenerateWithParametersMixin_generate_keypair(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_id, PyObject *__pyx_v_label, PyObject *__pyx_v_store, PyObject *__pyx_v_capabilities, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param, PyObject *__pyx_v_public_template, PyObject *__pyx_v_private_template) {
  struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session = 0;
  struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_mech = NULL;
  PyObject *__pyx_v_public_template_ = NULL;
  struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_public_attrs = NULL;
  PyObject *__pyx_v_private_template_ = NULL;
  struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_private_attrs = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  size_t __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("generate_keypair", 0);
  __Pyx_INCREF(__pyx_v_capabilities);

  /* "pkcs11/_pkcs11.pyx":1439
 *                          public_template=None, private_template=None):
 * 
 *         cdef Session session = self.session             # <<<<<<<<<<<<<<
 *         if capabilities is None:
 *             try:
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_session); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Session))))) __PYX_ERR(0, 1439, __pyx_L1_error)
  __pyx_v_session = ((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1440
 * 
 *         cdef Session session = self.session
 *         if capabilities is None:             # <<<<<<<<<<<<<<
 *             try:
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[self.key_type]
*/
  __pyx_t_2 = (__pyx_v_capabilities == Py_None);
  if (__pyx_t_2) {

    /* "pkcs11/_pkcs11.pyx":1441
 *         cdef Session session = self.session
 *         if capabilities is None:
 *             try:             # <<<<<<<<<<<<<<
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[self.key_type]
 *             except KeyError:
*/
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":1442
 *         if capabilities is None:
 *             try:
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[self.key_type]             # <<<<<<<<<<<<<<
 *             except KeyError:
 *                 raise ArgumentsBad("No default capabilities for this key "
*/
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_DEFAULT_KEY_CAPABILITIES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1442, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_key_type); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1442, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1442, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF_SET(__pyx_v_capabilities, __pyx_t_7);
        __pyx_t_7 = 0;

        /* "pkcs11/_pkcs11.pyx":1441
 *         cdef Session session = self.session
 *         if capabilities is None:
 *             try:             # <<<<<<<<<<<<<<
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[self.key_type]
 *             except KeyError:
*/
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L9_try_end;
      __pyx_L4_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "pkcs11/_pkcs11.pyx":1443
 *             try:
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[self.key_type]
 *             except KeyError:             # <<<<<<<<<<<<<<
 *                 raise ArgumentsBad("No default capabilities for this key "
 *                                    "type. Please specify `capabilities`.")
*/
      __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_KeyError))));
      if (__pyx_t_8) {
        __Pyx_AddTraceback("pkcs11._pkcs11.GenerateWithParametersMixin.generate_keypair", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_1) < 0) __PYX_ERR(0, 1443, __pyx_L6_except_error)
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_1);

        /* "pkcs11/_pkcs11.pyx":1444
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[self.key_type]
 *             except KeyError:
 *                 raise ArgumentsBad("No default capabilities for this key "             # <<<<<<<<<<<<<<
 *                                    "type. Please specify `capabilities`.")
 * 
*/
        __pyx_t_10 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_ArgumentsBad); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1444, __pyx_L6_except_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_12 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_11))) {
          __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_11);
          assert(__pyx_t_10);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_11);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_11, __pyx__function);
          __pyx_t_12 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_No_default_capabilities_for_this};
          __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1444, __pyx_L6_except_error)
          __Pyx_GOTREF(__pyx_t_9);
        }
        __Pyx_Raise(__pyx_t_9, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __PYX_ERR(0, 1444, __pyx_L6_except_error)
      }
      goto __pyx_L6_except_error;

      /* "pkcs11/_pkcs11.pyx":1441
 *         cdef Session session = self.session
 *         if capabilities is None:
 *             try:             # <<<<<<<<<<<<<<
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[self.key_type]
 *             except KeyError:
*/
      __pyx_L6_except_error:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L1_error;
      __pyx_L9_try_end:;
    }

    /* "pkcs11/_pkcs11.pyx":1440
 * 
 *         cdef Session session = self.session
 *         if capabilities is None:             # <<<<<<<<<<<<<<
 *             try:
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[self.key_type]
*/
  }

  /* "pkcs11/_pkcs11.pyx":1447
 *                                    "type. Please specify `capabilities`.")
 * 
 *         mech = MechanismWithParam(self.key_type, DEFAULT_GENERATE_MECHANISMS, mechanism, mechanism_param)             # <<<<<<<<<<<<<<
 * 
 *         # Build attributes
*/
  __pyx_t_6 = NULL;
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_key_type); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_DEFAULT_GENERATE_MECHANISMS); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_12 = 1;
  {
    PyObject *__pyx_callargs[5] = {__pyx_t_6, __pyx_t_7, __pyx_t_9, __pyx_v_mechanism, __pyx_v_mechanism_param};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_MechanismWithParam, __pyx_callargs+__pyx_t_12, (5-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1447, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_mech = ((struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1450
 * 
 *         # Build attributes
 *         public_template_ = session.attribute_mapper.public_key_template(             # <<<<<<<<<<<<<<
 *             id_=id, label=label, store=store, capabilities=capabilities,
 *         )
*/
  __pyx_t_9 = __pyx_v_session->attribute_mapper;
  __Pyx_INCREF(__pyx_t_9);

  /* "pkcs11/_pkcs11.pyx":1451
 *         # Build attributes
 *         public_template_ = session.attribute_mapper.public_key_template(
 *             id_=id, label=label, store=store, capabilities=capabilities,             # <<<<<<<<<<<<<<
 *         )
 * 
*/
  __pyx_t_12 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 4 : 0)] = {__pyx_t_9, NULL};
    __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1450, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_id_2, __pyx_v_id, __pyx_t_7, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 1450, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_label, __pyx_v_label, __pyx_t_7, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 1450, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_store, __pyx_v_store, __pyx_t_7, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 1450, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_capabilities, __pyx_v_capabilities, __pyx_t_7, __pyx_callargs+1, 3) < (0)) __PYX_ERR(0, 1450, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_public_key_template, __pyx_callargs+__pyx_t_12, (1-__pyx_t_12) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1450, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_public_template_ = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1456
 *         # Copy in our domain parameters.
 *         # Not all parameters are appropriate for all domains.
 *         try:             # <<<<<<<<<<<<<<
 *             public_template_.update(
 *                 self.get_attributes(
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "pkcs11/_pkcs11.pyx":1457
 *         # Not all parameters are appropriate for all domains.
 *         try:
 *             public_template_.update(             # <<<<<<<<<<<<<<
 *                 self.get_attributes(
 *                     (
*/
      __pyx_t_7 = __pyx_v_public_template_;
      __Pyx_INCREF(__pyx_t_7);

      /* "pkcs11/_pkcs11.pyx":1458
 *         try:
 *             public_template_.update(
 *                 self.get_attributes(             # <<<<<<<<<<<<<<
 *                     (
 *                         Attribute.BASE,
*/
      __pyx_t_6 = __pyx_v_self;
      __Pyx_INCREF(__pyx_t_6);

      /* "pkcs11/_pkcs11.pyx":1460
 *                 self.get_attributes(
 *                     (
 *                         Attribute.BASE,             # <<<<<<<<<<<<<<
 *                         Attribute.PRIME,
 *                         Attribute.SUBPRIME,
*/
      __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_Attribute); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1460, __pyx_L12_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_BASE); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1460, __pyx_L12_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

      /* "pkcs11/_pkcs11.pyx":1461
 *                     (
 *                         Attribute.BASE,
 *                         Attribute.PRIME,             # <<<<<<<<<<<<<<
 *                         Attribute.SUBPRIME,
 *                         Attribute.EC_PARAMS,
*/
      __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_Attribute); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1461, __pyx_L12_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_PRIME); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1461, __pyx_L12_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

      /* "pkcs11/_pkcs11.pyx":1462
 *                         Attribute.BASE,
 *                         Attribute.PRIME,
 *                         Attribute.SUBPRIME,             # <<<<<<<<<<<<<<
 *                         Attribute.EC_PARAMS,
 *                     )
*/
      __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_Attribute); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1462, __pyx_L12_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_SUBPRIME); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1462, __pyx_L12_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

      /* "pkcs11/_pkcs11.pyx":1463
 *                         Attribute.PRIME,
 *                         Attribute.SUBPRIME,
 *                         Attribute.EC_PARAMS,             # <<<<<<<<<<<<<<
 *                     )
 *                 )
*/
      __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_Attribute); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1463, __pyx_L12_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_EC_PARAMS); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1463, __pyx_L12_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

      /* "pkcs11/_pkcs11.pyx":1460
 *                 self.get_attributes(
 *                     (
 *                         Attribute.BASE,             # <<<<<<<<<<<<<<
 *                         Attribute.PRIME,
 *                         Attribute.SUBPRIME,
*/
      __pyx_t_11 = PyTuple_New(4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1460, __pyx_L12_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_10);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10) != (0)) __PYX_ERR(0, 1460, __pyx_L12_error);
      __Pyx_GIVEREF(__pyx_t_13);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_13) != (0)) __PYX_ERR(0, 1460, __pyx_L12_error);
      __Pyx_GIVEREF(__pyx_t_14);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_14) != (0)) __PYX_ERR(0, 1460, __pyx_L12_error);
      __Pyx_GIVEREF(__pyx_t_15);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 3, __pyx_t_15) != (0)) __PYX_ERR(0, 1460, __pyx_L12_error);
      __pyx_t_10 = 0;
      __pyx_t_13 = 0;
      __pyx_t_14 = 0;
      __pyx_t_15 = 0;
      __pyx_t_12 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_11};
        __pyx_t_9 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_attributes, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1458, __pyx_L12_error)
        __Pyx_GOTREF(__pyx_t_9);
      }
      __pyx_t_12 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_9};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1457, __pyx_L12_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "pkcs11/_pkcs11.pyx":1456
 *         # Copy in our domain parameters.
 *         # Not all parameters are appropriate for all domains.
 *         try:             # <<<<<<<<<<<<<<
 *             public_template_.update(
 *                 self.get_attributes(
*/
    }
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L17_try_end;
    __pyx_L12_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "pkcs11/_pkcs11.pyx":1467
 *                 )
 *             )
 *         except (AttributeTypeInvalid, FunctionFailed):             # <<<<<<<<<<<<<<
 *             pass
 * 
*/
    __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_9, &__pyx_t_7);
    __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_AttributeTypeInvalid); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1467, __pyx_L14_except_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_FunctionFailed); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1467, __pyx_L14_except_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches2(__pyx_t_1, __pyx_t_11, __pyx_t_6);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_ErrRestore(__pyx_t_1, __pyx_t_9, __pyx_t_7);
    __pyx_t_1 = 0; __pyx_t_9 = 0; __pyx_t_7 = 0;
    if (__pyx_t_8) {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L13_exception_handled;
    }
    goto __pyx_L14_except_error;

    /* "pkcs11/_pkcs11.pyx":1456
 *         # Copy in our domain parameters.
 *         # Not all parameters are appropriate for all domains.
 *         try:             # <<<<<<<<<<<<<<
 *             public_template_.update(
 *                 self.get_attributes(
*/
    __pyx_L14_except_error:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L13_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3);
    __pyx_L17_try_end:;
  }

  /* "pkcs11/_pkcs11.pyx":1470
 *             pass
 * 
 *         public_attrs = session.make_attribute_list(merge_templates(public_template_, public_template))             # <<<<<<<<<<<<<<
 * 
 *         private_template_ = session.attribute_mapper.private_key_template(
*/
  __pyx_t_9 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_merge_templates); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_12 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1);
    assert(__pyx_t_9);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_9);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
    __pyx_t_12 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_9, __pyx_v_public_template_, __pyx_v_public_template};
    __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_12, (3-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1470, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
  }
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_Session *)__pyx_v_session->__pyx_vtab)->make_attribute_list(__pyx_v_session, __pyx_t_7)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_public_attrs = ((struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1472
 *         public_attrs = session.make_attribute_list(merge_templates(public_template_, public_template))
 * 
 *         private_template_ = session.attribute_mapper.private_key_template(             # <<<<<<<<<<<<<<
 *             id_=id, label=label, store=store, capabilities=capabilities,
 *         )
*/
  __pyx_t_7 = __pyx_v_session->attribute_mapper;
  __Pyx_INCREF(__pyx_t_7);

  /* "pkcs11/_pkcs11.pyx":1473
 * 
 *         private_template_ = session.attribute_mapper.private_key_template(
 *             id_=id, label=label, store=store, capabilities=capabilities,             # <<<<<<<<<<<<<<
 *         )
 *         private_attrs = session.make_attribute_list(merge_templates(private_template_, private_template))
*/
  __pyx_t_12 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 4 : 0)] = {__pyx_t_7, NULL};
    __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1472, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_id_2, __pyx_v_id, __pyx_t_9, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 1472, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_label, __pyx_v_label, __pyx_t_9, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 1472, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_store, __pyx_v_store, __pyx_t_9, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 1472, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_capabilities, __pyx_v_capabilities, __pyx_t_9, __pyx_callargs+1, 3) < (0)) __PYX_ERR(0, 1472, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_private_key_template, __pyx_callargs+__pyx_t_12, (1-__pyx_t_12) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_9);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1472, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_private_template_ = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1475
 *             id_=id, label=label, store=store, capabilities=capabilities,
 *         )
 *         private_attrs = session.make_attribute_list(merge_templates(private_template_, private_template))             # <<<<<<<<<<<<<<
 * 
 *         return session.generate_keypair_from_attrs(public_attrs, private_attrs, mech)
*/
  __pyx_t_9 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_merge_templates); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1475, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_12 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7);
    assert(__pyx_t_9);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
    __Pyx_INCREF(__pyx_t_9);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
    __pyx_t_12 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_9, __pyx_v_private_template_, __pyx_v_private_template};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_12, (3-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1475, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_7 = ((PyObject *)((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_Session *)__pyx_v_session->__pyx_vtab)->make_attribute_list(__pyx_v_session, __pyx_t_1)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1475, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_private_attrs = ((struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "pkcs11/_pkcs11.pyx":1477
 *         private_attrs = session.make_attribute_list(merge_templates(private_template_, private_template))
 * 
 *         return session.generate_keypair_from_attrs(public_attrs, private_attrs, mech)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_7 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_Session *)__pyx_v_session->__pyx_vtab)->generate_keypair_from_attrs(__pyx_v_session, __pyx_v_public_attrs, __pyx_v_private_attrs, __pyx_v_mech); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":1433
 * 
 * class GenerateWithParametersMixin(types.DomainParameters):
 *     def generate_keypair(self,             # <<<<<<<<<<<<<<
 *                          id=None, label=None,
 *                          store=False, capabilities=None,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("pkcs11._pkcs11.GenerateWithParametersMixin.generate_keypair", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_session);
  __Pyx_XDECREF((PyObject *)__pyx_v_mech);
  __Pyx_XDECREF(__pyx_v_public_template_);
  __Pyx_XDECREF((PyObject *)__pyx_v_public_attrs);
  __Pyx_XDECREF(__pyx_v_private_template_);
  __Pyx_XDECREF((PyObject *)__pyx_v_private_attrs);
  __Pyx_XDECREF(__pyx_v_capabilities);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1494
 *     cdef KeyOperationInit op_init
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef KeyOperation _common_key_setup(
 *             type cls,
*/

static struct __pyx_obj_6pkcs11_7_pkcs11_KeyOperation *__pyx_f_6pkcs11_7_pkcs11_12KeyOperation__common_key_setup(PyTypeObject *__pyx_v_cls, struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_mech, CK_OBJECT_HANDLE __pyx_v_key, CK_ULONG __pyx_v_buffer_size) {
  struct __pyx_obj_6pkcs11_7_pkcs11_KeyOperation *__pyx_v_op = 0;
  struct __pyx_obj_6pkcs11_7_pkcs11_KeyOperation *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_common_key_setup", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_cls);
  __Pyx_INCREF((PyObject *)__pyx_v_session);
  __Pyx_INCREF((PyObject *)__pyx_v_mech);

  /* "pkcs11/_pkcs11.pyx":1503
 *     ) with gil:
 * 
 *         cdef KeyOperation op = <KeyOperation> OperationWithBinaryOutput._setup(             # <<<<<<<<<<<<<<
 *             cls, session, mech, buffer_size
 *         )
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_6pkcs11_7_pkcs11_25OperationWithBinaryOutput__setup(__pyx_v_cls, __pyx_v_session, __pyx_v_mech, __pyx_v_buffer_size)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1503, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_op = ((struct __pyx_obj_6pkcs11_7_pkcs11_KeyOperation *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pkcs11/_pkcs11.pyx":1506
 *             cls, session, mech, buffer_size
 *         )
 *         op.key = key             # <<<<<<<<<<<<<<
 *         return op
 * 
*/
  __pyx_v_op->key = __pyx_v_key;

  /* "pkcs11/_pkcs11.pyx":1507
 *         )
 *         op.key = key
 *         return op             # <<<<<<<<<<<<<<
 * 
 *     def unclean_shutdown(self):
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_op);
  __pyx_r = __pyx_v_op;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":1494
 *     cdef KeyOperationInit op_init
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef KeyOperation _common_key_setup(
 *             type cls,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pkcs11._pkcs11.KeyOperation._common_key_setup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_op);
  __Pyx_XDECREF((PyObject *)__pyx_v_cls);
  __Pyx_XDECREF((PyObject *)__pyx_v_session);
  __Pyx_XDECREF((PyObject *)__pyx_v_mech);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1509
 *         return op
 * 
 *     def unclean_shutdown(self):             # <<<<<<<<<<<<<<
 *         """
 *         Shutdown implementation for 2.x PKCS#11 modules that don't support shutdown signalling
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_12KeyOperation_1unclean_shutdown(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6pkcs11_7_pkcs11_12KeyOperation_unclean_shutdown, "\n        Shutdown implementation for 2.x PKCS#11 modules that don't support shutdown signalling\n        ");
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_12KeyOperation_1unclean_shutdown = {"unclean_shutdown", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_12KeyOperation_1unclean_shutdown, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6pkcs11_7_pkcs11_12KeyOperation_unclean_shutdown};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_12KeyOperation_1unclean_shutdown(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("unclean_shutdown (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("unclean_shutdown", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("unclean_shutdown", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_12KeyOperation_unclean_shutdown(((struct __pyx_obj_6pkcs11_7_pkcs11_KeyOperation *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_12KeyOperation_unclean_shutdown(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_KeyOperation *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("unclean_shutdown", 0);

  /* "pkcs11/_pkcs11.pyx":1513
 *         Shutdown implementation for 2.x PKCS#11 modules that don't support shutdown signalling
 *         """
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def _initiate(self):
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_NotImplementedError))), 0, 0, 0);
  __PYX_ERR(0, 1513, __pyx_L1_error)

  /* "pkcs11/_pkcs11.pyx":1509
 *         return op
 * 
 *     def unclean_shutdown(self):             # <<<<<<<<<<<<<<
 *         """
 *         Shutdown implementation for 2.x PKCS#11 modules that don't support shutdown signalling
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.KeyOperation.unclean_shutdown", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1515
 *         raise NotImplementedError
 * 
 *     def _initiate(self):             # <<<<<<<<<<<<<<
 *         cdef CK_RV retval
 *         with nogil:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_12KeyOperation_3_initiate(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_12KeyOperation_3_initiate = {"_initiate", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_12KeyOperation_3_initiate, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_12KeyOperation_3_initiate(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_initiate (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("_initiate", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("_initiate", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_12KeyOperation_2_initiate(((struct __pyx_obj_6pkcs11_7_pkcs11_KeyOperation *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_12KeyOperation_2_initiate(struct __pyx_obj_6pkcs11_7_pkcs11_KeyOperation *__pyx_v_self) {
  CK_RV __pyx_v_retval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  CK_RV __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_initiate", 0);

  /* "pkcs11/_pkcs11.pyx":1517
 *     def _initiate(self):
 *         cdef CK_RV retval
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.op_init(self.session.handle, self.mech.data, self.key)
 *         self._operation_aware_assert(retval)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":1518
 *         cdef CK_RV retval
 *         with nogil:
 *             retval = self.op_init(self.session.handle, self.mech.data, self.key)             # <<<<<<<<<<<<<<
 *         self._operation_aware_assert(retval)
 * 
*/
        __pyx_t_1 = __pyx_v_self->op_init(__pyx_v_self->__pyx_base.__pyx_base.session->handle, __pyx_v_self->__pyx_base.mech->data, __pyx_v_self->key); if (unlikely(__Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 1518, __pyx_L4_error)
        __pyx_v_retval = __pyx_t_1;
      }

      /* "pkcs11/_pkcs11.pyx":1517
 *     def _initiate(self):
 *         cdef CK_RV retval
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.op_init(self.session.handle, self.mech.data, self.key)
 *         self._operation_aware_assert(retval)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L5;
        }
        __pyx_L4_error: {
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L1_error;
        }
        __pyx_L5:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":1519
 *         with nogil:
 *             retval = self.op_init(self.session.handle, self.mech.data, self.key)
 *         self._operation_aware_assert(retval)             # <<<<<<<<<<<<<<
 * 
 *     def _cancel_operation(self, silent):
*/
  __pyx_t_2 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_KeyOperation *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._operation_aware_assert(((struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *)__pyx_v_self), __pyx_v_retval); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pkcs11/_pkcs11.pyx":1515
 *         raise NotImplementedError
 * 
 *     def _initiate(self):             # <<<<<<<<<<<<<<
 *         cdef CK_RV retval
 *         with nogil:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pkcs11._pkcs11.KeyOperation._initiate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1521
 *         self._operation_aware_assert(retval)
 * 
 *     def _cancel_operation(self, silent):             # <<<<<<<<<<<<<<
 *         cdef CK_RV retval
 *         if self.session.cancel_strategy == CancelStrategy.CANCEL_WITH_INIT:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_12KeyOperation_5_cancel_operation(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_12KeyOperation_5_cancel_operation = {"_cancel_operation", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_12KeyOperation_5_cancel_operation, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_12KeyOperation_5_cancel_operation(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_silent = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_cancel_operation (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_silent,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1521, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1521, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_cancel_operation", 0) < (0)) __PYX_ERR(0, 1521, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_cancel_operation", 1, 1, 1, i); __PYX_ERR(0, 1521, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1521, __pyx_L3_error)
    }
    __pyx_v_silent = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_cancel_operation", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1521, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.KeyOperation._cancel_operation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_12KeyOperation_4_cancel_operation(((struct __pyx_obj_6pkcs11_7_pkcs11_KeyOperation *)__pyx_v_self), __pyx_v_silent);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_12KeyOperation_4_cancel_operation(struct __pyx_obj_6pkcs11_7_pkcs11_KeyOperation *__pyx_v_self, PyObject *__pyx_v_silent) {
  CK_RV __pyx_v_retval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  CK_RV __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  size_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_cancel_operation", 0);

  /* "pkcs11/_pkcs11.pyx":1523
 *     def _cancel_operation(self, silent):
 *         cdef CK_RV retval
 *         if self.session.cancel_strategy == CancelStrategy.CANCEL_WITH_INIT:             # <<<<<<<<<<<<<<
 *             # cancel the operation if still active
 *             # This is a PKCS#11 3.x feature
*/
  __pyx_t_1 = __Pyx_PyLong_From_unsigned_int(__pyx_v_self->__pyx_base.__pyx_base.session->cancel_strategy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_CancelStrategy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_CANCEL_WITH_INIT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1523, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 1523, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_4) {

    /* "pkcs11/_pkcs11.pyx":1526
 *             # cancel the operation if still active
 *             # This is a PKCS#11 3.x feature
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 retval = self.op_init(self.session.handle, NULL, self.key)
 *             if retval == CKR_OPERATION_CANCEL_FAILED and not silent:
*/
    {
        PyThreadState * _save;
        _save = PyEval_SaveThread();
        __Pyx_FastGIL_Remember();
        /*try:*/ {

          /* "pkcs11/_pkcs11.pyx":1527
 *             # This is a PKCS#11 3.x feature
 *             with nogil:
 *                 retval = self.op_init(self.session.handle, NULL, self.key)             # <<<<<<<<<<<<<<
 *             if retval == CKR_OPERATION_CANCEL_FAILED and not silent:
 *                 raise PKCS11Error("Failed to cancel operation")
*/
          __pyx_t_5 = __pyx_v_self->op_init(__pyx_v_self->__pyx_base.__pyx_base.session->handle, NULL, __pyx_v_self->key); if (unlikely(__Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 1527, __pyx_L5_error)
          __pyx_v_retval = __pyx_t_5;
        }

        /* "pkcs11/_pkcs11.pyx":1526
 *             # cancel the operation if still active
 *             # This is a PKCS#11 3.x feature
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 retval = self.op_init(self.session.handle, NULL, self.key)
 *             if retval == CKR_OPERATION_CANCEL_FAILED and not silent:
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_FastGIL_Forget();
            PyEval_RestoreThread(_save);
            goto __pyx_L6;
          }
          __pyx_L5_error: {
            __Pyx_FastGIL_Forget();
            PyEval_RestoreThread(_save);
            goto __pyx_L1_error;
          }
          __pyx_L6:;
        }
    }

    /* "pkcs11/_pkcs11.pyx":1528
 *             with nogil:
 *                 retval = self.op_init(self.session.handle, NULL, self.key)
 *             if retval == CKR_OPERATION_CANCEL_FAILED and not silent:             # <<<<<<<<<<<<<<
 *                 raise PKCS11Error("Failed to cancel operation")
 *         else:
*/
    __pyx_t_6 = (__pyx_v_retval == CKR_OPERATION_CANCEL_FAILED);
    if (__pyx_t_6) {
    } else {
      __pyx_t_4 = __pyx_t_6;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_silent); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1528, __pyx_L1_error)
    __pyx_t_7 = (!__pyx_t_6);
    __pyx_t_4 = __pyx_t_7;
    __pyx_L8_bool_binop_done:;
    if (unlikely(__pyx_t_4)) {

      /* "pkcs11/_pkcs11.pyx":1529
 *                 retval = self.op_init(self.session.handle, NULL, self.key)
 *             if retval == CKR_OPERATION_CANCEL_FAILED and not silent:
 *                 raise PKCS11Error("Failed to cancel operation")             # <<<<<<<<<<<<<<
 *         else:
 *             # No official cancel protocol in v2.x of the standard
*/
      __pyx_t_3 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_PKCS11Error); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1529, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
        assert(__pyx_t_3);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
        __pyx_t_8 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Failed_to_cancel_operation};
        __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1529, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(0, 1529, __pyx_L1_error)

      /* "pkcs11/_pkcs11.pyx":1528
 *             with nogil:
 *                 retval = self.op_init(self.session.handle, NULL, self.key)
 *             if retval == CKR_OPERATION_CANCEL_FAILED and not silent:             # <<<<<<<<<<<<<<
 *                 raise PKCS11Error("Failed to cancel operation")
 *         else:
*/
    }

    /* "pkcs11/_pkcs11.pyx":1523
 *     def _cancel_operation(self, silent):
 *         cdef CK_RV retval
 *         if self.session.cancel_strategy == CancelStrategy.CANCEL_WITH_INIT:             # <<<<<<<<<<<<<<
 *             # cancel the operation if still active
 *             # This is a PKCS#11 3.x feature
*/
    goto __pyx_L3;
  }

  /* "pkcs11/_pkcs11.pyx":1533
 *             # No official cancel protocol in v2.x of the standard
 *             # Try the poor man's way by making a hail-mary call to C_XYZFinish() and ignoring the response
 *             self.unclean_shutdown()             # <<<<<<<<<<<<<<
 * 
 *     def _finalize(self, silent=False):
*/
  /*else*/ {
    __pyx_t_1 = ((PyObject *)__pyx_v_self);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_8 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_unclean_shutdown, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1533, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "pkcs11/_pkcs11.pyx":1521
 *         self._operation_aware_assert(retval)
 * 
 *     def _cancel_operation(self, silent):             # <<<<<<<<<<<<<<
 *         cdef CK_RV retval
 *         if self.session.cancel_strategy == CancelStrategy.CANCEL_WITH_INIT:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pkcs11._pkcs11.KeyOperation._cancel_operation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1535
 *             self.unclean_shutdown()
 * 
 *     def _finalize(self, silent=False):             # <<<<<<<<<<<<<<
 *         if self.active:
 *             self._cancel_operation(silent)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_12KeyOperation_7_finalize(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_12KeyOperation_7_finalize = {"_finalize", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_12KeyOperation_7_finalize, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_12KeyOperation_7_finalize(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_silent = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_finalize (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_silent,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1535, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1535, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_finalize", 0) < (0)) __PYX_ERR(0, 1535, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_False));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1535, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_False));
    }
    __pyx_v_silent = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_finalize", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 1535, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.KeyOperation._finalize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_12KeyOperation_6_finalize(((struct __pyx_obj_6pkcs11_7_pkcs11_KeyOperation *)__pyx_v_self), __pyx_v_silent);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_12KeyOperation_6_finalize(struct __pyx_obj_6pkcs11_7_pkcs11_KeyOperation *__pyx_v_self, PyObject *__pyx_v_silent) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_finalize", 0);

  /* "pkcs11/_pkcs11.pyx":1536
 * 
 *     def _finalize(self, silent=False):
 *         if self.active:             # <<<<<<<<<<<<<<
 *             self._cancel_operation(silent)
 *         super()._finalize(silent=silent)
*/
  if (__pyx_v_self->__pyx_base.__pyx_base.active) {

    /* "pkcs11/_pkcs11.pyx":1537
 *     def _finalize(self, silent=False):
 *         if self.active:
 *             self._cancel_operation(silent)             # <<<<<<<<<<<<<<
 *         super()._finalize(silent=silent)
 * 
*/
    __pyx_t_2 = ((PyObject *)__pyx_v_self);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_silent};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_cancel_operation, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1537, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pyx":1536
 * 
 *     def _finalize(self, silent=False):
 *         if self.active:             # <<<<<<<<<<<<<<
 *             self._cancel_operation(silent)
 *         super()._finalize(silent=silent)
*/
  }

  /* "pkcs11/_pkcs11.pyx":1538
 *         if self.active:
 *             self._cancel_operation(silent)
 *         super()._finalize(silent=silent)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_5 = NULL;
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_5, ((PyObject *)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_KeyOperation), ((PyObject *)__pyx_v_self)};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_super, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1538, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_2 = __pyx_t_4;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, NULL};
    __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1538, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_silent, __pyx_v_silent, __pyx_t_5, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 1538, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_finalize, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1538, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1535
 *             self.unclean_shutdown()
 * 
 *     def _finalize(self, silent=False):             # <<<<<<<<<<<<<<
 *         if self.active:
 *             self._cancel_operation(silent)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pkcs11._pkcs11.KeyOperation._finalize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_12KeyOperation_9__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_12KeyOperation_9__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_12KeyOperation_9__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_12KeyOperation_9__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_12KeyOperation_8__reduce_cython__(((struct __pyx_obj_6pkcs11_7_pkcs11_KeyOperation *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_12KeyOperation_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_KeyOperation *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 2, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.KeyOperation.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_12KeyOperation_11__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_12KeyOperation_11__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_12KeyOperation_11__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_12KeyOperation_11__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.KeyOperation.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_12KeyOperation_10__setstate_cython__(((struct __pyx_obj_6pkcs11_7_pkcs11_KeyOperation *)__pyx_v_self), __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_12KeyOperation_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_KeyOperation *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 4, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.KeyOperation.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1547
 *     cdef OperationUpdateWithResult op_full
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef DataCryptOperation setup_encrypt(
 *             Session session,
*/

static struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *__pyx_f_6pkcs11_7_pkcs11_18DataCryptOperation_setup_encrypt(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_mech, CK_OBJECT_HANDLE __pyx_v_key, CK_ULONG __pyx_v_buffer_size) {
  struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *__pyx_v_op = 0;
  struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  CK_RV (*__pyx_t_3)(CK_SESSION_HANDLE, CK_MECHANISM *, CK_OBJECT_HANDLE);
  CK_RV (*__pyx_t_4)(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG, CK_BYTE *, CK_ULONG *);
  CK_RV (*__pyx_t_5)(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG *);
  CK_RV (*__pyx_t_6)(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG, CK_BYTE *, CK_ULONG *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("setup_encrypt", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_session);
  __Pyx_INCREF((PyObject *)__pyx_v_mech);

  /* "pkcs11/_pkcs11.pyx":1554
 *             CK_ULONG buffer_size
 *     ) with gil:
 *         cdef DataCryptOperation op = <DataCryptOperation> KeyOperation._common_key_setup(             # <<<<<<<<<<<<<<
 *             DataCryptOperation, session, mech, key, buffer_size
 *         )
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_6pkcs11_7_pkcs11_12KeyOperation__common_key_setup(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_DataCryptOperation, __pyx_v_session, __pyx_v_mech, __pyx_v_key, __pyx_v_buffer_size)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1554, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_op = ((struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pkcs11/_pkcs11.pyx":1557
 *             DataCryptOperation, session, mech, key, buffer_size
 *         )
 *         op.op_init = session.funclist.C_EncryptInit             # <<<<<<<<<<<<<<
 *         op.op_update = session.funclist.C_EncryptUpdate
 *         op.op_final = session.funclist.C_EncryptFinal
*/
  __pyx_t_3 = __pyx_v_session->__pyx_base.funclist->C_EncryptInit;
  __pyx_v_op->__pyx_base.op_init = __pyx_t_3;

  /* "pkcs11/_pkcs11.pyx":1558
 *         )
 *         op.op_init = session.funclist.C_EncryptInit
 *         op.op_update = session.funclist.C_EncryptUpdate             # <<<<<<<<<<<<<<
 *         op.op_final = session.funclist.C_EncryptFinal
 *         op.op_full = session.funclist.C_Encrypt
*/
  __pyx_t_4 = __pyx_v_session->__pyx_base.funclist->C_EncryptUpdate;
  __pyx_v_op->op_update = __pyx_t_4;

  /* "pkcs11/_pkcs11.pyx":1559
 *         op.op_init = session.funclist.C_EncryptInit
 *         op.op_update = session.funclist.C_EncryptUpdate
 *         op.op_final = session.funclist.C_EncryptFinal             # <<<<<<<<<<<<<<
 *         op.op_full = session.funclist.C_Encrypt
 *         return op
*/
  __pyx_t_5 = __pyx_v_session->__pyx_base.funclist->C_EncryptFinal;
  __pyx_v_op->op_final = __pyx_t_5;

  /* "pkcs11/_pkcs11.pyx":1560
 *         op.op_update = session.funclist.C_EncryptUpdate
 *         op.op_final = session.funclist.C_EncryptFinal
 *         op.op_full = session.funclist.C_Encrypt             # <<<<<<<<<<<<<<
 *         return op
 * 
*/
  __pyx_t_6 = __pyx_v_session->__pyx_base.funclist->C_Encrypt;
  __pyx_v_op->op_full = __pyx_t_6;

  /* "pkcs11/_pkcs11.pyx":1561
 *         op.op_final = session.funclist.C_EncryptFinal
 *         op.op_full = session.funclist.C_Encrypt
 *         return op             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_op);
  __pyx_r = __pyx_v_op;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":1547
 *     cdef OperationUpdateWithResult op_full
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef DataCryptOperation setup_encrypt(
 *             Session session,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pkcs11._pkcs11.DataCryptOperation.setup_encrypt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_op);
  __Pyx_XDECREF((PyObject *)__pyx_v_session);
  __Pyx_XDECREF((PyObject *)__pyx_v_mech);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1563
 *         return op
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef DataCryptOperation setup_decrypt(
 *             Session session,
*/

static struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *__pyx_f_6pkcs11_7_pkcs11_18DataCryptOperation_setup_decrypt(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_mech, CK_OBJECT_HANDLE __pyx_v_key, CK_ULONG __pyx_v_buffer_size) {
  struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *__pyx_v_op = 0;
  struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  CK_RV (*__pyx_t_3)(CK_SESSION_HANDLE, CK_MECHANISM *, CK_OBJECT_HANDLE);
  CK_RV (*__pyx_t_4)(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG, CK_BYTE *, CK_ULONG *);
  CK_RV (*__pyx_t_5)(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG *);
  CK_RV (*__pyx_t_6)(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG, CK_BYTE *, CK_ULONG *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("setup_decrypt", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_session);
  __Pyx_INCREF((PyObject *)__pyx_v_mech);

  /* "pkcs11/_pkcs11.pyx":1570
 *             CK_ULONG buffer_size
 *     ) with gil:
 *         cdef DataCryptOperation op = <DataCryptOperation> KeyOperation._common_key_setup(             # <<<<<<<<<<<<<<
 *             DataCryptOperation, session, mech, key, buffer_size
 *         )
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_6pkcs11_7_pkcs11_12KeyOperation__common_key_setup(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_DataCryptOperation, __pyx_v_session, __pyx_v_mech, __pyx_v_key, __pyx_v_buffer_size)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_op = ((struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pkcs11/_pkcs11.pyx":1573
 *             DataCryptOperation, session, mech, key, buffer_size
 *         )
 *         op.op_init = session.funclist.C_DecryptInit             # <<<<<<<<<<<<<<
 *         op.op_update = session.funclist.C_DecryptUpdate
 *         op.op_final = session.funclist.C_DecryptFinal
*/
  __pyx_t_3 = __pyx_v_session->__pyx_base.funclist->C_DecryptInit;
  __pyx_v_op->__pyx_base.op_init = __pyx_t_3;

  /* "pkcs11/_pkcs11.pyx":1574
 *         )
 *         op.op_init = session.funclist.C_DecryptInit
 *         op.op_update = session.funclist.C_DecryptUpdate             # <<<<<<<<<<<<<<
 *         op.op_final = session.funclist.C_DecryptFinal
 *         op.op_full = session.funclist.C_Decrypt
*/
  __pyx_t_4 = __pyx_v_session->__pyx_base.funclist->C_DecryptUpdate;
  __pyx_v_op->op_update = __pyx_t_4;

  /* "pkcs11/_pkcs11.pyx":1575
 *         op.op_init = session.funclist.C_DecryptInit
 *         op.op_update = session.funclist.C_DecryptUpdate
 *         op.op_final = session.funclist.C_DecryptFinal             # <<<<<<<<<<<<<<
 *         op.op_full = session.funclist.C_Decrypt
 *         return op
*/
  __pyx_t_5 = __pyx_v_session->__pyx_base.funclist->C_DecryptFinal;
  __pyx_v_op->op_final = __pyx_t_5;

  /* "pkcs11/_pkcs11.pyx":1576
 *         op.op_update = session.funclist.C_DecryptUpdate
 *         op.op_final = session.funclist.C_DecryptFinal
 *         op.op_full = session.funclist.C_Decrypt             # <<<<<<<<<<<<<<
 *         return op
 * 
*/
  __pyx_t_6 = __pyx_v_session->__pyx_base.funclist->C_Decrypt;
  __pyx_v_op->op_full = __pyx_t_6;

  /* "pkcs11/_pkcs11.pyx":1577
 *         op.op_final = session.funclist.C_DecryptFinal
 *         op.op_full = session.funclist.C_Decrypt
 *         return op             # <<<<<<<<<<<<<<
 * 
 *     cdef bytes crypt_process_fully(self, CK_BYTE *data, CK_ULONG data_len) with gil:
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_op);
  __pyx_r = __pyx_v_op;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":1563
 *         return op
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef DataCryptOperation setup_decrypt(
 *             Session session,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pkcs11._pkcs11.DataCryptOperation.setup_decrypt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_op);
  __Pyx_XDECREF((PyObject *)__pyx_v_session);
  __Pyx_XDECREF((PyObject *)__pyx_v_mech);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1579
 *         return op
 * 
 *     cdef bytes crypt_process_fully(self, CK_BYTE *data, CK_ULONG data_len) with gil:             # <<<<<<<<<<<<<<
 *         return self.process_fully(self.op_full, data, data_len)
 * 
*/

static PyObject *__pyx_f_6pkcs11_7_pkcs11_18DataCryptOperation_crypt_process_fully(struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *__pyx_v_self, CK_BYTE *__pyx_v_data, CK_ULONG __pyx_v_data_len) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("crypt_process_fully", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_self);

  /* "pkcs11/_pkcs11.pyx":1580
 * 
 *     cdef bytes crypt_process_fully(self, CK_BYTE *data, CK_ULONG data_len) with gil:
 *         return self.process_fully(self.op_full, data, data_len)             # <<<<<<<<<<<<<<
 * 
 *     cdef bytes finish(self) with gil:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DataCryptOperation *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.process_fully(((struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *)__pyx_v_self), __pyx_v_self->op_full, __pyx_v_data, __pyx_v_data_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1580, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":1579
 *         return op
 * 
 *     cdef bytes crypt_process_fully(self, CK_BYTE *data, CK_ULONG data_len) with gil:             # <<<<<<<<<<<<<<
 *         return self.process_fully(self.op_full, data, data_len)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pkcs11._pkcs11.DataCryptOperation.crypt_process_fully", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1582
 *         return self.process_fully(self.op_full, data, data_len)
 * 
 *     cdef bytes finish(self) with gil:             # <<<<<<<<<<<<<<
 *         return self.finish_with_output(self.op_final)
 * 
*/

static PyObject *__pyx_f_6pkcs11_7_pkcs11_18DataCryptOperation_finish(struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("finish", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_self);

  /* "pkcs11/_pkcs11.pyx":1583
 * 
 *     cdef bytes finish(self) with gil:
 *         return self.finish_with_output(self.op_final)             # <<<<<<<<<<<<<<
 * 
 *     def unclean_shutdown(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DataCryptOperation *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.finish_with_output(((struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *)__pyx_v_self), __pyx_v_self->op_final); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1583, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":1582
 *         return self.process_fully(self.op_full, data, data_len)
 * 
 *     cdef bytes finish(self) with gil:             # <<<<<<<<<<<<<<
 *         return self.finish_with_output(self.op_final)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pkcs11._pkcs11.DataCryptOperation.finish", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1585
 *         return self.finish_with_output(self.op_final)
 * 
 *     def unclean_shutdown(self):             # <<<<<<<<<<<<<<
 *         self.execute_resizing_output(self.op_final)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_18DataCryptOperation_1unclean_shutdown(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_18DataCryptOperation_1unclean_shutdown = {"unclean_shutdown", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_18DataCryptOperation_1unclean_shutdown, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_18DataCryptOperation_1unclean_shutdown(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("unclean_shutdown (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("unclean_shutdown", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("unclean_shutdown", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_18DataCryptOperation_unclean_shutdown(((struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_18DataCryptOperation_unclean_shutdown(struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("unclean_shutdown", 0);

  /* "pkcs11/_pkcs11.pyx":1586
 * 
 *     def unclean_shutdown(self):
 *         self.execute_resizing_output(self.op_final)             # <<<<<<<<<<<<<<
 * 
 *     def update_chunks(self, chunks):
*/
  ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DataCryptOperation *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.execute_resizing_output(((struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *)__pyx_v_self), __pyx_v_self->op_final); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1586, __pyx_L1_error)

  /* "pkcs11/_pkcs11.pyx":1585
 *         return self.finish_with_output(self.op_final)
 * 
 *     def unclean_shutdown(self):             # <<<<<<<<<<<<<<
 *         self.execute_resizing_output(self.op_final)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.DataCryptOperation.unclean_shutdown", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6pkcs11_7_pkcs11_18DataCryptOperation_4generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pkcs11/_pkcs11.pyx":1588
 *         self.execute_resizing_output(self.op_final)
 * 
 *     def update_chunks(self, chunks):             # <<<<<<<<<<<<<<
 *         cdef CK_BYTE *data_ptr
 *         cdef CK_ULONG data_len
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_18DataCryptOperation_3update_chunks(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_18DataCryptOperation_3update_chunks = {"update_chunks", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_18DataCryptOperation_3update_chunks, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_18DataCryptOperation_3update_chunks(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_chunks = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update_chunks (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_chunks,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1588, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1588, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "update_chunks", 0) < (0)) __PYX_ERR(0, 1588, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("update_chunks", 1, 1, 1, i); __PYX_ERR(0, 1588, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1588, __pyx_L3_error)
    }
    __pyx_v_chunks = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("update_chunks", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1588, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.DataCryptOperation.update_chunks", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_18DataCryptOperation_2update_chunks(((struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *)__pyx_v_self), __pyx_v_chunks);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_18DataCryptOperation_2update_chunks(struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *__pyx_v_self, PyObject *__pyx_v_chunks) {
  struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("update_chunks", 0);
  __pyx_cur_scope = (struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks *)__pyx_tp_new_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1588, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_chunks = __pyx_v_chunks;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_chunks);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_chunks);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6pkcs11_7_pkcs11_18DataCryptOperation_4generator2, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_update_chunks, __pyx_mstate_global->__pyx_n_u_DataCryptOperation_update_chunks, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11); if (unlikely(!gen)) __PYX_ERR(0, 1588, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.DataCryptOperation.update_chunks", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6pkcs11_7_pkcs11_18DataCryptOperation_4generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks *__pyx_cur_scope = ((struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  CK_BYTE *__pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update_chunks", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(0, 1588, __pyx_L1_error)
  }

  /* "pkcs11/_pkcs11.pyx":1592
 *         cdef CK_ULONG data_len
 * 
 *         for chunk in chunks:             # <<<<<<<<<<<<<<
 *             if not chunk:
 *                 continue
*/
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_chunks)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_chunks)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_v_chunks; __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_chunks); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1592, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1592, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1592, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_2;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1592, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
        #endif
        ++__pyx_t_2;
      }
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1592, __pyx_L1_error)
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1592, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_chunk);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_chunk, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;

    /* "pkcs11/_pkcs11.pyx":1593
 * 
 *         for chunk in chunks:
 *             if not chunk:             # <<<<<<<<<<<<<<
 *                 continue
 *             data_ptr = chunk
*/
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_chunk); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1593, __pyx_L1_error)
    __pyx_t_6 = (!__pyx_t_5);
    if (__pyx_t_6) {

      /* "pkcs11/_pkcs11.pyx":1594
 *         for chunk in chunks:
 *             if not chunk:
 *                 continue             # <<<<<<<<<<<<<<
 *             data_ptr = chunk
 *             data_len = <CK_ULONG> len(chunk)
*/
      goto __pyx_L4_continue;

      /* "pkcs11/_pkcs11.pyx":1593
 * 
 *         for chunk in chunks:
 *             if not chunk:             # <<<<<<<<<<<<<<
 *                 continue
 *             data_ptr = chunk
*/
    }

    /* "pkcs11/_pkcs11.pyx":1595
 *             if not chunk:
 *                 continue
 *             data_ptr = chunk             # <<<<<<<<<<<<<<
 *             data_len = <CK_ULONG> len(chunk)
 *             yield self.update_with_result(self.op_update, data_ptr, data_len)
*/
    __pyx_t_7 = __Pyx_PyObject_AsWritableUString(__pyx_cur_scope->__pyx_v_chunk); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 1595, __pyx_L1_error)
    __pyx_cur_scope->__pyx_v_data_ptr = __pyx_t_7;

    /* "pkcs11/_pkcs11.pyx":1596
 *                 continue
 *             data_ptr = chunk
 *             data_len = <CK_ULONG> len(chunk)             # <<<<<<<<<<<<<<
 *             yield self.update_with_result(self.op_update, data_ptr, data_len)
 * 
*/
    __pyx_t_8 = PyObject_Length(__pyx_cur_scope->__pyx_v_chunk); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1596, __pyx_L1_error)
    __pyx_cur_scope->__pyx_v_data_len = ((CK_ULONG)__pyx_t_8);

    /* "pkcs11/_pkcs11.pyx":1597
 *             data_ptr = chunk
 *             data_len = <CK_ULONG> len(chunk)
 *             yield self.update_with_result(self.op_update, data_ptr, data_len)             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_t_4 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DataCryptOperation *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.update_with_result(((struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_self->op_update, __pyx_cur_scope->__pyx_v_data_ptr, __pyx_cur_scope->__pyx_v_data_len); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1597, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_t_1);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L7_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_1);
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1597, __pyx_L1_error)

    /* "pkcs11/_pkcs11.pyx":1592
 *         cdef CK_ULONG data_len
 * 
 *         for chunk in chunks:             # <<<<<<<<<<<<<<
 *             if not chunk:
 *                 continue
*/
    __pyx_L4_continue:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "pkcs11/_pkcs11.pyx":1588
 *         self.execute_resizing_output(self.op_final)
 * 
 *     def update_chunks(self, chunks):             # <<<<<<<<<<<<<<
 *         cdef CK_BYTE *data_ptr
 *         cdef CK_ULONG data_len
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("update_chunks", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_18DataCryptOperation_6__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_18DataCryptOperation_6__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_18DataCryptOperation_6__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_18DataCryptOperation_6__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_18DataCryptOperation_5__reduce_cython__(((struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_18DataCryptOperation_5__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 2, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.DataCryptOperation.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_18DataCryptOperation_8__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_18DataCryptOperation_8__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_18DataCryptOperation_8__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_18DataCryptOperation_8__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.DataCryptOperation.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_18DataCryptOperation_7__setstate_cython__(((struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *)__pyx_v_self), __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_18DataCryptOperation_7__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 4, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.DataCryptOperation.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1603
 *     """Expand EncryptMixin with an implementation."""
 * 
 *     def __encrypt_operation(self, mechanism, mechanism_param, buffer_size):             # <<<<<<<<<<<<<<
 * 
 *         mech = MechanismWithParam(self.key_type, DEFAULT_ENCRYPT_MECHANISMS, mechanism, mechanism_param)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_12EncryptMixin_1__encrypt_operation(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_12EncryptMixin_1__encrypt_operation = {"__encrypt_operation", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_12EncryptMixin_1__encrypt_operation, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_12EncryptMixin_1__encrypt_operation(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_mechanism = 0;
  PyObject *__pyx_v_mechanism_param = 0;
  PyObject *__pyx_v_buffer_size = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__encrypt_operation (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_mechanism,&__pyx_mstate_global->__pyx_n_u_mechanism_param,&__pyx_mstate_global->__pyx_n_u_buffer_size,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1603, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1603, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1603, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1603, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1603, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__encrypt_operation", 0) < (0)) __PYX_ERR(0, 1603, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__encrypt_operation", 1, 4, 4, i); __PYX_ERR(0, 1603, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 4)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1603, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1603, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1603, __pyx_L3_error)
      values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1603, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_mechanism = values[1];
    __pyx_v_mechanism_param = values[2];
    __pyx_v_buffer_size = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__encrypt_operation", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 1603, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.EncryptMixin.__encrypt_operation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_12EncryptMixin___encrypt_operation(__pyx_self, __pyx_v_self, __pyx_v_mechanism, __pyx_v_mechanism_param, __pyx_v_buffer_size);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_12EncryptMixin___encrypt_operation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param, PyObject *__pyx_v_buffer_size) {
  struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_mech = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  CK_OBJECT_HANDLE __pyx_t_6;
  CK_ULONG __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__encrypt_operation", 0);

  /* "pkcs11/_pkcs11.pyx":1605
 *     def __encrypt_operation(self, mechanism, mechanism_param, buffer_size):
 * 
 *         mech = MechanismWithParam(self.key_type, DEFAULT_ENCRYPT_MECHANISMS, mechanism, mechanism_param)             # <<<<<<<<<<<<<<
 * 
 *         return DataCryptOperation.setup_encrypt(self.session, mech, self.handle, buffer_size)
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_key_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1605, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_DEFAULT_ENCRYPT_MECHANISMS); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1605, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[5] = {__pyx_t_2, __pyx_t_3, __pyx_t_4, __pyx_v_mechanism, __pyx_v_mechanism_param};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_MechanismWithParam, __pyx_callargs+__pyx_t_5, (5-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1605, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_mech = ((struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1607
 *         mech = MechanismWithParam(self.key_type, DEFAULT_ENCRYPT_MECHANISMS, mechanism, mechanism_param)
 * 
 *         return DataCryptOperation.setup_encrypt(self.session, mech, self.handle, buffer_size)             # <<<<<<<<<<<<<<
 * 
 *     def _encrypt(self, data, mechanism=None, mechanism_param=None, buffer_size=8192):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_session); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Session))))) __PYX_ERR(0, 1607, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_handle); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyLong_As_CK_ULONG(__pyx_t_4); if (unlikely((__pyx_t_6 == ((CK_OBJECT_HANDLE)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1607, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_7 = __Pyx_PyLong_As_CK_ULONG(__pyx_v_buffer_size); if (unlikely((__pyx_t_7 == ((CK_ULONG)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1607, __pyx_L1_error)
  __pyx_t_4 = ((PyObject *)__pyx_f_6pkcs11_7_pkcs11_18DataCryptOperation_setup_encrypt(((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_t_1), __pyx_v_mech, __pyx_t_6, __pyx_t_7)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":1603
 *     """Expand EncryptMixin with an implementation."""
 * 
 *     def __encrypt_operation(self, mechanism, mechanism_param, buffer_size):             # <<<<<<<<<<<<<<
 * 
 *         mech = MechanismWithParam(self.key_type, DEFAULT_ENCRYPT_MECHANISMS, mechanism, mechanism_param)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pkcs11._pkcs11.EncryptMixin.__encrypt_operation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mech);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1609
 *         return DataCryptOperation.setup_encrypt(self.session, mech, self.handle, buffer_size)
 * 
 *     def _encrypt(self, data, mechanism=None, mechanism_param=None, buffer_size=8192):             # <<<<<<<<<<<<<<
 *         """
 *         Non chunking encrypt. Needed for some mechanisms.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_12EncryptMixin_3_encrypt(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6pkcs11_7_pkcs11_12EncryptMixin_2_encrypt, "\n        Non chunking encrypt. Needed for some mechanisms.\n        ");
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_12EncryptMixin_3_encrypt = {"_encrypt", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_12EncryptMixin_3_encrypt, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6pkcs11_7_pkcs11_12EncryptMixin_2_encrypt};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_12EncryptMixin_3_encrypt(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_data = 0;
  PyObject *__pyx_v_mechanism = 0;
  PyObject *__pyx_v_mechanism_param = 0;
  PyObject *__pyx_v_buffer_size = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_encrypt (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_data,&__pyx_mstate_global->__pyx_n_u_mechanism,&__pyx_mstate_global->__pyx_n_u_mechanism_param,&__pyx_mstate_global->__pyx_n_u_buffer_size,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1609, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1609, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1609, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1609, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1609, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1609, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_encrypt", 0) < (0)) __PYX_ERR(0, 1609, __pyx_L3_error)
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_8192)));
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_encrypt", 0, 2, 5, i); __PYX_ERR(0, 1609, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1609, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1609, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1609, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1609, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1609, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_8192)));
    }
    __pyx_v_self = values[0];
    __pyx_v_data = values[1];
    __pyx_v_mechanism = values[2];
    __pyx_v_mechanism_param = values[3];
    __pyx_v_buffer_size = values[4];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_encrypt", 0, 2, 5, __pyx_nargs); __PYX_ERR(0, 1609, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.EncryptMixin._encrypt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_12EncryptMixin_2_encrypt(__pyx_self, __pyx_v_self, __pyx_v_data, __pyx_v_mechanism, __pyx_v_mechanism_param, __pyx_v_buffer_size);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_12EncryptMixin_2_encrypt(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param, PyObject *__pyx_v_buffer_size) {
  CYTHON_UNUSED CK_BYTE *__pyx_v_data_ptr;
  CK_ULONG __pyx_v_data_len;
  struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *__pyx_v_op = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  CK_BYTE *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_encrypt", 0);

  /* "pkcs11/_pkcs11.pyx":1613
 *         Non chunking encrypt. Needed for some mechanisms.
 *         """
 *         cdef CK_BYTE *data_ptr = data             # <<<<<<<<<<<<<<
 *         cdef CK_ULONG data_len = <CK_ULONG> len(data)
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_AsWritableUString(__pyx_v_data); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 1613, __pyx_L1_error)
  __pyx_v_data_ptr = __pyx_t_1;

  /* "pkcs11/_pkcs11.pyx":1614
 *         """
 *         cdef CK_BYTE *data_ptr = data
 *         cdef CK_ULONG data_len = <CK_ULONG> len(data)             # <<<<<<<<<<<<<<
 * 
 *         cdef DataCryptOperation op = self.__encrypt_operation(mechanism, mechanism_param, buffer_size)
*/
  __pyx_t_2 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1614, __pyx_L1_error)
  __pyx_v_data_len = ((CK_ULONG)__pyx_t_2);

  /* "pkcs11/_pkcs11.pyx":1616
 *         cdef CK_ULONG data_len = <CK_ULONG> len(data)
 * 
 *         cdef DataCryptOperation op = self.__encrypt_operation(mechanism, mechanism_param, buffer_size)             # <<<<<<<<<<<<<<
 *         with op:
 *             return op.crypt_process_fully(data, data_len)
*/
  __pyx_t_4 = __pyx_v_self;
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_4, __pyx_v_mechanism, __pyx_v_mechanism_param, __pyx_v_buffer_size};
    __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_EncryptMixin__encrypt_operation, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1616, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_DataCryptOperation))))) __PYX_ERR(0, 1616, __pyx_L1_error)
  __pyx_v_op = ((struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pkcs11/_pkcs11.pyx":1617
 * 
 *         cdef DataCryptOperation op = self.__encrypt_operation(mechanism, mechanism_param, buffer_size)
 *         with op:             # <<<<<<<<<<<<<<
 *             return op.crypt_process_fully(data, data_len)
 * 
*/
  /*with:*/ {
    __pyx_t_6 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_op), __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1617, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = NULL;
    __pyx_t_7 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_op), __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1617, __pyx_L3_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1617, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    /*try:*/ {
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_10);
        /*try:*/ {

          /* "pkcs11/_pkcs11.pyx":1618
 *         cdef DataCryptOperation op = self.__encrypt_operation(mechanism, mechanism_param, buffer_size)
 *         with op:
 *             return op.crypt_process_fully(data, data_len)             # <<<<<<<<<<<<<<
 * 
 * 
*/
          __Pyx_XDECREF(__pyx_r);
          __pyx_t_1 = __Pyx_PyObject_AsWritableUString(__pyx_v_data); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 1618, __pyx_L7_error)
          __pyx_t_3 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DataCryptOperation *)__pyx_v_op->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->crypt_process_fully(__pyx_v_op, __pyx_t_1, __pyx_v_data_len); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1618, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_r = __pyx_t_3;
          __pyx_t_3 = 0;
          goto __pyx_L11_try_return;

          /* "pkcs11/_pkcs11.pyx":1617
 * 
 *         cdef DataCryptOperation op = self.__encrypt_operation(mechanism, mechanism_param, buffer_size)
 *         with op:             # <<<<<<<<<<<<<<
 *             return op.crypt_process_fully(data, data_len)
 * 
*/
        }
        __pyx_L7_error:;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        /*except:*/ {
          __Pyx_AddTraceback("pkcs11._pkcs11.EncryptMixin._encrypt", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_7, &__pyx_t_4) < 0) __PYX_ERR(0, 1617, __pyx_L9_except_error)
          __Pyx_XGOTREF(__pyx_t_3);
          __Pyx_XGOTREF(__pyx_t_7);
          __Pyx_XGOTREF(__pyx_t_4);
          __pyx_t_11 = PyTuple_Pack(3, __pyx_t_3, __pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1617, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_11, NULL);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1617, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          if (__pyx_t_13 < (0)) __PYX_ERR(0, 1617, __pyx_L9_except_error)
          __pyx_t_14 = (!__pyx_t_13);
          if (unlikely(__pyx_t_14)) {
            __Pyx_GIVEREF(__pyx_t_3);
            __Pyx_GIVEREF(__pyx_t_7);
            __Pyx_XGIVEREF(__pyx_t_4);
            __Pyx_ErrRestoreWithState(__pyx_t_3, __pyx_t_7, __pyx_t_4);
            __pyx_t_3 = 0;  __pyx_t_7 = 0;  __pyx_t_4 = 0; 
            __PYX_ERR(0, 1617, __pyx_L9_except_error)
          }
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          goto __pyx_L8_exception_handled;
        }
        __pyx_L9_except_error:;
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        goto __pyx_L1_error;
        __pyx_L11_try_return:;
        __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_L4_return;
        __pyx_L8_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);
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_6) {
          __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_mstate_global->__pyx_tuple[2], NULL);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1617, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        }
        goto __pyx_L6;
      }
      __pyx_L4_return: {
        __pyx_t_10 = __pyx_r;
        __pyx_r = 0;
        if (__pyx_t_6) {
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_mstate_global->__pyx_tuple[2], NULL);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1617, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        }
        __pyx_r = __pyx_t_10;
        __pyx_t_10 = 0;
        goto __pyx_L0;
      }
      __pyx_L6:;
    }
    goto __pyx_L16;
    __pyx_L3_error:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L1_error;
    __pyx_L16:;
  }

  /* "pkcs11/_pkcs11.pyx":1609
 *         return DataCryptOperation.setup_encrypt(self.session, mech, self.handle, buffer_size)
 * 
 *     def _encrypt(self, data, mechanism=None, mechanism_param=None, buffer_size=8192):             # <<<<<<<<<<<<<<
 *         """
 *         Non chunking encrypt. Needed for some mechanisms.
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("pkcs11._pkcs11.EncryptMixin._encrypt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_op);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6pkcs11_7_pkcs11_12EncryptMixin_6generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pkcs11/_pkcs11.pyx":1621
 * 
 * 
 *     def _encrypt_generator(self, data,             # <<<<<<<<<<<<<<
 *                            mechanism=None, mechanism_param=None,
 *                            buffer_size=8192):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_12EncryptMixin_5_encrypt_generator(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6pkcs11_7_pkcs11_12EncryptMixin_4_encrypt_generator, "\n        Do chunked encryption.\n        ");
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_12EncryptMixin_5_encrypt_generator = {"_encrypt_generator", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_12EncryptMixin_5_encrypt_generator, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6pkcs11_7_pkcs11_12EncryptMixin_4_encrypt_generator};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_12EncryptMixin_5_encrypt_generator(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_data = 0;
  PyObject *__pyx_v_mechanism = 0;
  PyObject *__pyx_v_mechanism_param = 0;
  PyObject *__pyx_v_buffer_size = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_encrypt_generator (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_data,&__pyx_mstate_global->__pyx_n_u_mechanism,&__pyx_mstate_global->__pyx_n_u_mechanism_param,&__pyx_mstate_global->__pyx_n_u_buffer_size,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1621, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1621, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1621, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1621, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1621, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1621, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_encrypt_generator", 0) < (0)) __PYX_ERR(0, 1621, __pyx_L3_error)

      /* "pkcs11/_pkcs11.pyx":1622
 * 
 *     def _encrypt_generator(self, data,
 *                            mechanism=None, mechanism_param=None,             # <<<<<<<<<<<<<<
 *                            buffer_size=8192):
 *         """
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_8192)));
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_encrypt_generator", 0, 2, 5, i); __PYX_ERR(0, 1621, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1621, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1621, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1621, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1621, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1621, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_8192)));
    }
    __pyx_v_self = values[0];
    __pyx_v_data = values[1];
    __pyx_v_mechanism = values[2];
    __pyx_v_mechanism_param = values[3];
    __pyx_v_buffer_size = values[4];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_encrypt_generator", 0, 2, 5, __pyx_nargs); __PYX_ERR(0, 1621, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.EncryptMixin._encrypt_generator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_12EncryptMixin_4_encrypt_generator(__pyx_self, __pyx_v_self, __pyx_v_data, __pyx_v_mechanism, __pyx_v_mechanism_param, __pyx_v_buffer_size);

  /* "pkcs11/_pkcs11.pyx":1621
 * 
 * 
 *     def _encrypt_generator(self, data,             # <<<<<<<<<<<<<<
 *                            mechanism=None, mechanism_param=None,
 *                            buffer_size=8192):
*/

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_12EncryptMixin_4_encrypt_generator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param, PyObject *__pyx_v_buffer_size) {
  struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_encrypt_generator", 0);
  __pyx_cur_scope = (struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator *)__pyx_tp_new_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1621, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_data = __pyx_v_data;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_data);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_data);
  __pyx_cur_scope->__pyx_v_mechanism = __pyx_v_mechanism;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_mechanism);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_mechanism);
  __pyx_cur_scope->__pyx_v_mechanism_param = __pyx_v_mechanism_param;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_mechanism_param);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_mechanism_param);
  __pyx_cur_scope->__pyx_v_buffer_size = __pyx_v_buffer_size;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_buffer_size);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_buffer_size);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6pkcs11_7_pkcs11_12EncryptMixin_6generator3, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_encrypt_generator, __pyx_mstate_global->__pyx_n_u_EncryptMixin__encrypt_generator, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11); if (unlikely(!gen)) __PYX_ERR(0, 1621, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.EncryptMixin._encrypt_generator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6pkcs11_7_pkcs11_12EncryptMixin_6generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator *__pyx_cur_scope = ((struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_PySendResult __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_encrypt_generator", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L14_resume_from_yield_from;
    case 2: goto __pyx_L15_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(0, 1621, __pyx_L1_error)
  }

  /* "pkcs11/_pkcs11.pyx":1627
 *         Do chunked encryption.
 *         """
 *         cdef DataCryptOperation op = self.__encrypt_operation(mechanism, mechanism_param, buffer_size)             # <<<<<<<<<<<<<<
 *         with op:
 *             yield from op.update_chunks(data)
*/
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_self;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_cur_scope->__pyx_v_mechanism, __pyx_cur_scope->__pyx_v_mechanism_param, __pyx_cur_scope->__pyx_v_buffer_size};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_EncryptMixin__encrypt_operation, __pyx_callargs+__pyx_t_3, (4-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1627, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_DataCryptOperation))))) __PYX_ERR(0, 1627, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_op = ((struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1628
 *         """
 *         cdef DataCryptOperation op = self.__encrypt_operation(mechanism, mechanism_param, buffer_size)
 *         with op:             # <<<<<<<<<<<<<<
 *             yield from op.update_chunks(data)
 *             yield op.finish()
*/
  /*with:*/ {
    __pyx_t_4 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_cur_scope->__pyx_v_op), __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1628, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = NULL;
    __pyx_t_5 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_cur_scope->__pyx_v_op), __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1628, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_3 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1628, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    /*try:*/ {
      {
        __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        /*try:*/ {

          /* "pkcs11/_pkcs11.pyx":1629
 *         cdef DataCryptOperation op = self.__encrypt_operation(mechanism, mechanism_param, buffer_size)
 *         with op:
 *             yield from op.update_chunks(data)             # <<<<<<<<<<<<<<
 *             yield op.finish()
 * 
*/
          __pyx_t_5 = ((PyObject *)__pyx_cur_scope->__pyx_v_op);
          __Pyx_INCREF(__pyx_t_5);
          __pyx_t_3 = 0;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_data};
            __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_update_chunks, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1629, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_1);
          }
          __pyx_t_9 = __Pyx_Generator_Yield_From(__pyx_generator, __pyx_t_1, &__pyx_r);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (likely(__pyx_t_9 == PYGEN_NEXT)) {
            __Pyx_GOTREF(__pyx_r);
            __Pyx_XGIVEREF(__pyx_t_4);
            __pyx_cur_scope->__pyx_t_0 = __pyx_t_4;
            __Pyx_XGIVEREF(__pyx_t_6);
            __pyx_cur_scope->__pyx_t_1 = __pyx_t_6;
            __Pyx_XGIVEREF(__pyx_t_7);
            __pyx_cur_scope->__pyx_t_2 = __pyx_t_7;
            __Pyx_XGIVEREF(__pyx_t_8);
            __pyx_cur_scope->__pyx_t_3 = __pyx_t_8;
            __Pyx_XGIVEREF(__pyx_r);
            __Pyx_RefNannyFinishContext();
            __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
            /* return from generator, yielding value */
            __pyx_generator->resume_label = 1;
            return __pyx_r;
            __pyx_L14_resume_from_yield_from:;
            __pyx_t_4 = __pyx_cur_scope->__pyx_t_0;
            __pyx_cur_scope->__pyx_t_0 = 0;
            __Pyx_XGOTREF(__pyx_t_4);
            __pyx_t_6 = __pyx_cur_scope->__pyx_t_1;
            __pyx_cur_scope->__pyx_t_1 = 0;
            __Pyx_XGOTREF(__pyx_t_6);
            __pyx_t_7 = __pyx_cur_scope->__pyx_t_2;
            __pyx_cur_scope->__pyx_t_2 = 0;
            __Pyx_XGOTREF(__pyx_t_7);
            __pyx_t_8 = __pyx_cur_scope->__pyx_t_3;
            __pyx_cur_scope->__pyx_t_3 = 0;
            __Pyx_XGOTREF(__pyx_t_8);
            if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1629, __pyx_L8_error)
          } else if (likely(__pyx_t_9 == PYGEN_RETURN)) {
            __Pyx_GOTREF(__pyx_r);
            __Pyx_DECREF(__pyx_r); __pyx_r = 0;
          } else {
            __Pyx_XGOTREF(__pyx_r);
            __PYX_ERR(0, 1629, __pyx_L8_error)
          }

          /* "pkcs11/_pkcs11.pyx":1630
 *         with op:
 *             yield from op.update_chunks(data)
 *             yield op.finish()             # <<<<<<<<<<<<<<
 * 
 * 
*/
          __pyx_t_1 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DataCryptOperation *)__pyx_cur_scope->__pyx_v_op->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->finish(__pyx_cur_scope->__pyx_v_op); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1630, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_r = __pyx_t_1;
          __pyx_t_1 = 0;
          __Pyx_XGIVEREF(__pyx_t_4);
          __pyx_cur_scope->__pyx_t_0 = __pyx_t_4;
          __Pyx_XGIVEREF(__pyx_t_6);
          __pyx_cur_scope->__pyx_t_1 = __pyx_t_6;
          __Pyx_XGIVEREF(__pyx_t_7);
          __pyx_cur_scope->__pyx_t_2 = __pyx_t_7;
          __Pyx_XGIVEREF(__pyx_t_8);
          __pyx_cur_scope->__pyx_t_3 = __pyx_t_8;
          __Pyx_XGIVEREF(__pyx_r);
          __Pyx_RefNannyFinishContext();
          __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
          /* return from generator, yielding value */
          __pyx_generator->resume_label = 2;
          return __pyx_r;
          __pyx_L15_resume_from_yield:;
          __pyx_t_4 = __pyx_cur_scope->__pyx_t_0;
          __pyx_cur_scope->__pyx_t_0 = 0;
          __Pyx_XGOTREF(__pyx_t_4);
          __pyx_t_6 = __pyx_cur_scope->__pyx_t_1;
          __pyx_cur_scope->__pyx_t_1 = 0;
          __Pyx_XGOTREF(__pyx_t_6);
          __pyx_t_7 = __pyx_cur_scope->__pyx_t_2;
          __pyx_cur_scope->__pyx_t_2 = 0;
          __Pyx_XGOTREF(__pyx_t_7);
          __pyx_t_8 = __pyx_cur_scope->__pyx_t_3;
          __pyx_cur_scope->__pyx_t_3 = 0;
          __Pyx_XGOTREF(__pyx_t_8);
          if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1630, __pyx_L8_error)

          /* "pkcs11/_pkcs11.pyx":1628
 *         """
 *         cdef DataCryptOperation op = self.__encrypt_operation(mechanism, mechanism_param, buffer_size)
 *         with op:             # <<<<<<<<<<<<<<
 *             yield from op.update_chunks(data)
 *             yield op.finish()
*/
        }
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L13_try_end;
        __pyx_L8_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        /*except:*/ {
          __Pyx_AddTraceback("pkcs11._pkcs11.EncryptMixin._encrypt_generator", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_2) < 0) __PYX_ERR(0, 1628, __pyx_L10_except_error)
          __Pyx_XGOTREF(__pyx_t_1);
          __Pyx_XGOTREF(__pyx_t_5);
          __Pyx_XGOTREF(__pyx_t_2);
          __pyx_t_10 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1628, __pyx_L10_except_error)
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1628, __pyx_L10_except_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          if (__pyx_t_12 < (0)) __PYX_ERR(0, 1628, __pyx_L10_except_error)
          __pyx_t_13 = (!__pyx_t_12);
          if (unlikely(__pyx_t_13)) {
            __Pyx_GIVEREF(__pyx_t_1);
            __Pyx_GIVEREF(__pyx_t_5);
            __Pyx_XGIVEREF(__pyx_t_2);
            __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_5, __pyx_t_2);
            __pyx_t_1 = 0;  __pyx_t_5 = 0;  __pyx_t_2 = 0; 
            __PYX_ERR(0, 1628, __pyx_L10_except_error)
          }
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          goto __pyx_L9_exception_handled;
        }
        __pyx_L10_except_error:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        goto __pyx_L1_error;
        __pyx_L9_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        __pyx_L13_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_4) {
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[2], NULL);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1628, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        goto __pyx_L7;
      }
      __pyx_L7:;
    }
    goto __pyx_L19;
    __pyx_L4_error:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L1_error;
    __pyx_L19:;
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "pkcs11/_pkcs11.pyx":1621
 * 
 * 
 *     def _encrypt_generator(self, data,             # <<<<<<<<<<<<<<
 *                            mechanism=None, mechanism_param=None,
 *                            buffer_size=8192):
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_10);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("_encrypt_generator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1636
 *     """Expand DecryptMixin with an implementation."""
 * 
 *     def __decrypt_operation(self, mechanism, mechanism_param, buffer_size):             # <<<<<<<<<<<<<<
 * 
 *         mech = MechanismWithParam(self.key_type, DEFAULT_ENCRYPT_MECHANISMS, mechanism, mechanism_param)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_12DecryptMixin_1__decrypt_operation(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_12DecryptMixin_1__decrypt_operation = {"__decrypt_operation", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_12DecryptMixin_1__decrypt_operation, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_12DecryptMixin_1__decrypt_operation(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_mechanism = 0;
  PyObject *__pyx_v_mechanism_param = 0;
  PyObject *__pyx_v_buffer_size = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__decrypt_operation (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_mechanism,&__pyx_mstate_global->__pyx_n_u_mechanism_param,&__pyx_mstate_global->__pyx_n_u_buffer_size,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1636, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1636, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1636, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1636, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1636, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__decrypt_operation", 0) < (0)) __PYX_ERR(0, 1636, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__decrypt_operation", 1, 4, 4, i); __PYX_ERR(0, 1636, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 4)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1636, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1636, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1636, __pyx_L3_error)
      values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1636, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_mechanism = values[1];
    __pyx_v_mechanism_param = values[2];
    __pyx_v_buffer_size = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__decrypt_operation", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 1636, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.DecryptMixin.__decrypt_operation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_12DecryptMixin___decrypt_operation(__pyx_self, __pyx_v_self, __pyx_v_mechanism, __pyx_v_mechanism_param, __pyx_v_buffer_size);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_12DecryptMixin___decrypt_operation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param, PyObject *__pyx_v_buffer_size) {
  struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_mech = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  CK_OBJECT_HANDLE __pyx_t_6;
  CK_ULONG __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__decrypt_operation", 0);

  /* "pkcs11/_pkcs11.pyx":1638
 *     def __decrypt_operation(self, mechanism, mechanism_param, buffer_size):
 * 
 *         mech = MechanismWithParam(self.key_type, DEFAULT_ENCRYPT_MECHANISMS, mechanism, mechanism_param)             # <<<<<<<<<<<<<<
 * 
 *         return DataCryptOperation.setup_decrypt(self.session, mech, self.handle, buffer_size)
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_key_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_DEFAULT_ENCRYPT_MECHANISMS); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[5] = {__pyx_t_2, __pyx_t_3, __pyx_t_4, __pyx_v_mechanism, __pyx_v_mechanism_param};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_MechanismWithParam, __pyx_callargs+__pyx_t_5, (5-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1638, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_mech = ((struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1640
 *         mech = MechanismWithParam(self.key_type, DEFAULT_ENCRYPT_MECHANISMS, mechanism, mechanism_param)
 * 
 *         return DataCryptOperation.setup_decrypt(self.session, mech, self.handle, buffer_size)             # <<<<<<<<<<<<<<
 * 
 *     def _decrypt(self, data, mechanism=None, mechanism_param=None, pin=None, buffer_size=8192):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_session); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1640, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Session))))) __PYX_ERR(0, 1640, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_handle); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1640, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyLong_As_CK_ULONG(__pyx_t_4); if (unlikely((__pyx_t_6 == ((CK_OBJECT_HANDLE)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1640, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_7 = __Pyx_PyLong_As_CK_ULONG(__pyx_v_buffer_size); if (unlikely((__pyx_t_7 == ((CK_ULONG)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1640, __pyx_L1_error)
  __pyx_t_4 = ((PyObject *)__pyx_f_6pkcs11_7_pkcs11_18DataCryptOperation_setup_decrypt(((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_t_1), __pyx_v_mech, __pyx_t_6, __pyx_t_7)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1640, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":1636
 *     """Expand DecryptMixin with an implementation."""
 * 
 *     def __decrypt_operation(self, mechanism, mechanism_param, buffer_size):             # <<<<<<<<<<<<<<
 * 
 *         mech = MechanismWithParam(self.key_type, DEFAULT_ENCRYPT_MECHANISMS, mechanism, mechanism_param)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pkcs11._pkcs11.DecryptMixin.__decrypt_operation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mech);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1642
 *         return DataCryptOperation.setup_decrypt(self.session, mech, self.handle, buffer_size)
 * 
 *     def _decrypt(self, data, mechanism=None, mechanism_param=None, pin=None, buffer_size=8192):             # <<<<<<<<<<<<<<
 *         """Non chunking decrypt."""
 *         cdef Session session = self.session
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_12DecryptMixin_3_decrypt(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6pkcs11_7_pkcs11_12DecryptMixin_2_decrypt, "Non chunking decrypt.");
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_12DecryptMixin_3_decrypt = {"_decrypt", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_12DecryptMixin_3_decrypt, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6pkcs11_7_pkcs11_12DecryptMixin_2_decrypt};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_12DecryptMixin_3_decrypt(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_data = 0;
  PyObject *__pyx_v_mechanism = 0;
  PyObject *__pyx_v_mechanism_param = 0;
  PyObject *__pyx_v_pin = 0;
  PyObject *__pyx_v_buffer_size = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[6] = {0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_decrypt (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_data,&__pyx_mstate_global->__pyx_n_u_mechanism,&__pyx_mstate_global->__pyx_n_u_mechanism_param,&__pyx_mstate_global->__pyx_n_u_pin,&__pyx_mstate_global->__pyx_n_u_buffer_size,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1642, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 1642, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1642, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1642, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1642, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1642, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1642, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_decrypt", 0) < (0)) __PYX_ERR(0, 1642, __pyx_L3_error)
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_8192)));
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_decrypt", 0, 2, 6, i); __PYX_ERR(0, 1642, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 1642, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1642, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1642, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1642, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1642, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1642, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_8192)));
    }
    __pyx_v_self = values[0];
    __pyx_v_data = values[1];
    __pyx_v_mechanism = values[2];
    __pyx_v_mechanism_param = values[3];
    __pyx_v_pin = values[4];
    __pyx_v_buffer_size = values[5];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_decrypt", 0, 2, 6, __pyx_nargs); __PYX_ERR(0, 1642, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.DecryptMixin._decrypt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_12DecryptMixin_2_decrypt(__pyx_self, __pyx_v_self, __pyx_v_data, __pyx_v_mechanism, __pyx_v_mechanism_param, __pyx_v_pin, __pyx_v_buffer_size);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_12DecryptMixin_2_decrypt(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param, PyObject *__pyx_v_pin, PyObject *__pyx_v_buffer_size) {
  struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session = 0;
  CYTHON_UNUSED CK_BYTE *__pyx_v_data_ptr;
  CK_ULONG __pyx_v_data_len;
  struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *__pyx_v_op = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  CK_BYTE *__pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_decrypt", 0);

  /* "pkcs11/_pkcs11.pyx":1644
 *     def _decrypt(self, data, mechanism=None, mechanism_param=None, pin=None, buffer_size=8192):
 *         """Non chunking decrypt."""
 *         cdef Session session = self.session             # <<<<<<<<<<<<<<
 *         cdef CK_BYTE *data_ptr = data
 *         cdef CK_ULONG data_len = <CK_ULONG> len(data)
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_session); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1644, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Session))))) __PYX_ERR(0, 1644, __pyx_L1_error)
  __pyx_v_session = ((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1645
 *         """Non chunking decrypt."""
 *         cdef Session session = self.session
 *         cdef CK_BYTE *data_ptr = data             # <<<<<<<<<<<<<<
 *         cdef CK_ULONG data_len = <CK_ULONG> len(data)
 * 
*/
  __pyx_t_2 = __Pyx_PyObject_AsWritableUString(__pyx_v_data); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 1645, __pyx_L1_error)
  __pyx_v_data_ptr = __pyx_t_2;

  /* "pkcs11/_pkcs11.pyx":1646
 *         cdef Session session = self.session
 *         cdef CK_BYTE *data_ptr = data
 *         cdef CK_ULONG data_len = <CK_ULONG> len(data)             # <<<<<<<<<<<<<<
 * 
 *         cdef DataCryptOperation op = self.__decrypt_operation(mechanism, mechanism_param, buffer_size)
*/
  __pyx_t_3 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1646, __pyx_L1_error)
  __pyx_v_data_len = ((CK_ULONG)__pyx_t_3);

  /* "pkcs11/_pkcs11.pyx":1648
 *         cdef CK_ULONG data_len = <CK_ULONG> len(data)
 * 
 *         cdef DataCryptOperation op = self.__decrypt_operation(mechanism, mechanism_param, buffer_size)             # <<<<<<<<<<<<<<
 *         with op:
 *             if pin is not None:
*/
  __pyx_t_4 = __pyx_v_self;
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_4, __pyx_v_mechanism, __pyx_v_mechanism_param, __pyx_v_buffer_size};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_DecryptMixin__decrypt_operation, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1648, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_DataCryptOperation))))) __PYX_ERR(0, 1648, __pyx_L1_error)
  __pyx_v_op = ((struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1649
 * 
 *         cdef DataCryptOperation op = self.__decrypt_operation(mechanism, mechanism_param, buffer_size)
 *         with op:             # <<<<<<<<<<<<<<
 *             if pin is not None:
 *                 session.reaffirm_credentials(pin)
*/
  /*with:*/ {
    __pyx_t_6 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_op), __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1649, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = NULL;
    __pyx_t_7 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_op), __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1649, __pyx_L3_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1649, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    /*try:*/ {
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_10);
        /*try:*/ {

          /* "pkcs11/_pkcs11.pyx":1650
 *         cdef DataCryptOperation op = self.__decrypt_operation(mechanism, mechanism_param, buffer_size)
 *         with op:
 *             if pin is not None:             # <<<<<<<<<<<<<<
 *                 session.reaffirm_credentials(pin)
 *             return op.crypt_process_fully(data, data_len)
*/
          __pyx_t_11 = (__pyx_v_pin != Py_None);
          if (__pyx_t_11) {

            /* "pkcs11/_pkcs11.pyx":1651
 *         with op:
 *             if pin is not None:
 *                 session.reaffirm_credentials(pin)             # <<<<<<<<<<<<<<
 *             return op.crypt_process_fully(data, data_len)
 * 
*/
            __pyx_t_7 = ((PyObject *)__pyx_v_session);
            __Pyx_INCREF(__pyx_t_7);
            __pyx_t_5 = 0;
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_pin};
              __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reaffirm_credentials, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
              if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1651, __pyx_L7_error)
              __Pyx_GOTREF(__pyx_t_1);
            }
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

            /* "pkcs11/_pkcs11.pyx":1650
 *         cdef DataCryptOperation op = self.__decrypt_operation(mechanism, mechanism_param, buffer_size)
 *         with op:
 *             if pin is not None:             # <<<<<<<<<<<<<<
 *                 session.reaffirm_credentials(pin)
 *             return op.crypt_process_fully(data, data_len)
*/
          }

          /* "pkcs11/_pkcs11.pyx":1652
 *             if pin is not None:
 *                 session.reaffirm_credentials(pin)
 *             return op.crypt_process_fully(data, data_len)             # <<<<<<<<<<<<<<
 * 
 * 
*/
          __Pyx_XDECREF(__pyx_r);
          __pyx_t_2 = __Pyx_PyObject_AsWritableUString(__pyx_v_data); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 1652, __pyx_L7_error)
          __pyx_t_1 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DataCryptOperation *)__pyx_v_op->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->crypt_process_fully(__pyx_v_op, __pyx_t_2, __pyx_v_data_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1652, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_r = __pyx_t_1;
          __pyx_t_1 = 0;
          goto __pyx_L11_try_return;

          /* "pkcs11/_pkcs11.pyx":1649
 * 
 *         cdef DataCryptOperation op = self.__decrypt_operation(mechanism, mechanism_param, buffer_size)
 *         with op:             # <<<<<<<<<<<<<<
 *             if pin is not None:
 *                 session.reaffirm_credentials(pin)
*/
        }
        __pyx_L7_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        /*except:*/ {
          __Pyx_AddTraceback("pkcs11._pkcs11.DecryptMixin._decrypt", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_7, &__pyx_t_4) < 0) __PYX_ERR(0, 1649, __pyx_L9_except_error)
          __Pyx_XGOTREF(__pyx_t_1);
          __Pyx_XGOTREF(__pyx_t_7);
          __Pyx_XGOTREF(__pyx_t_4);
          __pyx_t_12 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1649, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_12, NULL);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1649, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          if (__pyx_t_11 < (0)) __PYX_ERR(0, 1649, __pyx_L9_except_error)
          __pyx_t_14 = (!__pyx_t_11);
          if (unlikely(__pyx_t_14)) {
            __Pyx_GIVEREF(__pyx_t_1);
            __Pyx_GIVEREF(__pyx_t_7);
            __Pyx_XGIVEREF(__pyx_t_4);
            __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_7, __pyx_t_4);
            __pyx_t_1 = 0;  __pyx_t_7 = 0;  __pyx_t_4 = 0; 
            __PYX_ERR(0, 1649, __pyx_L9_except_error)
          }
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          goto __pyx_L8_exception_handled;
        }
        __pyx_L9_except_error:;
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        goto __pyx_L1_error;
        __pyx_L11_try_return:;
        __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_L4_return;
        __pyx_L8_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);
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_6) {
          __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_mstate_global->__pyx_tuple[2], NULL);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1649, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        }
        goto __pyx_L6;
      }
      __pyx_L4_return: {
        __pyx_t_10 = __pyx_r;
        __pyx_r = 0;
        if (__pyx_t_6) {
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_mstate_global->__pyx_tuple[2], NULL);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1649, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        }
        __pyx_r = __pyx_t_10;
        __pyx_t_10 = 0;
        goto __pyx_L0;
      }
      __pyx_L6:;
    }
    goto __pyx_L17;
    __pyx_L3_error:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L1_error;
    __pyx_L17:;
  }

  /* "pkcs11/_pkcs11.pyx":1642
 *         return DataCryptOperation.setup_decrypt(self.session, mech, self.handle, buffer_size)
 * 
 *     def _decrypt(self, data, mechanism=None, mechanism_param=None, pin=None, buffer_size=8192):             # <<<<<<<<<<<<<<
 *         """Non chunking decrypt."""
 *         cdef Session session = self.session
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("pkcs11._pkcs11.DecryptMixin._decrypt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_session);
  __Pyx_XDECREF((PyObject *)__pyx_v_op);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6pkcs11_7_pkcs11_12DecryptMixin_6generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pkcs11/_pkcs11.pyx":1655
 * 
 * 
 *     def _decrypt_generator(self, data,             # <<<<<<<<<<<<<<
 *                            mechanism=None, mechanism_param=None, pin=None,
 *                            buffer_size=8192):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_12DecryptMixin_5_decrypt_generator(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6pkcs11_7_pkcs11_12DecryptMixin_4_decrypt_generator, "\n        Chunking decrypt.\n        ");
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_12DecryptMixin_5_decrypt_generator = {"_decrypt_generator", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_12DecryptMixin_5_decrypt_generator, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6pkcs11_7_pkcs11_12DecryptMixin_4_decrypt_generator};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_12DecryptMixin_5_decrypt_generator(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_data = 0;
  PyObject *__pyx_v_mechanism = 0;
  PyObject *__pyx_v_mechanism_param = 0;
  PyObject *__pyx_v_pin = 0;
  PyObject *__pyx_v_buffer_size = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[6] = {0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_decrypt_generator (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_data,&__pyx_mstate_global->__pyx_n_u_mechanism,&__pyx_mstate_global->__pyx_n_u_mechanism_param,&__pyx_mstate_global->__pyx_n_u_pin,&__pyx_mstate_global->__pyx_n_u_buffer_size,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1655, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 1655, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1655, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1655, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1655, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1655, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1655, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_decrypt_generator", 0) < (0)) __PYX_ERR(0, 1655, __pyx_L3_error)

      /* "pkcs11/_pkcs11.pyx":1656
 * 
 *     def _decrypt_generator(self, data,
 *                            mechanism=None, mechanism_param=None, pin=None,             # <<<<<<<<<<<<<<
 *                            buffer_size=8192):
 *         """
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_8192)));
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_decrypt_generator", 0, 2, 6, i); __PYX_ERR(0, 1655, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 1655, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1655, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1655, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1655, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1655, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1655, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_8192)));
    }
    __pyx_v_self = values[0];
    __pyx_v_data = values[1];
    __pyx_v_mechanism = values[2];
    __pyx_v_mechanism_param = values[3];
    __pyx_v_pin = values[4];
    __pyx_v_buffer_size = values[5];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_decrypt_generator", 0, 2, 6, __pyx_nargs); __PYX_ERR(0, 1655, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.DecryptMixin._decrypt_generator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_12DecryptMixin_4_decrypt_generator(__pyx_self, __pyx_v_self, __pyx_v_data, __pyx_v_mechanism, __pyx_v_mechanism_param, __pyx_v_pin, __pyx_v_buffer_size);

  /* "pkcs11/_pkcs11.pyx":1655
 * 
 * 
 *     def _decrypt_generator(self, data,             # <<<<<<<<<<<<<<
 *                            mechanism=None, mechanism_param=None, pin=None,
 *                            buffer_size=8192):
*/

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_12DecryptMixin_4_decrypt_generator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param, PyObject *__pyx_v_pin, PyObject *__pyx_v_buffer_size) {
  struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_decrypt_generator", 0);
  __pyx_cur_scope = (struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator *)__pyx_tp_new_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1655, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_data = __pyx_v_data;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_data);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_data);
  __pyx_cur_scope->__pyx_v_mechanism = __pyx_v_mechanism;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_mechanism);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_mechanism);
  __pyx_cur_scope->__pyx_v_mechanism_param = __pyx_v_mechanism_param;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_mechanism_param);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_mechanism_param);
  __pyx_cur_scope->__pyx_v_pin = __pyx_v_pin;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_pin);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_pin);
  __pyx_cur_scope->__pyx_v_buffer_size = __pyx_v_buffer_size;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_buffer_size);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_buffer_size);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6pkcs11_7_pkcs11_12DecryptMixin_6generator4, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_decrypt_generator, __pyx_mstate_global->__pyx_n_u_DecryptMixin__decrypt_generator, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11); if (unlikely(!gen)) __PYX_ERR(0, 1655, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.DecryptMixin._decrypt_generator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6pkcs11_7_pkcs11_12DecryptMixin_6generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator *__pyx_cur_scope = ((struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  __Pyx_PySendResult __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_decrypt_generator", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L15_resume_from_yield_from;
    case 2: goto __pyx_L16_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(0, 1655, __pyx_L1_error)
  }

  /* "pkcs11/_pkcs11.pyx":1661
 *         Chunking decrypt.
 *         """
 *         cdef Session session = self.session             # <<<<<<<<<<<<<<
 * 
 *         cdef DataCryptOperation op = self.__decrypt_operation(mechanism, mechanism_param, buffer_size)
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_mstate_global->__pyx_n_u_session); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Session))))) __PYX_ERR(0, 1661, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_session = ((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1663
 *         cdef Session session = self.session
 * 
 *         cdef DataCryptOperation op = self.__decrypt_operation(mechanism, mechanism_param, buffer_size)             # <<<<<<<<<<<<<<
 *         with op:
 *             if pin is not None:
*/
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_self;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_cur_scope->__pyx_v_mechanism, __pyx_cur_scope->__pyx_v_mechanism_param, __pyx_cur_scope->__pyx_v_buffer_size};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_DecryptMixin__decrypt_operation, __pyx_callargs+__pyx_t_3, (4-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1663, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_DataCryptOperation))))) __PYX_ERR(0, 1663, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_op = ((struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1664
 * 
 *         cdef DataCryptOperation op = self.__decrypt_operation(mechanism, mechanism_param, buffer_size)
 *         with op:             # <<<<<<<<<<<<<<
 *             if pin is not None:
 *                 session.reaffirm_credentials(pin)
*/
  /*with:*/ {
    __pyx_t_4 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_cur_scope->__pyx_v_op), __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1664, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = NULL;
    __pyx_t_5 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_cur_scope->__pyx_v_op), __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1664, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_3 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1664, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    /*try:*/ {
      {
        __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        /*try:*/ {

          /* "pkcs11/_pkcs11.pyx":1665
 *         cdef DataCryptOperation op = self.__decrypt_operation(mechanism, mechanism_param, buffer_size)
 *         with op:
 *             if pin is not None:             # <<<<<<<<<<<<<<
 *                 session.reaffirm_credentials(pin)
 *             yield from op.update_chunks(data)
*/
          __pyx_t_9 = (__pyx_cur_scope->__pyx_v_pin != Py_None);
          if (__pyx_t_9) {

            /* "pkcs11/_pkcs11.pyx":1666
 *         with op:
 *             if pin is not None:
 *                 session.reaffirm_credentials(pin)             # <<<<<<<<<<<<<<
 *             yield from op.update_chunks(data)
 *             yield op.finish()
*/
            __pyx_t_5 = ((PyObject *)__pyx_cur_scope->__pyx_v_session);
            __Pyx_INCREF(__pyx_t_5);
            __pyx_t_3 = 0;
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_pin};
              __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reaffirm_credentials, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
              if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1666, __pyx_L8_error)
              __Pyx_GOTREF(__pyx_t_1);
            }
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

            /* "pkcs11/_pkcs11.pyx":1665
 *         cdef DataCryptOperation op = self.__decrypt_operation(mechanism, mechanism_param, buffer_size)
 *         with op:
 *             if pin is not None:             # <<<<<<<<<<<<<<
 *                 session.reaffirm_credentials(pin)
 *             yield from op.update_chunks(data)
*/
          }

          /* "pkcs11/_pkcs11.pyx":1667
 *             if pin is not None:
 *                 session.reaffirm_credentials(pin)
 *             yield from op.update_chunks(data)             # <<<<<<<<<<<<<<
 *             yield op.finish()
 * 
*/
          __pyx_t_5 = ((PyObject *)__pyx_cur_scope->__pyx_v_op);
          __Pyx_INCREF(__pyx_t_5);
          __pyx_t_3 = 0;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_data};
            __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_update_chunks, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1667, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_1);
          }
          __pyx_t_10 = __Pyx_Generator_Yield_From(__pyx_generator, __pyx_t_1, &__pyx_r);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (likely(__pyx_t_10 == PYGEN_NEXT)) {
            __Pyx_GOTREF(__pyx_r);
            __Pyx_XGIVEREF(__pyx_t_4);
            __pyx_cur_scope->__pyx_t_0 = __pyx_t_4;
            __Pyx_XGIVEREF(__pyx_t_6);
            __pyx_cur_scope->__pyx_t_1 = __pyx_t_6;
            __Pyx_XGIVEREF(__pyx_t_7);
            __pyx_cur_scope->__pyx_t_2 = __pyx_t_7;
            __Pyx_XGIVEREF(__pyx_t_8);
            __pyx_cur_scope->__pyx_t_3 = __pyx_t_8;
            __Pyx_XGIVEREF(__pyx_r);
            __Pyx_RefNannyFinishContext();
            __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
            /* return from generator, yielding value */
            __pyx_generator->resume_label = 1;
            return __pyx_r;
            __pyx_L15_resume_from_yield_from:;
            __pyx_t_4 = __pyx_cur_scope->__pyx_t_0;
            __pyx_cur_scope->__pyx_t_0 = 0;
            __Pyx_XGOTREF(__pyx_t_4);
            __pyx_t_6 = __pyx_cur_scope->__pyx_t_1;
            __pyx_cur_scope->__pyx_t_1 = 0;
            __Pyx_XGOTREF(__pyx_t_6);
            __pyx_t_7 = __pyx_cur_scope->__pyx_t_2;
            __pyx_cur_scope->__pyx_t_2 = 0;
            __Pyx_XGOTREF(__pyx_t_7);
            __pyx_t_8 = __pyx_cur_scope->__pyx_t_3;
            __pyx_cur_scope->__pyx_t_3 = 0;
            __Pyx_XGOTREF(__pyx_t_8);
            if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1667, __pyx_L8_error)
          } else if (likely(__pyx_t_10 == PYGEN_RETURN)) {
            __Pyx_GOTREF(__pyx_r);
            __Pyx_DECREF(__pyx_r); __pyx_r = 0;
          } else {
            __Pyx_XGOTREF(__pyx_r);
            __PYX_ERR(0, 1667, __pyx_L8_error)
          }

          /* "pkcs11/_pkcs11.pyx":1668
 *                 session.reaffirm_credentials(pin)
 *             yield from op.update_chunks(data)
 *             yield op.finish()             # <<<<<<<<<<<<<<
 * 
 * 
*/
          __pyx_t_1 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DataCryptOperation *)__pyx_cur_scope->__pyx_v_op->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->finish(__pyx_cur_scope->__pyx_v_op); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1668, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_r = __pyx_t_1;
          __pyx_t_1 = 0;
          __Pyx_XGIVEREF(__pyx_t_4);
          __pyx_cur_scope->__pyx_t_0 = __pyx_t_4;
          __Pyx_XGIVEREF(__pyx_t_6);
          __pyx_cur_scope->__pyx_t_1 = __pyx_t_6;
          __Pyx_XGIVEREF(__pyx_t_7);
          __pyx_cur_scope->__pyx_t_2 = __pyx_t_7;
          __Pyx_XGIVEREF(__pyx_t_8);
          __pyx_cur_scope->__pyx_t_3 = __pyx_t_8;
          __Pyx_XGIVEREF(__pyx_r);
          __Pyx_RefNannyFinishContext();
          __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
          /* return from generator, yielding value */
          __pyx_generator->resume_label = 2;
          return __pyx_r;
          __pyx_L16_resume_from_yield:;
          __pyx_t_4 = __pyx_cur_scope->__pyx_t_0;
          __pyx_cur_scope->__pyx_t_0 = 0;
          __Pyx_XGOTREF(__pyx_t_4);
          __pyx_t_6 = __pyx_cur_scope->__pyx_t_1;
          __pyx_cur_scope->__pyx_t_1 = 0;
          __Pyx_XGOTREF(__pyx_t_6);
          __pyx_t_7 = __pyx_cur_scope->__pyx_t_2;
          __pyx_cur_scope->__pyx_t_2 = 0;
          __Pyx_XGOTREF(__pyx_t_7);
          __pyx_t_8 = __pyx_cur_scope->__pyx_t_3;
          __pyx_cur_scope->__pyx_t_3 = 0;
          __Pyx_XGOTREF(__pyx_t_8);
          if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1668, __pyx_L8_error)

          /* "pkcs11/_pkcs11.pyx":1664
 * 
 *         cdef DataCryptOperation op = self.__decrypt_operation(mechanism, mechanism_param, buffer_size)
 *         with op:             # <<<<<<<<<<<<<<
 *             if pin is not None:
 *                 session.reaffirm_credentials(pin)
*/
        }
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L13_try_end;
        __pyx_L8_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        /*except:*/ {
          __Pyx_AddTraceback("pkcs11._pkcs11.DecryptMixin._decrypt_generator", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_2) < 0) __PYX_ERR(0, 1664, __pyx_L10_except_error)
          __Pyx_XGOTREF(__pyx_t_1);
          __Pyx_XGOTREF(__pyx_t_5);
          __Pyx_XGOTREF(__pyx_t_2);
          __pyx_t_11 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1664, __pyx_L10_except_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_11, NULL);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1664, __pyx_L10_except_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          if (__pyx_t_9 < (0)) __PYX_ERR(0, 1664, __pyx_L10_except_error)
          __pyx_t_13 = (!__pyx_t_9);
          if (unlikely(__pyx_t_13)) {
            __Pyx_GIVEREF(__pyx_t_1);
            __Pyx_GIVEREF(__pyx_t_5);
            __Pyx_XGIVEREF(__pyx_t_2);
            __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_5, __pyx_t_2);
            __pyx_t_1 = 0;  __pyx_t_5 = 0;  __pyx_t_2 = 0; 
            __PYX_ERR(0, 1664, __pyx_L10_except_error)
          }
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          goto __pyx_L9_exception_handled;
        }
        __pyx_L10_except_error:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        goto __pyx_L1_error;
        __pyx_L9_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        __pyx_L13_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_4) {
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[2], NULL);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1664, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        goto __pyx_L7;
      }
      __pyx_L7:;
    }
    goto __pyx_L20;
    __pyx_L4_error:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L1_error;
    __pyx_L20:;
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "pkcs11/_pkcs11.pyx":1655
 * 
 * 
 *     def _decrypt_generator(self, data,             # <<<<<<<<<<<<<<
 *                            mechanism=None, mechanism_param=None, pin=None,
 *                            buffer_size=8192):
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_11);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("_decrypt_generator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1674
 *     cdef OperationUpdate op_update
 * 
 *     def ingest_chunks(self, chunks):             # <<<<<<<<<<<<<<
 *         cdef Session session = self.session
 *         cdef CK_BYTE *data_ptr
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_21SignOrVerifyOperation_1ingest_chunks(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_21SignOrVerifyOperation_1ingest_chunks = {"ingest_chunks", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_21SignOrVerifyOperation_1ingest_chunks, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_21SignOrVerifyOperation_1ingest_chunks(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_chunks = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ingest_chunks (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_chunks,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1674, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1674, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "ingest_chunks", 0) < (0)) __PYX_ERR(0, 1674, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("ingest_chunks", 1, 1, 1, i); __PYX_ERR(0, 1674, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1674, __pyx_L3_error)
    }
    __pyx_v_chunks = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ingest_chunks", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1674, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.SignOrVerifyOperation.ingest_chunks", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_21SignOrVerifyOperation_ingest_chunks(((struct __pyx_obj_6pkcs11_7_pkcs11_SignOrVerifyOperation *)__pyx_v_self), __pyx_v_chunks);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_21SignOrVerifyOperation_ingest_chunks(struct __pyx_obj_6pkcs11_7_pkcs11_SignOrVerifyOperation *__pyx_v_self, PyObject *__pyx_v_chunks) {
  CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session = 0;
  CK_BYTE *__pyx_v_data_ptr;
  CK_ULONG __pyx_v_data_len;
  PyObject *__pyx_v_chunk = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  CK_BYTE *__pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ingest_chunks", 0);

  /* "pkcs11/_pkcs11.pyx":1675
 * 
 *     def ingest_chunks(self, chunks):
 *         cdef Session session = self.session             # <<<<<<<<<<<<<<
 *         cdef CK_BYTE *data_ptr
 *         cdef CK_ULONG data_len
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.session);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_session = ((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1679
 *         cdef CK_ULONG data_len
 * 
 *         for chunk in chunks:             # <<<<<<<<<<<<<<
 *             if not chunk:
 *                 continue
*/
  if (likely(PyList_CheckExact(__pyx_v_chunks)) || PyTuple_CheckExact(__pyx_v_chunks)) {
    __pyx_t_1 = __pyx_v_chunks; __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_chunks); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1679, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1679, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1679, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_2;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1679, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
        #endif
        ++__pyx_t_2;
      }
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1679, __pyx_L1_error)
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1679, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_chunk, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "pkcs11/_pkcs11.pyx":1680
 * 
 *         for chunk in chunks:
 *             if not chunk:             # <<<<<<<<<<<<<<
 *                 continue
 *             data_ptr = chunk
*/
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_chunk); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1680, __pyx_L1_error)
    __pyx_t_6 = (!__pyx_t_5);
    if (__pyx_t_6) {

      /* "pkcs11/_pkcs11.pyx":1681
 *         for chunk in chunks:
 *             if not chunk:
 *                 continue             # <<<<<<<<<<<<<<
 *             data_ptr = chunk
 *             data_len = <CK_ULONG> len(chunk)
*/
      goto __pyx_L3_continue;

      /* "pkcs11/_pkcs11.pyx":1680
 * 
 *         for chunk in chunks:
 *             if not chunk:             # <<<<<<<<<<<<<<
 *                 continue
 *             data_ptr = chunk
*/
    }

    /* "pkcs11/_pkcs11.pyx":1682
 *             if not chunk:
 *                 continue
 *             data_ptr = chunk             # <<<<<<<<<<<<<<
 *             data_len = <CK_ULONG> len(chunk)
 *             self.update_no_output(self.op_update, data_ptr, data_len)
*/
    __pyx_t_7 = __Pyx_PyObject_AsWritableUString(__pyx_v_chunk); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 1682, __pyx_L1_error)
    __pyx_v_data_ptr = __pyx_t_7;

    /* "pkcs11/_pkcs11.pyx":1683
 *                 continue
 *             data_ptr = chunk
 *             data_len = <CK_ULONG> len(chunk)             # <<<<<<<<<<<<<<
 *             self.update_no_output(self.op_update, data_ptr, data_len)
 * 
*/
    __pyx_t_8 = PyObject_Length(__pyx_v_chunk); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1683, __pyx_L1_error)
    __pyx_v_data_len = ((CK_ULONG)__pyx_t_8);

    /* "pkcs11/_pkcs11.pyx":1684
 *             data_ptr = chunk
 *             data_len = <CK_ULONG> len(chunk)
 *             self.update_no_output(self.op_update, data_ptr, data_len)             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_t_4 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_SignOrVerifyOperation *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.update_no_output(((struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *)__pyx_v_self), __pyx_v_self->op_update, __pyx_v_data_ptr, __pyx_v_data_len); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1684, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "pkcs11/_pkcs11.pyx":1679
 *         cdef CK_ULONG data_len
 * 
 *         for chunk in chunks:             # <<<<<<<<<<<<<<
 *             if not chunk:
 *                 continue
*/
    __pyx_L3_continue:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1674
 *     cdef OperationUpdate op_update
 * 
 *     def ingest_chunks(self, chunks):             # <<<<<<<<<<<<<<
 *         cdef Session session = self.session
 *         cdef CK_BYTE *data_ptr
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pkcs11._pkcs11.SignOrVerifyOperation.ingest_chunks", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_session);
  __Pyx_XDECREF(__pyx_v_chunk);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_21SignOrVerifyOperation_3__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_21SignOrVerifyOperation_3__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_21SignOrVerifyOperation_3__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_21SignOrVerifyOperation_3__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_21SignOrVerifyOperation_2__reduce_cython__(((struct __pyx_obj_6pkcs11_7_pkcs11_SignOrVerifyOperation *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_21SignOrVerifyOperation_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_SignOrVerifyOperation *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 2, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.SignOrVerifyOperation.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_21SignOrVerifyOperation_5__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_21SignOrVerifyOperation_5__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_21SignOrVerifyOperation_5__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_21SignOrVerifyOperation_5__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.SignOrVerifyOperation.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_21SignOrVerifyOperation_4__setstate_cython__(((struct __pyx_obj_6pkcs11_7_pkcs11_SignOrVerifyOperation *)__pyx_v_self), __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_21SignOrVerifyOperation_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_SignOrVerifyOperation *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 4, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.SignOrVerifyOperation.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1689
 * cdef class DataSignOperation(SignOrVerifyOperation):
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef DataSignOperation setup(
 *             Session session,
*/

static struct __pyx_obj_6pkcs11_7_pkcs11_DataSignOperation *__pyx_f_6pkcs11_7_pkcs11_17DataSignOperation_setup(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_mech, CK_OBJECT_HANDLE __pyx_v_key, CK_ULONG __pyx_v_buffer_size) {
  struct __pyx_obj_6pkcs11_7_pkcs11_DataSignOperation *__pyx_v_op = 0;
  struct __pyx_obj_6pkcs11_7_pkcs11_DataSignOperation *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  CK_RV (*__pyx_t_3)(CK_SESSION_HANDLE, CK_MECHANISM *, CK_OBJECT_HANDLE);
  CK_RV (*__pyx_t_4)(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("setup", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_session);
  __Pyx_INCREF((PyObject *)__pyx_v_mech);

  /* "pkcs11/_pkcs11.pyx":1696
 *             CK_ULONG buffer_size
 *     ) with gil:
 *         cdef DataSignOperation op = <DataSignOperation> KeyOperation._common_key_setup(             # <<<<<<<<<<<<<<
 *             DataSignOperation, session, mech, key, buffer_size
 *         )
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_6pkcs11_7_pkcs11_12KeyOperation__common_key_setup(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_DataSignOperation, __pyx_v_session, __pyx_v_mech, __pyx_v_key, __pyx_v_buffer_size)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1696, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_op = ((struct __pyx_obj_6pkcs11_7_pkcs11_DataSignOperation *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pkcs11/_pkcs11.pyx":1699
 *             DataSignOperation, session, mech, key, buffer_size
 *         )
 *         op.op_init = session.funclist.C_SignInit             # <<<<<<<<<<<<<<
 *         op.op_update = session.funclist.C_SignUpdate
 *         return op
*/
  __pyx_t_3 = __pyx_v_session->__pyx_base.funclist->C_SignInit;
  __pyx_v_op->__pyx_base.__pyx_base.op_init = __pyx_t_3;

  /* "pkcs11/_pkcs11.pyx":1700
 *         )
 *         op.op_init = session.funclist.C_SignInit
 *         op.op_update = session.funclist.C_SignUpdate             # <<<<<<<<<<<<<<
 *         return op
 * 
*/
  __pyx_t_4 = __pyx_v_session->__pyx_base.funclist->C_SignUpdate;
  __pyx_v_op->__pyx_base.op_update = __pyx_t_4;

  /* "pkcs11/_pkcs11.pyx":1701
 *         op.op_init = session.funclist.C_SignInit
 *         op.op_update = session.funclist.C_SignUpdate
 *         return op             # <<<<<<<<<<<<<<
 * 
 *     cdef bytes sign_process_fully(self, CK_BYTE *data, CK_ULONG data_len) with gil:
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_op);
  __pyx_r = __pyx_v_op;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":1689
 * cdef class DataSignOperation(SignOrVerifyOperation):
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef DataSignOperation setup(
 *             Session session,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pkcs11._pkcs11.DataSignOperation.setup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_op);
  __Pyx_XDECREF((PyObject *)__pyx_v_session);
  __Pyx_XDECREF((PyObject *)__pyx_v_mech);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1703
 *         return op
 * 
 *     cdef bytes sign_process_fully(self, CK_BYTE *data, CK_ULONG data_len) with gil:             # <<<<<<<<<<<<<<
 *         cdef Session session = self.session
 *         return self.process_fully(session.funclist.C_Sign, data, data_len)
*/

static PyObject *__pyx_f_6pkcs11_7_pkcs11_17DataSignOperation_sign_process_fully(struct __pyx_obj_6pkcs11_7_pkcs11_DataSignOperation *__pyx_v_self, CK_BYTE *__pyx_v_data, CK_ULONG __pyx_v_data_len) {
  struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("sign_process_fully", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_self);

  /* "pkcs11/_pkcs11.pyx":1704
 * 
 *     cdef bytes sign_process_fully(self, CK_BYTE *data, CK_ULONG data_len) with gil:
 *         cdef Session session = self.session             # <<<<<<<<<<<<<<
 *         return self.process_fully(session.funclist.C_Sign, data, data_len)
 * 
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base.session);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_session = ((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1705
 *     cdef bytes sign_process_fully(self, CK_BYTE *data, CK_ULONG data_len) with gil:
 *         cdef Session session = self.session
 *         return self.process_fully(session.funclist.C_Sign, data, data_len)             # <<<<<<<<<<<<<<
 * 
 *     cdef bytes finish(self) with gil:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DataSignOperation *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base.process_fully(((struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *)__pyx_v_self), __pyx_v_session->__pyx_base.funclist->C_Sign, __pyx_v_data, __pyx_v_data_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1705, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":1703
 *         return op
 * 
 *     cdef bytes sign_process_fully(self, CK_BYTE *data, CK_ULONG data_len) with gil:             # <<<<<<<<<<<<<<
 *         cdef Session session = self.session
 *         return self.process_fully(session.funclist.C_Sign, data, data_len)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pkcs11._pkcs11.DataSignOperation.sign_process_fully", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_session);
  __Pyx_XDECREF((PyObject *)__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1707
 *         return self.process_fully(session.funclist.C_Sign, data, data_len)
 * 
 *     cdef bytes finish(self) with gil:             # <<<<<<<<<<<<<<
 *         cdef Session session = self.session
 *         return self.finish_with_output(session.funclist.C_SignFinal)
*/

static PyObject *__pyx_f_6pkcs11_7_pkcs11_17DataSignOperation_finish(struct __pyx_obj_6pkcs11_7_pkcs11_DataSignOperation *__pyx_v_self) {
  struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("finish", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_self);

  /* "pkcs11/_pkcs11.pyx":1708
 * 
 *     cdef bytes finish(self) with gil:
 *         cdef Session session = self.session             # <<<<<<<<<<<<<<
 *         return self.finish_with_output(session.funclist.C_SignFinal)
 * 
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base.session);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_session = ((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1709
 *     cdef bytes finish(self) with gil:
 *         cdef Session session = self.session
 *         return self.finish_with_output(session.funclist.C_SignFinal)             # <<<<<<<<<<<<<<
 * 
 *     def unclean_shutdown(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DataSignOperation *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base.finish_with_output(((struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *)__pyx_v_self), __pyx_v_session->__pyx_base.funclist->C_SignFinal); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1709, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":1707
 *         return self.process_fully(session.funclist.C_Sign, data, data_len)
 * 
 *     cdef bytes finish(self) with gil:             # <<<<<<<<<<<<<<
 *         cdef Session session = self.session
 *         return self.finish_with_output(session.funclist.C_SignFinal)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pkcs11._pkcs11.DataSignOperation.finish", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_session);
  __Pyx_XDECREF((PyObject *)__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1711
 *         return self.finish_with_output(session.funclist.C_SignFinal)
 * 
 *     def unclean_shutdown(self):             # <<<<<<<<<<<<<<
 *         cdef Session session = self.session
 *         self.execute_resizing_output(session.funclist.C_SignFinal)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_17DataSignOperation_1unclean_shutdown(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_17DataSignOperation_1unclean_shutdown = {"unclean_shutdown", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_17DataSignOperation_1unclean_shutdown, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_17DataSignOperation_1unclean_shutdown(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("unclean_shutdown (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("unclean_shutdown", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("unclean_shutdown", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_17DataSignOperation_unclean_shutdown(((struct __pyx_obj_6pkcs11_7_pkcs11_DataSignOperation *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_17DataSignOperation_unclean_shutdown(struct __pyx_obj_6pkcs11_7_pkcs11_DataSignOperation *__pyx_v_self) {
  struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("unclean_shutdown", 0);

  /* "pkcs11/_pkcs11.pyx":1712
 * 
 *     def unclean_shutdown(self):
 *         cdef Session session = self.session             # <<<<<<<<<<<<<<
 *         self.execute_resizing_output(session.funclist.C_SignFinal)
 * 
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base.session);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_session = ((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1713
 *     def unclean_shutdown(self):
 *         cdef Session session = self.session
 *         self.execute_resizing_output(session.funclist.C_SignFinal)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DataSignOperation *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base.execute_resizing_output(((struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *)__pyx_v_self), __pyx_v_session->__pyx_base.funclist->C_SignFinal); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1713, __pyx_L1_error)

  /* "pkcs11/_pkcs11.pyx":1711
 *         return self.finish_with_output(session.funclist.C_SignFinal)
 * 
 *     def unclean_shutdown(self):             # <<<<<<<<<<<<<<
 *         cdef Session session = self.session
 *         self.execute_resizing_output(session.funclist.C_SignFinal)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pkcs11._pkcs11.DataSignOperation.unclean_shutdown", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_session);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_17DataSignOperation_3__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_17DataSignOperation_3__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_17DataSignOperation_3__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_17DataSignOperation_3__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_17DataSignOperation_2__reduce_cython__(((struct __pyx_obj_6pkcs11_7_pkcs11_DataSignOperation *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_17DataSignOperation_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_DataSignOperation *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 2, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.DataSignOperation.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_17DataSignOperation_5__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_17DataSignOperation_5__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_17DataSignOperation_5__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_17DataSignOperation_5__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.DataSignOperation.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_17DataSignOperation_4__setstate_cython__(((struct __pyx_obj_6pkcs11_7_pkcs11_DataSignOperation *)__pyx_v_self), __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_17DataSignOperation_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_DataSignOperation *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 4, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.DataSignOperation.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1719
 *     """Expand SignMixin with an implementation."""
 * 
 *     def __sign_operation(self, mechanism, mechanism_param, buffer_size):             # <<<<<<<<<<<<<<
 *         mech = MechanismWithParam(self.key_type, DEFAULT_SIGN_MECHANISMS, mechanism, mechanism_param)
 *         return DataSignOperation.setup(self.session, mech, self.handle, buffer_size)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_9SignMixin_1__sign_operation(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_9SignMixin_1__sign_operation = {"__sign_operation", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_9SignMixin_1__sign_operation, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_9SignMixin_1__sign_operation(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_mechanism = 0;
  PyObject *__pyx_v_mechanism_param = 0;
  PyObject *__pyx_v_buffer_size = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__sign_operation (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_mechanism,&__pyx_mstate_global->__pyx_n_u_mechanism_param,&__pyx_mstate_global->__pyx_n_u_buffer_size,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1719, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1719, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1719, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1719, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1719, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__sign_operation", 0) < (0)) __PYX_ERR(0, 1719, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__sign_operation", 1, 4, 4, i); __PYX_ERR(0, 1719, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 4)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1719, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1719, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1719, __pyx_L3_error)
      values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1719, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_mechanism = values[1];
    __pyx_v_mechanism_param = values[2];
    __pyx_v_buffer_size = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__sign_operation", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 1719, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.SignMixin.__sign_operation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_9SignMixin___sign_operation(__pyx_self, __pyx_v_self, __pyx_v_mechanism, __pyx_v_mechanism_param, __pyx_v_buffer_size);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_9SignMixin___sign_operation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param, PyObject *__pyx_v_buffer_size) {
  struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_mech = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  CK_OBJECT_HANDLE __pyx_t_6;
  CK_ULONG __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__sign_operation", 0);

  /* "pkcs11/_pkcs11.pyx":1720
 * 
 *     def __sign_operation(self, mechanism, mechanism_param, buffer_size):
 *         mech = MechanismWithParam(self.key_type, DEFAULT_SIGN_MECHANISMS, mechanism, mechanism_param)             # <<<<<<<<<<<<<<
 *         return DataSignOperation.setup(self.session, mech, self.handle, buffer_size)
 * 
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_key_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1720, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_DEFAULT_SIGN_MECHANISMS); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1720, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[5] = {__pyx_t_2, __pyx_t_3, __pyx_t_4, __pyx_v_mechanism, __pyx_v_mechanism_param};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_MechanismWithParam, __pyx_callargs+__pyx_t_5, (5-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1720, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_mech = ((struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1721
 *     def __sign_operation(self, mechanism, mechanism_param, buffer_size):
 *         mech = MechanismWithParam(self.key_type, DEFAULT_SIGN_MECHANISMS, mechanism, mechanism_param)
 *         return DataSignOperation.setup(self.session, mech, self.handle, buffer_size)             # <<<<<<<<<<<<<<
 * 
 *     def _sign(self, data,
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_session); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1721, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Session))))) __PYX_ERR(0, 1721, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_handle); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1721, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyLong_As_CK_ULONG(__pyx_t_4); if (unlikely((__pyx_t_6 == ((CK_OBJECT_HANDLE)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1721, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_7 = __Pyx_PyLong_As_CK_ULONG(__pyx_v_buffer_size); if (unlikely((__pyx_t_7 == ((CK_ULONG)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1721, __pyx_L1_error)
  __pyx_t_4 = ((PyObject *)__pyx_f_6pkcs11_7_pkcs11_17DataSignOperation_setup(((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_t_1), __pyx_v_mech, __pyx_t_6, __pyx_t_7)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1721, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":1719
 *     """Expand SignMixin with an implementation."""
 * 
 *     def __sign_operation(self, mechanism, mechanism_param, buffer_size):             # <<<<<<<<<<<<<<
 *         mech = MechanismWithParam(self.key_type, DEFAULT_SIGN_MECHANISMS, mechanism, mechanism_param)
 *         return DataSignOperation.setup(self.session, mech, self.handle, buffer_size)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pkcs11._pkcs11.SignMixin.__sign_operation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mech);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1723
 *         return DataSignOperation.setup(self.session, mech, self.handle, buffer_size)
 * 
 *     def _sign(self, data,             # <<<<<<<<<<<<<<
 *               mechanism=None, mechanism_param=None, pin=None, buffer_size=8192):
 *         cdef Session session = self.session
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_9SignMixin_3_sign(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_9SignMixin_3_sign = {"_sign", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_9SignMixin_3_sign, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_9SignMixin_3_sign(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_data = 0;
  PyObject *__pyx_v_mechanism = 0;
  PyObject *__pyx_v_mechanism_param = 0;
  PyObject *__pyx_v_pin = 0;
  PyObject *__pyx_v_buffer_size = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[6] = {0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_sign (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_data,&__pyx_mstate_global->__pyx_n_u_mechanism,&__pyx_mstate_global->__pyx_n_u_mechanism_param,&__pyx_mstate_global->__pyx_n_u_pin,&__pyx_mstate_global->__pyx_n_u_buffer_size,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1723, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 1723, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1723, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1723, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1723, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1723, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1723, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_sign", 0) < (0)) __PYX_ERR(0, 1723, __pyx_L3_error)

      /* "pkcs11/_pkcs11.pyx":1724
 * 
 *     def _sign(self, data,
 *               mechanism=None, mechanism_param=None, pin=None, buffer_size=8192):             # <<<<<<<<<<<<<<
 *         cdef Session session = self.session
 *         cdef CK_BYTE *data_ptr = data
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_8192)));
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_sign", 0, 2, 6, i); __PYX_ERR(0, 1723, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 1723, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1723, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1723, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1723, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1723, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1723, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_8192)));
    }
    __pyx_v_self = values[0];
    __pyx_v_data = values[1];
    __pyx_v_mechanism = values[2];
    __pyx_v_mechanism_param = values[3];
    __pyx_v_pin = values[4];
    __pyx_v_buffer_size = values[5];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_sign", 0, 2, 6, __pyx_nargs); __PYX_ERR(0, 1723, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.SignMixin._sign", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_9SignMixin_2_sign(__pyx_self, __pyx_v_self, __pyx_v_data, __pyx_v_mechanism, __pyx_v_mechanism_param, __pyx_v_pin, __pyx_v_buffer_size);

  /* "pkcs11/_pkcs11.pyx":1723
 *         return DataSignOperation.setup(self.session, mech, self.handle, buffer_size)
 * 
 *     def _sign(self, data,             # <<<<<<<<<<<<<<
 *               mechanism=None, mechanism_param=None, pin=None, buffer_size=8192):
 *         cdef Session session = self.session
*/

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_9SignMixin_2_sign(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param, PyObject *__pyx_v_pin, PyObject *__pyx_v_buffer_size) {
  struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session = 0;
  CYTHON_UNUSED CK_BYTE *__pyx_v_data_ptr;
  CK_ULONG __pyx_v_data_len;
  struct __pyx_obj_6pkcs11_7_pkcs11_DataSignOperation *__pyx_v_op = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  CK_BYTE *__pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_sign", 0);

  /* "pkcs11/_pkcs11.pyx":1725
 *     def _sign(self, data,
 *               mechanism=None, mechanism_param=None, pin=None, buffer_size=8192):
 *         cdef Session session = self.session             # <<<<<<<<<<<<<<
 *         cdef CK_BYTE *data_ptr = data
 *         cdef CK_ULONG data_len = <CK_ULONG> len(data)
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_session); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Session))))) __PYX_ERR(0, 1725, __pyx_L1_error)
  __pyx_v_session = ((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1726
 *               mechanism=None, mechanism_param=None, pin=None, buffer_size=8192):
 *         cdef Session session = self.session
 *         cdef CK_BYTE *data_ptr = data             # <<<<<<<<<<<<<<
 *         cdef CK_ULONG data_len = <CK_ULONG> len(data)
 *         cdef DataSignOperation op = self.__sign_operation(mechanism, mechanism_param, buffer_size)
*/
  __pyx_t_2 = __Pyx_PyObject_AsWritableUString(__pyx_v_data); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 1726, __pyx_L1_error)
  __pyx_v_data_ptr = __pyx_t_2;

  /* "pkcs11/_pkcs11.pyx":1727
 *         cdef Session session = self.session
 *         cdef CK_BYTE *data_ptr = data
 *         cdef CK_ULONG data_len = <CK_ULONG> len(data)             # <<<<<<<<<<<<<<
 *         cdef DataSignOperation op = self.__sign_operation(mechanism, mechanism_param, buffer_size)
 * 
*/
  __pyx_t_3 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1727, __pyx_L1_error)
  __pyx_v_data_len = ((CK_ULONG)__pyx_t_3);

  /* "pkcs11/_pkcs11.pyx":1728
 *         cdef CK_BYTE *data_ptr = data
 *         cdef CK_ULONG data_len = <CK_ULONG> len(data)
 *         cdef DataSignOperation op = self.__sign_operation(mechanism, mechanism_param, buffer_size)             # <<<<<<<<<<<<<<
 * 
 *         with op:
*/
  __pyx_t_4 = __pyx_v_self;
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_4, __pyx_v_mechanism, __pyx_v_mechanism_param, __pyx_v_buffer_size};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_SignMixin__sign_operation, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1728, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_DataSignOperation))))) __PYX_ERR(0, 1728, __pyx_L1_error)
  __pyx_v_op = ((struct __pyx_obj_6pkcs11_7_pkcs11_DataSignOperation *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1730
 *         cdef DataSignOperation op = self.__sign_operation(mechanism, mechanism_param, buffer_size)
 * 
 *         with op:             # <<<<<<<<<<<<<<
 *             if pin is not None:
 *                 session.reaffirm_credentials(pin)
*/
  /*with:*/ {
    __pyx_t_6 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_op), __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1730, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = NULL;
    __pyx_t_7 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_op), __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1730, __pyx_L3_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1730, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    /*try:*/ {
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_10);
        /*try:*/ {

          /* "pkcs11/_pkcs11.pyx":1731
 * 
 *         with op:
 *             if pin is not None:             # <<<<<<<<<<<<<<
 *                 session.reaffirm_credentials(pin)
 *             return op.sign_process_fully(data, data_len)
*/
          __pyx_t_11 = (__pyx_v_pin != Py_None);
          if (__pyx_t_11) {

            /* "pkcs11/_pkcs11.pyx":1732
 *         with op:
 *             if pin is not None:
 *                 session.reaffirm_credentials(pin)             # <<<<<<<<<<<<<<
 *             return op.sign_process_fully(data, data_len)
 * 
*/
            __pyx_t_7 = ((PyObject *)__pyx_v_session);
            __Pyx_INCREF(__pyx_t_7);
            __pyx_t_5 = 0;
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_pin};
              __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reaffirm_credentials, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
              if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1732, __pyx_L7_error)
              __Pyx_GOTREF(__pyx_t_1);
            }
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

            /* "pkcs11/_pkcs11.pyx":1731
 * 
 *         with op:
 *             if pin is not None:             # <<<<<<<<<<<<<<
 *                 session.reaffirm_credentials(pin)
 *             return op.sign_process_fully(data, data_len)
*/
          }

          /* "pkcs11/_pkcs11.pyx":1733
 *             if pin is not None:
 *                 session.reaffirm_credentials(pin)
 *             return op.sign_process_fully(data, data_len)             # <<<<<<<<<<<<<<
 * 
 *     def _sign_generator(self, data,
*/
          __Pyx_XDECREF(__pyx_r);
          __pyx_t_2 = __Pyx_PyObject_AsWritableUString(__pyx_v_data); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 1733, __pyx_L7_error)
          __pyx_t_1 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DataSignOperation *)__pyx_v_op->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->sign_process_fully(__pyx_v_op, __pyx_t_2, __pyx_v_data_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1733, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_r = __pyx_t_1;
          __pyx_t_1 = 0;
          goto __pyx_L11_try_return;

          /* "pkcs11/_pkcs11.pyx":1730
 *         cdef DataSignOperation op = self.__sign_operation(mechanism, mechanism_param, buffer_size)
 * 
 *         with op:             # <<<<<<<<<<<<<<
 *             if pin is not None:
 *                 session.reaffirm_credentials(pin)
*/
        }
        __pyx_L7_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        /*except:*/ {
          __Pyx_AddTraceback("pkcs11._pkcs11.SignMixin._sign", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_7, &__pyx_t_4) < 0) __PYX_ERR(0, 1730, __pyx_L9_except_error)
          __Pyx_XGOTREF(__pyx_t_1);
          __Pyx_XGOTREF(__pyx_t_7);
          __Pyx_XGOTREF(__pyx_t_4);
          __pyx_t_12 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1730, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_12, NULL);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1730, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          if (__pyx_t_11 < (0)) __PYX_ERR(0, 1730, __pyx_L9_except_error)
          __pyx_t_14 = (!__pyx_t_11);
          if (unlikely(__pyx_t_14)) {
            __Pyx_GIVEREF(__pyx_t_1);
            __Pyx_GIVEREF(__pyx_t_7);
            __Pyx_XGIVEREF(__pyx_t_4);
            __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_7, __pyx_t_4);
            __pyx_t_1 = 0;  __pyx_t_7 = 0;  __pyx_t_4 = 0; 
            __PYX_ERR(0, 1730, __pyx_L9_except_error)
          }
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          goto __pyx_L8_exception_handled;
        }
        __pyx_L9_except_error:;
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        goto __pyx_L1_error;
        __pyx_L11_try_return:;
        __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_L4_return;
        __pyx_L8_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);
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_6) {
          __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_mstate_global->__pyx_tuple[2], NULL);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1730, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        }
        goto __pyx_L6;
      }
      __pyx_L4_return: {
        __pyx_t_10 = __pyx_r;
        __pyx_r = 0;
        if (__pyx_t_6) {
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_mstate_global->__pyx_tuple[2], NULL);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1730, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        }
        __pyx_r = __pyx_t_10;
        __pyx_t_10 = 0;
        goto __pyx_L0;
      }
      __pyx_L6:;
    }
    goto __pyx_L17;
    __pyx_L3_error:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L1_error;
    __pyx_L17:;
  }

  /* "pkcs11/_pkcs11.pyx":1723
 *         return DataSignOperation.setup(self.session, mech, self.handle, buffer_size)
 * 
 *     def _sign(self, data,             # <<<<<<<<<<<<<<
 *               mechanism=None, mechanism_param=None, pin=None, buffer_size=8192):
 *         cdef Session session = self.session
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("pkcs11._pkcs11.SignMixin._sign", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_session);
  __Pyx_XDECREF((PyObject *)__pyx_v_op);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1735
 *             return op.sign_process_fully(data, data_len)
 * 
 *     def _sign_generator(self, data,             # <<<<<<<<<<<<<<
 *                         mechanism=None, mechanism_param=None, pin=None, buffer_size=8192):
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_9SignMixin_5_sign_generator(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_9SignMixin_5_sign_generator = {"_sign_generator", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_9SignMixin_5_sign_generator, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_9SignMixin_5_sign_generator(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_data = 0;
  PyObject *__pyx_v_mechanism = 0;
  PyObject *__pyx_v_mechanism_param = 0;
  PyObject *__pyx_v_pin = 0;
  PyObject *__pyx_v_buffer_size = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[6] = {0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_sign_generator (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_data,&__pyx_mstate_global->__pyx_n_u_mechanism,&__pyx_mstate_global->__pyx_n_u_mechanism_param,&__pyx_mstate_global->__pyx_n_u_pin,&__pyx_mstate_global->__pyx_n_u_buffer_size,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1735, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 1735, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1735, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1735, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1735, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1735, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1735, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_sign_generator", 0) < (0)) __PYX_ERR(0, 1735, __pyx_L3_error)

      /* "pkcs11/_pkcs11.pyx":1736
 * 
 *     def _sign_generator(self, data,
 *                         mechanism=None, mechanism_param=None, pin=None, buffer_size=8192):             # <<<<<<<<<<<<<<
 * 
 *         cdef Session session = self.session
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_8192)));
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_sign_generator", 0, 2, 6, i); __PYX_ERR(0, 1735, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 1735, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1735, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1735, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1735, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1735, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1735, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_8192)));
    }
    __pyx_v_self = values[0];
    __pyx_v_data = values[1];
    __pyx_v_mechanism = values[2];
    __pyx_v_mechanism_param = values[3];
    __pyx_v_pin = values[4];
    __pyx_v_buffer_size = values[5];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_sign_generator", 0, 2, 6, __pyx_nargs); __PYX_ERR(0, 1735, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.SignMixin._sign_generator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_9SignMixin_4_sign_generator(__pyx_self, __pyx_v_self, __pyx_v_data, __pyx_v_mechanism, __pyx_v_mechanism_param, __pyx_v_pin, __pyx_v_buffer_size);

  /* "pkcs11/_pkcs11.pyx":1735
 *             return op.sign_process_fully(data, data_len)
 * 
 *     def _sign_generator(self, data,             # <<<<<<<<<<<<<<
 *                         mechanism=None, mechanism_param=None, pin=None, buffer_size=8192):
 * 
*/

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_9SignMixin_4_sign_generator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param, PyObject *__pyx_v_pin, PyObject *__pyx_v_buffer_size) {
  struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session = 0;
  struct __pyx_obj_6pkcs11_7_pkcs11_DataSignOperation *__pyx_v_op = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_sign_generator", 0);

  /* "pkcs11/_pkcs11.pyx":1738
 *                         mechanism=None, mechanism_param=None, pin=None, buffer_size=8192):
 * 
 *         cdef Session session = self.session             # <<<<<<<<<<<<<<
 *         cdef DataSignOperation op = self.__sign_operation(mechanism, mechanism_param, buffer_size)
 *         with op:
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_session); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1738, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Session))))) __PYX_ERR(0, 1738, __pyx_L1_error)
  __pyx_v_session = ((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1739
 * 
 *         cdef Session session = self.session
 *         cdef DataSignOperation op = self.__sign_operation(mechanism, mechanism_param, buffer_size)             # <<<<<<<<<<<<<<
 *         with op:
 *             if pin is not None:
*/
  __pyx_t_2 = __pyx_v_self;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_mechanism, __pyx_v_mechanism_param, __pyx_v_buffer_size};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_SignMixin__sign_operation, __pyx_callargs+__pyx_t_3, (4-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1739, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_DataSignOperation))))) __PYX_ERR(0, 1739, __pyx_L1_error)
  __pyx_v_op = ((struct __pyx_obj_6pkcs11_7_pkcs11_DataSignOperation *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1740
 *         cdef Session session = self.session
 *         cdef DataSignOperation op = self.__sign_operation(mechanism, mechanism_param, buffer_size)
 *         with op:             # <<<<<<<<<<<<<<
 *             if pin is not None:
 *                 session.reaffirm_credentials(pin)
*/
  /*with:*/ {
    __pyx_t_4 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_op), __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1740, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = NULL;
    __pyx_t_5 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_op), __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1740, __pyx_L3_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_3 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1740, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    /*try:*/ {
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        /*try:*/ {

          /* "pkcs11/_pkcs11.pyx":1741
 *         cdef DataSignOperation op = self.__sign_operation(mechanism, mechanism_param, buffer_size)
 *         with op:
 *             if pin is not None:             # <<<<<<<<<<<<<<
 *                 session.reaffirm_credentials(pin)
 *             op.ingest_chunks(data)
*/
          __pyx_t_9 = (__pyx_v_pin != Py_None);
          if (__pyx_t_9) {

            /* "pkcs11/_pkcs11.pyx":1742
 *         with op:
 *             if pin is not None:
 *                 session.reaffirm_credentials(pin)             # <<<<<<<<<<<<<<
 *             op.ingest_chunks(data)
 *             return op.finish()
*/
            __pyx_t_5 = ((PyObject *)__pyx_v_session);
            __Pyx_INCREF(__pyx_t_5);
            __pyx_t_3 = 0;
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_pin};
              __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reaffirm_credentials, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
              if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1742, __pyx_L7_error)
              __Pyx_GOTREF(__pyx_t_1);
            }
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

            /* "pkcs11/_pkcs11.pyx":1741
 *         cdef DataSignOperation op = self.__sign_operation(mechanism, mechanism_param, buffer_size)
 *         with op:
 *             if pin is not None:             # <<<<<<<<<<<<<<
 *                 session.reaffirm_credentials(pin)
 *             op.ingest_chunks(data)
*/
          }

          /* "pkcs11/_pkcs11.pyx":1743
 *             if pin is not None:
 *                 session.reaffirm_credentials(pin)
 *             op.ingest_chunks(data)             # <<<<<<<<<<<<<<
 *             return op.finish()
 * 
*/
          __pyx_t_5 = ((PyObject *)__pyx_v_op);
          __Pyx_INCREF(__pyx_t_5);
          __pyx_t_3 = 0;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_data};
            __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_ingest_chunks, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1743, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_1);
          }
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

          /* "pkcs11/_pkcs11.pyx":1744
 *                 session.reaffirm_credentials(pin)
 *             op.ingest_chunks(data)
 *             return op.finish()             # <<<<<<<<<<<<<<
 * 
 * 
*/
          __Pyx_XDECREF(__pyx_r);
          __pyx_t_1 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DataSignOperation *)__pyx_v_op->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->finish(__pyx_v_op); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1744, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_r = __pyx_t_1;
          __pyx_t_1 = 0;
          goto __pyx_L11_try_return;

          /* "pkcs11/_pkcs11.pyx":1740
 *         cdef Session session = self.session
 *         cdef DataSignOperation op = self.__sign_operation(mechanism, mechanism_param, buffer_size)
 *         with op:             # <<<<<<<<<<<<<<
 *             if pin is not None:
 *                 session.reaffirm_credentials(pin)
*/
        }
        __pyx_L7_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        /*except:*/ {
          __Pyx_AddTraceback("pkcs11._pkcs11.SignMixin._sign_generator", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_2) < 0) __PYX_ERR(0, 1740, __pyx_L9_except_error)
          __Pyx_XGOTREF(__pyx_t_1);
          __Pyx_XGOTREF(__pyx_t_5);
          __Pyx_XGOTREF(__pyx_t_2);
          __pyx_t_10 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1740, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1740, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          if (__pyx_t_9 < (0)) __PYX_ERR(0, 1740, __pyx_L9_except_error)
          __pyx_t_12 = (!__pyx_t_9);
          if (unlikely(__pyx_t_12)) {
            __Pyx_GIVEREF(__pyx_t_1);
            __Pyx_GIVEREF(__pyx_t_5);
            __Pyx_XGIVEREF(__pyx_t_2);
            __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_5, __pyx_t_2);
            __pyx_t_1 = 0;  __pyx_t_5 = 0;  __pyx_t_2 = 0; 
            __PYX_ERR(0, 1740, __pyx_L9_except_error)
          }
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          goto __pyx_L8_exception_handled;
        }
        __pyx_L9_except_error:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        goto __pyx_L1_error;
        __pyx_L11_try_return:;
        __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_L4_return;
        __pyx_L8_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_4) {
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[2], NULL);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1740, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        goto __pyx_L6;
      }
      __pyx_L4_return: {
        __pyx_t_8 = __pyx_r;
        __pyx_r = 0;
        if (__pyx_t_4) {
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[2], NULL);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1740, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
        __pyx_r = __pyx_t_8;
        __pyx_t_8 = 0;
        goto __pyx_L0;
      }
      __pyx_L6:;
    }
    goto __pyx_L17;
    __pyx_L3_error:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L1_error;
    __pyx_L17:;
  }

  /* "pkcs11/_pkcs11.pyx":1735
 *             return op.sign_process_fully(data, data_len)
 * 
 *     def _sign_generator(self, data,             # <<<<<<<<<<<<<<
 *                         mechanism=None, mechanism_param=None, pin=None, buffer_size=8192):
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("pkcs11._pkcs11.SignMixin._sign_generator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_session);
  __Pyx_XDECREF((PyObject *)__pyx_v_op);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1749
 * cdef class DataVerifyOperation(SignOrVerifyOperation):
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef DataVerifyOperation setup(
 *             Session session,
*/

static struct __pyx_obj_6pkcs11_7_pkcs11_DataVerifyOperation *__pyx_f_6pkcs11_7_pkcs11_19DataVerifyOperation_setup(struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_mech, CK_OBJECT_HANDLE __pyx_v_key) {
  struct __pyx_obj_6pkcs11_7_pkcs11_DataVerifyOperation *__pyx_v_op = 0;
  struct __pyx_obj_6pkcs11_7_pkcs11_DataVerifyOperation *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  CK_RV (*__pyx_t_3)(CK_SESSION_HANDLE, CK_MECHANISM *, CK_OBJECT_HANDLE);
  CK_RV (*__pyx_t_4)(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("setup", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_session);
  __Pyx_INCREF((PyObject *)__pyx_v_mech);

  /* "pkcs11/_pkcs11.pyx":1755
 *             CK_OBJECT_HANDLE key
 *     ) with gil:
 *         cdef DataVerifyOperation op = <DataVerifyOperation> KeyOperation._common_key_setup(             # <<<<<<<<<<<<<<
 *             DataVerifyOperation, session, mech, key, 0
 *         )
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_6pkcs11_7_pkcs11_12KeyOperation__common_key_setup(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_DataVerifyOperation, __pyx_v_session, __pyx_v_mech, __pyx_v_key, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1755, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_op = ((struct __pyx_obj_6pkcs11_7_pkcs11_DataVerifyOperation *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pkcs11/_pkcs11.pyx":1758
 *             DataVerifyOperation, session, mech, key, 0
 *         )
 *         op.op_init = session.funclist.C_VerifyInit             # <<<<<<<<<<<<<<
 *         op.op_update = session.funclist.C_VerifyUpdate
 *         return op
*/
  __pyx_t_3 = __pyx_v_session->__pyx_base.funclist->C_VerifyInit;
  __pyx_v_op->__pyx_base.__pyx_base.op_init = __pyx_t_3;

  /* "pkcs11/_pkcs11.pyx":1759
 *         )
 *         op.op_init = session.funclist.C_VerifyInit
 *         op.op_update = session.funclist.C_VerifyUpdate             # <<<<<<<<<<<<<<
 *         return op
 * 
*/
  __pyx_t_4 = __pyx_v_session->__pyx_base.funclist->C_VerifyUpdate;
  __pyx_v_op->__pyx_base.op_update = __pyx_t_4;

  /* "pkcs11/_pkcs11.pyx":1760
 *         op.op_init = session.funclist.C_VerifyInit
 *         op.op_update = session.funclist.C_VerifyUpdate
 *         return op             # <<<<<<<<<<<<<<
 * 
 *     cdef verify_process_fully(
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_op);
  __pyx_r = __pyx_v_op;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":1749
 * cdef class DataVerifyOperation(SignOrVerifyOperation):
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef DataVerifyOperation setup(
 *             Session session,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pkcs11._pkcs11.DataVerifyOperation.setup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_op);
  __Pyx_XDECREF((PyObject *)__pyx_v_session);
  __Pyx_XDECREF((PyObject *)__pyx_v_mech);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1762
 *         return op
 * 
 *     cdef verify_process_fully(             # <<<<<<<<<<<<<<
 *         self,
 *         CK_BYTE *data,
*/

static PyObject *__pyx_f_6pkcs11_7_pkcs11_19DataVerifyOperation_verify_process_fully(struct __pyx_obj_6pkcs11_7_pkcs11_DataVerifyOperation *__pyx_v_self, CK_BYTE *__pyx_v_data, CK_ULONG __pyx_v_data_len, CK_BYTE *__pyx_v_sig, CK_ULONG __pyx_v_sig_len) {
  struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session = 0;
  CK_RV __pyx_v_retval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("verify_process_fully", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_self);

  /* "pkcs11/_pkcs11.pyx":1769
 *         CK_ULONG sig_len,
 *     ) with gil:
 *         cdef Session session = self.session             # <<<<<<<<<<<<<<
 *         cdef CK_RV retval
 *         with nogil:
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base.session);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_session = ((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1771
 *         cdef Session session = self.session
 *         cdef CK_RV retval
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = session.funclist.C_Verify(session.handle, data, data_len, sig, sig_len)
 *         self._handle_final_retval(retval)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":1772
 *         cdef CK_RV retval
 *         with nogil:
 *             retval = session.funclist.C_Verify(session.handle, data, data_len, sig, sig_len)             # <<<<<<<<<<<<<<
 *         self._handle_final_retval(retval)
 * 
*/
        __pyx_v_retval = __pyx_v_session->__pyx_base.funclist->C_Verify(__pyx_v_session->handle, __pyx_v_data, __pyx_v_data_len, __pyx_v_sig, __pyx_v_sig_len);
      }

      /* "pkcs11/_pkcs11.pyx":1771
 *         cdef Session session = self.session
 *         cdef CK_RV retval
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = session.funclist.C_Verify(session.handle, data, data_len, sig, sig_len)
 *         self._handle_final_retval(retval)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":1773
 *         with nogil:
 *             retval = session.funclist.C_Verify(session.handle, data, data_len, sig, sig_len)
 *         self._handle_final_retval(retval)             # <<<<<<<<<<<<<<
 * 
 *     cdef finish(self, CK_BYTE *sig, CK_ULONG sig_len) with gil:
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DataVerifyOperation *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base.__pyx_base._handle_final_retval(((struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *)__pyx_v_self), __pyx_v_retval); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1773, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1762
 *         return op
 * 
 *     cdef verify_process_fully(             # <<<<<<<<<<<<<<
 *         self,
 *         CK_BYTE *data,
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pkcs11._pkcs11.DataVerifyOperation.verify_process_fully", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_session);
  __Pyx_XDECREF((PyObject *)__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1775
 *         self._handle_final_retval(retval)
 * 
 *     cdef finish(self, CK_BYTE *sig, CK_ULONG sig_len) with gil:             # <<<<<<<<<<<<<<
 *         cdef Session session = self.session
 *         cdef CK_RV retval
*/

static PyObject *__pyx_f_6pkcs11_7_pkcs11_19DataVerifyOperation_finish(struct __pyx_obj_6pkcs11_7_pkcs11_DataVerifyOperation *__pyx_v_self, CK_BYTE *__pyx_v_sig, CK_ULONG __pyx_v_sig_len) {
  struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session = 0;
  CK_RV __pyx_v_retval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("finish", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_self);

  /* "pkcs11/_pkcs11.pyx":1776
 * 
 *     cdef finish(self, CK_BYTE *sig, CK_ULONG sig_len) with gil:
 *         cdef Session session = self.session             # <<<<<<<<<<<<<<
 *         cdef CK_RV retval
 *         with nogil:
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base.session);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_session = ((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1778
 *         cdef Session session = self.session
 *         cdef CK_RV retval
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = session.funclist.C_VerifyFinal(session.handle, sig, sig_len)
 *         self._handle_final_retval(retval)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":1779
 *         cdef CK_RV retval
 *         with nogil:
 *             retval = session.funclist.C_VerifyFinal(session.handle, sig, sig_len)             # <<<<<<<<<<<<<<
 *         self._handle_final_retval(retval)
 * 
*/
        __pyx_v_retval = __pyx_v_session->__pyx_base.funclist->C_VerifyFinal(__pyx_v_session->handle, __pyx_v_sig, __pyx_v_sig_len);
      }

      /* "pkcs11/_pkcs11.pyx":1778
 *         cdef Session session = self.session
 *         cdef CK_RV retval
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = session.funclist.C_VerifyFinal(session.handle, sig, sig_len)
 *         self._handle_final_retval(retval)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":1780
 *         with nogil:
 *             retval = session.funclist.C_VerifyFinal(session.handle, sig, sig_len)
 *         self._handle_final_retval(retval)             # <<<<<<<<<<<<<<
 * 
 *     def unclean_shutdown(self):
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DataVerifyOperation *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base.__pyx_base._handle_final_retval(((struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *)__pyx_v_self), __pyx_v_retval); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1780, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1775
 *         self._handle_final_retval(retval)
 * 
 *     cdef finish(self, CK_BYTE *sig, CK_ULONG sig_len) with gil:             # <<<<<<<<<<<<<<
 *         cdef Session session = self.session
 *         cdef CK_RV retval
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pkcs11._pkcs11.DataVerifyOperation.finish", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_session);
  __Pyx_XDECREF((PyObject *)__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1782
 *         self._handle_final_retval(retval)
 * 
 *     def unclean_shutdown(self):             # <<<<<<<<<<<<<<
 *         cdef Session session = self.session
 *         cdef CK_BYTE dummy = 0
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_19DataVerifyOperation_1unclean_shutdown(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_19DataVerifyOperation_1unclean_shutdown = {"unclean_shutdown", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_19DataVerifyOperation_1unclean_shutdown, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_19DataVerifyOperation_1unclean_shutdown(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("unclean_shutdown (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("unclean_shutdown", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("unclean_shutdown", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_19DataVerifyOperation_unclean_shutdown(((struct __pyx_obj_6pkcs11_7_pkcs11_DataVerifyOperation *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_19DataVerifyOperation_unclean_shutdown(struct __pyx_obj_6pkcs11_7_pkcs11_DataVerifyOperation *__pyx_v_self) {
  struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session = 0;
  CK_BYTE __pyx_v_dummy;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("unclean_shutdown", 0);

  /* "pkcs11/_pkcs11.pyx":1783
 * 
 *     def unclean_shutdown(self):
 *         cdef Session session = self.session             # <<<<<<<<<<<<<<
 *         cdef CK_BYTE dummy = 0
 *         with nogil:
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base.session);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_session = ((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1784
 *     def unclean_shutdown(self):
 *         cdef Session session = self.session
 *         cdef CK_BYTE dummy = 0             # <<<<<<<<<<<<<<
 *         with nogil:
 *             session.funclist.C_VerifyFinal(session.handle, &dummy, 0)
*/
  __pyx_v_dummy = 0;

  /* "pkcs11/_pkcs11.pyx":1785
 *         cdef Session session = self.session
 *         cdef CK_BYTE dummy = 0
 *         with nogil:             # <<<<<<<<<<<<<<
 *             session.funclist.C_VerifyFinal(session.handle, &dummy, 0)
 * 
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":1786
 *         cdef CK_BYTE dummy = 0
 *         with nogil:
 *             session.funclist.C_VerifyFinal(session.handle, &dummy, 0)             # <<<<<<<<<<<<<<
 * 
 * 
*/
        (void)(__pyx_v_session->__pyx_base.funclist->C_VerifyFinal(__pyx_v_session->handle, (&__pyx_v_dummy), 0));
      }

      /* "pkcs11/_pkcs11.pyx":1785
 *         cdef Session session = self.session
 *         cdef CK_BYTE dummy = 0
 *         with nogil:             # <<<<<<<<<<<<<<
 *             session.funclist.C_VerifyFinal(session.handle, &dummy, 0)
 * 
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":1782
 *         self._handle_final_retval(retval)
 * 
 *     def unclean_shutdown(self):             # <<<<<<<<<<<<<<
 *         cdef Session session = self.session
 *         cdef CK_BYTE dummy = 0
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XDECREF((PyObject *)__pyx_v_session);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_19DataVerifyOperation_3__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_19DataVerifyOperation_3__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_19DataVerifyOperation_3__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_19DataVerifyOperation_3__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_19DataVerifyOperation_2__reduce_cython__(((struct __pyx_obj_6pkcs11_7_pkcs11_DataVerifyOperation *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_19DataVerifyOperation_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_DataVerifyOperation *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 2, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.DataVerifyOperation.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_19DataVerifyOperation_5__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_19DataVerifyOperation_5__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_19DataVerifyOperation_5__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_19DataVerifyOperation_5__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.DataVerifyOperation.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_19DataVerifyOperation_4__setstate_cython__(((struct __pyx_obj_6pkcs11_7_pkcs11_DataVerifyOperation *)__pyx_v_self), __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_19DataVerifyOperation_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_DataVerifyOperation *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 4, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.DataVerifyOperation.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1792
 *     """Expand VerifyMixin with an implementation."""
 * 
 *     def __verify_operation(self, mechanism, mechanism_param):             # <<<<<<<<<<<<<<
 *         mech = MechanismWithParam(self.key_type, DEFAULT_SIGN_MECHANISMS, mechanism, mechanism_param)
 *         return DataVerifyOperation.setup(self.session, mech, self.handle)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_11VerifyMixin_1__verify_operation(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_11VerifyMixin_1__verify_operation = {"__verify_operation", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_11VerifyMixin_1__verify_operation, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_11VerifyMixin_1__verify_operation(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_mechanism = 0;
  PyObject *__pyx_v_mechanism_param = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__verify_operation (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_mechanism,&__pyx_mstate_global->__pyx_n_u_mechanism_param,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1792, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1792, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1792, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1792, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__verify_operation", 0) < (0)) __PYX_ERR(0, 1792, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__verify_operation", 1, 3, 3, i); __PYX_ERR(0, 1792, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1792, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1792, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1792, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_mechanism = values[1];
    __pyx_v_mechanism_param = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__verify_operation", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 1792, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.VerifyMixin.__verify_operation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_11VerifyMixin___verify_operation(__pyx_self, __pyx_v_self, __pyx_v_mechanism, __pyx_v_mechanism_param);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_11VerifyMixin___verify_operation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param) {
  struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_mech = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  CK_OBJECT_HANDLE __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__verify_operation", 0);

  /* "pkcs11/_pkcs11.pyx":1793
 * 
 *     def __verify_operation(self, mechanism, mechanism_param):
 *         mech = MechanismWithParam(self.key_type, DEFAULT_SIGN_MECHANISMS, mechanism, mechanism_param)             # <<<<<<<<<<<<<<
 *         return DataVerifyOperation.setup(self.session, mech, self.handle)
 * 
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_key_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1793, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_DEFAULT_SIGN_MECHANISMS); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1793, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[5] = {__pyx_t_2, __pyx_t_3, __pyx_t_4, __pyx_v_mechanism, __pyx_v_mechanism_param};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_MechanismWithParam, __pyx_callargs+__pyx_t_5, (5-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1793, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_mech = ((struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1794
 *     def __verify_operation(self, mechanism, mechanism_param):
 *         mech = MechanismWithParam(self.key_type, DEFAULT_SIGN_MECHANISMS, mechanism, mechanism_param)
 *         return DataVerifyOperation.setup(self.session, mech, self.handle)             # <<<<<<<<<<<<<<
 * 
 *     def _verify(self, data, signature,
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_session); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1794, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Session))))) __PYX_ERR(0, 1794, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_handle); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1794, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyLong_As_CK_ULONG(__pyx_t_4); if (unlikely((__pyx_t_6 == ((CK_OBJECT_HANDLE)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1794, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = ((PyObject *)__pyx_f_6pkcs11_7_pkcs11_19DataVerifyOperation_setup(((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_t_1), __pyx_v_mech, __pyx_t_6)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1794, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":1792
 *     """Expand VerifyMixin with an implementation."""
 * 
 *     def __verify_operation(self, mechanism, mechanism_param):             # <<<<<<<<<<<<<<
 *         mech = MechanismWithParam(self.key_type, DEFAULT_SIGN_MECHANISMS, mechanism, mechanism_param)
 *         return DataVerifyOperation.setup(self.session, mech, self.handle)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pkcs11._pkcs11.VerifyMixin.__verify_operation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mech);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1796
 *         return DataVerifyOperation.setup(self.session, mech, self.handle)
 * 
 *     def _verify(self, data, signature,             # <<<<<<<<<<<<<<
 *                 mechanism=None, mechanism_param=None):
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_11VerifyMixin_3_verify(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_11VerifyMixin_3_verify = {"_verify", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_11VerifyMixin_3_verify, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_11VerifyMixin_3_verify(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_data = 0;
  PyObject *__pyx_v_signature = 0;
  PyObject *__pyx_v_mechanism = 0;
  PyObject *__pyx_v_mechanism_param = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_verify (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_data,&__pyx_mstate_global->__pyx_n_u_signature,&__pyx_mstate_global->__pyx_n_u_mechanism,&__pyx_mstate_global->__pyx_n_u_mechanism_param,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1796, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1796, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1796, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1796, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1796, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1796, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_verify", 0) < (0)) __PYX_ERR(0, 1796, __pyx_L3_error)

      /* "pkcs11/_pkcs11.pyx":1797
 * 
 *     def _verify(self, data, signature,
 *                 mechanism=None, mechanism_param=None):             # <<<<<<<<<<<<<<
 * 
 *         cdef CK_BYTE *data_ptr = data
*/
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_verify", 0, 3, 5, i); __PYX_ERR(0, 1796, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1796, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1796, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1796, __pyx_L3_error)
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1796, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1796, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_self = values[0];
    __pyx_v_data = values[1];
    __pyx_v_signature = values[2];
    __pyx_v_mechanism = values[3];
    __pyx_v_mechanism_param = values[4];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_verify", 0, 3, 5, __pyx_nargs); __PYX_ERR(0, 1796, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.VerifyMixin._verify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_11VerifyMixin_2_verify(__pyx_self, __pyx_v_self, __pyx_v_data, __pyx_v_signature, __pyx_v_mechanism, __pyx_v_mechanism_param);

  /* "pkcs11/_pkcs11.pyx":1796
 *         return DataVerifyOperation.setup(self.session, mech, self.handle)
 * 
 *     def _verify(self, data, signature,             # <<<<<<<<<<<<<<
 *                 mechanism=None, mechanism_param=None):
 * 
*/

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_11VerifyMixin_2_verify(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_signature, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param) {
  CK_BYTE *__pyx_v_data_ptr;
  CK_ULONG __pyx_v_data_len;
  CK_BYTE *__pyx_v_sig_ptr;
  CK_ULONG __pyx_v_sig_len;
  struct __pyx_obj_6pkcs11_7_pkcs11_DataVerifyOperation *__pyx_v_op = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  CK_BYTE *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_verify", 0);

  /* "pkcs11/_pkcs11.pyx":1799
 *                 mechanism=None, mechanism_param=None):
 * 
 *         cdef CK_BYTE *data_ptr = data             # <<<<<<<<<<<<<<
 *         cdef CK_ULONG data_len = <CK_ULONG> len(data)
 *         cdef CK_BYTE *sig_ptr = signature
*/
  __pyx_t_1 = __Pyx_PyObject_AsWritableUString(__pyx_v_data); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 1799, __pyx_L1_error)
  __pyx_v_data_ptr = __pyx_t_1;

  /* "pkcs11/_pkcs11.pyx":1800
 * 
 *         cdef CK_BYTE *data_ptr = data
 *         cdef CK_ULONG data_len = <CK_ULONG> len(data)             # <<<<<<<<<<<<<<
 *         cdef CK_BYTE *sig_ptr = signature
 *         cdef CK_ULONG sig_len = <CK_ULONG> len(signature)
*/
  __pyx_t_2 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1800, __pyx_L1_error)
  __pyx_v_data_len = ((CK_ULONG)__pyx_t_2);

  /* "pkcs11/_pkcs11.pyx":1801
 *         cdef CK_BYTE *data_ptr = data
 *         cdef CK_ULONG data_len = <CK_ULONG> len(data)
 *         cdef CK_BYTE *sig_ptr = signature             # <<<<<<<<<<<<<<
 *         cdef CK_ULONG sig_len = <CK_ULONG> len(signature)
 *         cdef DataVerifyOperation op = self.__verify_operation(mechanism, mechanism_param)
*/
  __pyx_t_1 = __Pyx_PyObject_AsWritableUString(__pyx_v_signature); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 1801, __pyx_L1_error)
  __pyx_v_sig_ptr = __pyx_t_1;

  /* "pkcs11/_pkcs11.pyx":1802
 *         cdef CK_ULONG data_len = <CK_ULONG> len(data)
 *         cdef CK_BYTE *sig_ptr = signature
 *         cdef CK_ULONG sig_len = <CK_ULONG> len(signature)             # <<<<<<<<<<<<<<
 *         cdef DataVerifyOperation op = self.__verify_operation(mechanism, mechanism_param)
 * 
*/
  __pyx_t_2 = PyObject_Length(__pyx_v_signature); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1802, __pyx_L1_error)
  __pyx_v_sig_len = ((CK_ULONG)__pyx_t_2);

  /* "pkcs11/_pkcs11.pyx":1803
 *         cdef CK_BYTE *sig_ptr = signature
 *         cdef CK_ULONG sig_len = <CK_ULONG> len(signature)
 *         cdef DataVerifyOperation op = self.__verify_operation(mechanism, mechanism_param)             # <<<<<<<<<<<<<<
 * 
 *         with op:
*/
  __pyx_t_4 = __pyx_v_self;
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_mechanism, __pyx_v_mechanism_param};
    __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_VerifyMixin__verify_operation, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1803, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_DataVerifyOperation))))) __PYX_ERR(0, 1803, __pyx_L1_error)
  __pyx_v_op = ((struct __pyx_obj_6pkcs11_7_pkcs11_DataVerifyOperation *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pkcs11/_pkcs11.pyx":1805
 *         cdef DataVerifyOperation op = self.__verify_operation(mechanism, mechanism_param)
 * 
 *         with op:             # <<<<<<<<<<<<<<
 *             op.verify_process_fully(data_ptr, data_len, sig_ptr, sig_len)
 * 
*/
  /*with:*/ {
    __pyx_t_6 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_op), __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1805, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = NULL;
    __pyx_t_7 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_op), __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1805, __pyx_L3_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1805, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    /*try:*/ {
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_10);
        /*try:*/ {

          /* "pkcs11/_pkcs11.pyx":1806
 * 
 *         with op:
 *             op.verify_process_fully(data_ptr, data_len, sig_ptr, sig_len)             # <<<<<<<<<<<<<<
 * 
 *     def _verify_generator(self, data, signature,
*/
          __pyx_t_3 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DataVerifyOperation *)__pyx_v_op->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->verify_process_fully(__pyx_v_op, __pyx_v_data_ptr, __pyx_v_data_len, __pyx_v_sig_ptr, __pyx_v_sig_len); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1806, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

          /* "pkcs11/_pkcs11.pyx":1805
 *         cdef DataVerifyOperation op = self.__verify_operation(mechanism, mechanism_param)
 * 
 *         with op:             # <<<<<<<<<<<<<<
 *             op.verify_process_fully(data_ptr, data_len, sig_ptr, sig_len)
 * 
*/
        }
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L12_try_end;
        __pyx_L7_error:;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        /*except:*/ {
          __Pyx_AddTraceback("pkcs11._pkcs11.VerifyMixin._verify", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_7, &__pyx_t_4) < 0) __PYX_ERR(0, 1805, __pyx_L9_except_error)
          __Pyx_XGOTREF(__pyx_t_3);
          __Pyx_XGOTREF(__pyx_t_7);
          __Pyx_XGOTREF(__pyx_t_4);
          __pyx_t_11 = PyTuple_Pack(3, __pyx_t_3, __pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1805, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_11, NULL);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1805, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          if (__pyx_t_13 < (0)) __PYX_ERR(0, 1805, __pyx_L9_except_error)
          __pyx_t_14 = (!__pyx_t_13);
          if (unlikely(__pyx_t_14)) {
            __Pyx_GIVEREF(__pyx_t_3);
            __Pyx_GIVEREF(__pyx_t_7);
            __Pyx_XGIVEREF(__pyx_t_4);
            __Pyx_ErrRestoreWithState(__pyx_t_3, __pyx_t_7, __pyx_t_4);
            __pyx_t_3 = 0;  __pyx_t_7 = 0;  __pyx_t_4 = 0; 
            __PYX_ERR(0, 1805, __pyx_L9_except_error)
          }
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          goto __pyx_L8_exception_handled;
        }
        __pyx_L9_except_error:;
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        goto __pyx_L1_error;
        __pyx_L8_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        __pyx_L12_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_6) {
          __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_mstate_global->__pyx_tuple[2], NULL);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1805, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        }
        goto __pyx_L6;
      }
      __pyx_L6:;
    }
    goto __pyx_L16;
    __pyx_L3_error:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L1_error;
    __pyx_L16:;
  }

  /* "pkcs11/_pkcs11.pyx":1796
 *         return DataVerifyOperation.setup(self.session, mech, self.handle)
 * 
 *     def _verify(self, data, signature,             # <<<<<<<<<<<<<<
 *                 mechanism=None, mechanism_param=None):
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("pkcs11._pkcs11.VerifyMixin._verify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_op);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1808
 *             op.verify_process_fully(data_ptr, data_len, sig_ptr, sig_len)
 * 
 *     def _verify_generator(self, data, signature,             # <<<<<<<<<<<<<<
 *                           mechanism=None, mechanism_param=None):
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_11VerifyMixin_5_verify_generator(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_11VerifyMixin_5_verify_generator = {"_verify_generator", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_11VerifyMixin_5_verify_generator, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_11VerifyMixin_5_verify_generator(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_data = 0;
  PyObject *__pyx_v_signature = 0;
  PyObject *__pyx_v_mechanism = 0;
  PyObject *__pyx_v_mechanism_param = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_verify_generator (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_data,&__pyx_mstate_global->__pyx_n_u_signature,&__pyx_mstate_global->__pyx_n_u_mechanism,&__pyx_mstate_global->__pyx_n_u_mechanism_param,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1808, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1808, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1808, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1808, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1808, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1808, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_verify_generator", 0) < (0)) __PYX_ERR(0, 1808, __pyx_L3_error)

      /* "pkcs11/_pkcs11.pyx":1809
 * 
 *     def _verify_generator(self, data, signature,
 *                           mechanism=None, mechanism_param=None):             # <<<<<<<<<<<<<<
 * 
 *         cdef CK_BYTE *sig_ptr = signature
*/
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_verify_generator", 0, 3, 5, i); __PYX_ERR(0, 1808, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1808, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1808, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1808, __pyx_L3_error)
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1808, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1808, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_self = values[0];
    __pyx_v_data = values[1];
    __pyx_v_signature = values[2];
    __pyx_v_mechanism = values[3];
    __pyx_v_mechanism_param = values[4];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_verify_generator", 0, 3, 5, __pyx_nargs); __PYX_ERR(0, 1808, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.VerifyMixin._verify_generator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_11VerifyMixin_4_verify_generator(__pyx_self, __pyx_v_self, __pyx_v_data, __pyx_v_signature, __pyx_v_mechanism, __pyx_v_mechanism_param);

  /* "pkcs11/_pkcs11.pyx":1808
 *             op.verify_process_fully(data_ptr, data_len, sig_ptr, sig_len)
 * 
 *     def _verify_generator(self, data, signature,             # <<<<<<<<<<<<<<
 *                           mechanism=None, mechanism_param=None):
 * 
*/

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_11VerifyMixin_4_verify_generator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_signature, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param) {
  CK_BYTE *__pyx_v_sig_ptr;
  CK_ULONG __pyx_v_sig_len;
  struct __pyx_obj_6pkcs11_7_pkcs11_DataVerifyOperation *__pyx_v_op = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  CK_BYTE *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_verify_generator", 0);

  /* "pkcs11/_pkcs11.pyx":1811
 *                           mechanism=None, mechanism_param=None):
 * 
 *         cdef CK_BYTE *sig_ptr = signature             # <<<<<<<<<<<<<<
 *         cdef CK_ULONG sig_len = <CK_ULONG> len(signature)
 *         cdef DataVerifyOperation op = self.__verify_operation(mechanism, mechanism_param)
*/
  __pyx_t_1 = __Pyx_PyObject_AsWritableUString(__pyx_v_signature); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 1811, __pyx_L1_error)
  __pyx_v_sig_ptr = __pyx_t_1;

  /* "pkcs11/_pkcs11.pyx":1812
 * 
 *         cdef CK_BYTE *sig_ptr = signature
 *         cdef CK_ULONG sig_len = <CK_ULONG> len(signature)             # <<<<<<<<<<<<<<
 *         cdef DataVerifyOperation op = self.__verify_operation(mechanism, mechanism_param)
 * 
*/
  __pyx_t_2 = PyObject_Length(__pyx_v_signature); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1812, __pyx_L1_error)
  __pyx_v_sig_len = ((CK_ULONG)__pyx_t_2);

  /* "pkcs11/_pkcs11.pyx":1813
 *         cdef CK_BYTE *sig_ptr = signature
 *         cdef CK_ULONG sig_len = <CK_ULONG> len(signature)
 *         cdef DataVerifyOperation op = self.__verify_operation(mechanism, mechanism_param)             # <<<<<<<<<<<<<<
 * 
 *         with op:
*/
  __pyx_t_4 = __pyx_v_self;
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_mechanism, __pyx_v_mechanism_param};
    __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_VerifyMixin__verify_operation, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1813, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_DataVerifyOperation))))) __PYX_ERR(0, 1813, __pyx_L1_error)
  __pyx_v_op = ((struct __pyx_obj_6pkcs11_7_pkcs11_DataVerifyOperation *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pkcs11/_pkcs11.pyx":1815
 *         cdef DataVerifyOperation op = self.__verify_operation(mechanism, mechanism_param)
 * 
 *         with op:             # <<<<<<<<<<<<<<
 *             op.ingest_chunks(data)
 *             return op.finish(sig_ptr, sig_len)
*/
  /*with:*/ {
    __pyx_t_6 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_op), __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1815, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = NULL;
    __pyx_t_7 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_op), __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1815, __pyx_L3_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1815, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    /*try:*/ {
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_10);
        /*try:*/ {

          /* "pkcs11/_pkcs11.pyx":1816
 * 
 *         with op:
 *             op.ingest_chunks(data)             # <<<<<<<<<<<<<<
 *             return op.finish(sig_ptr, sig_len)
 * 
*/
          __pyx_t_7 = ((PyObject *)__pyx_v_op);
          __Pyx_INCREF(__pyx_t_7);
          __pyx_t_5 = 0;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_data};
            __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_ingest_chunks, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1816, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_3);
          }
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

          /* "pkcs11/_pkcs11.pyx":1817
 *         with op:
 *             op.ingest_chunks(data)
 *             return op.finish(sig_ptr, sig_len)             # <<<<<<<<<<<<<<
 * 
 * 
*/
          __Pyx_XDECREF(__pyx_r);
          __pyx_t_3 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DataVerifyOperation *)__pyx_v_op->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->finish(__pyx_v_op, __pyx_v_sig_ptr, __pyx_v_sig_len); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1817, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_r = __pyx_t_3;
          __pyx_t_3 = 0;
          goto __pyx_L11_try_return;

          /* "pkcs11/_pkcs11.pyx":1815
 *         cdef DataVerifyOperation op = self.__verify_operation(mechanism, mechanism_param)
 * 
 *         with op:             # <<<<<<<<<<<<<<
 *             op.ingest_chunks(data)
 *             return op.finish(sig_ptr, sig_len)
*/
        }
        __pyx_L7_error:;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        /*except:*/ {
          __Pyx_AddTraceback("pkcs11._pkcs11.VerifyMixin._verify_generator", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_7, &__pyx_t_4) < 0) __PYX_ERR(0, 1815, __pyx_L9_except_error)
          __Pyx_XGOTREF(__pyx_t_3);
          __Pyx_XGOTREF(__pyx_t_7);
          __Pyx_XGOTREF(__pyx_t_4);
          __pyx_t_11 = PyTuple_Pack(3, __pyx_t_3, __pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1815, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_11, NULL);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1815, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          if (__pyx_t_13 < (0)) __PYX_ERR(0, 1815, __pyx_L9_except_error)
          __pyx_t_14 = (!__pyx_t_13);
          if (unlikely(__pyx_t_14)) {
            __Pyx_GIVEREF(__pyx_t_3);
            __Pyx_GIVEREF(__pyx_t_7);
            __Pyx_XGIVEREF(__pyx_t_4);
            __Pyx_ErrRestoreWithState(__pyx_t_3, __pyx_t_7, __pyx_t_4);
            __pyx_t_3 = 0;  __pyx_t_7 = 0;  __pyx_t_4 = 0; 
            __PYX_ERR(0, 1815, __pyx_L9_except_error)
          }
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          goto __pyx_L8_exception_handled;
        }
        __pyx_L9_except_error:;
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        goto __pyx_L1_error;
        __pyx_L11_try_return:;
        __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_L4_return;
        __pyx_L8_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);
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_6) {
          __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_mstate_global->__pyx_tuple[2], NULL);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1815, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        }
        goto __pyx_L6;
      }
      __pyx_L4_return: {
        __pyx_t_10 = __pyx_r;
        __pyx_r = 0;
        if (__pyx_t_6) {
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_mstate_global->__pyx_tuple[2], NULL);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1815, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        }
        __pyx_r = __pyx_t_10;
        __pyx_t_10 = 0;
        goto __pyx_L0;
      }
      __pyx_L6:;
    }
    goto __pyx_L16;
    __pyx_L3_error:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L1_error;
    __pyx_L16:;
  }

  /* "pkcs11/_pkcs11.pyx":1808
 *             op.verify_process_fully(data_ptr, data_len, sig_ptr, sig_len)
 * 
 *     def _verify_generator(self, data, signature,             # <<<<<<<<<<<<<<
 *                           mechanism=None, mechanism_param=None):
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("pkcs11._pkcs11.VerifyMixin._verify_generator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_op);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1823
 *     """Expand WrapMixin with an implementation."""
 * 
 *     def wrap_key(self, key,             # <<<<<<<<<<<<<<
 *                  mechanism=None, mechanism_param=None):
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_9WrapMixin_1wrap_key(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_9WrapMixin_1wrap_key = {"wrap_key", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_9WrapMixin_1wrap_key, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_9WrapMixin_1wrap_key(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_mechanism = 0;
  PyObject *__pyx_v_mechanism_param = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("wrap_key (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_key,&__pyx_mstate_global->__pyx_n_u_mechanism,&__pyx_mstate_global->__pyx_n_u_mechanism_param,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1823, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1823, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1823, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1823, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1823, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "wrap_key", 0) < (0)) __PYX_ERR(0, 1823, __pyx_L3_error)

      /* "pkcs11/_pkcs11.pyx":1824
 * 
 *     def wrap_key(self, key,
 *                  mechanism=None, mechanism_param=None):             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(key, types.Key):
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("wrap_key", 0, 2, 4, i); __PYX_ERR(0, 1823, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1823, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1823, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1823, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1823, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_self = values[0];
    __pyx_v_key = values[1];
    __pyx_v_mechanism = values[2];
    __pyx_v_mechanism_param = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("wrap_key", 0, 2, 4, __pyx_nargs); __PYX_ERR(0, 1823, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.WrapMixin.wrap_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_9WrapMixin_wrap_key(__pyx_self, __pyx_v_self, __pyx_v_key, __pyx_v_mechanism, __pyx_v_mechanism_param);

  /* "pkcs11/_pkcs11.pyx":1823
 *     """Expand WrapMixin with an implementation."""
 * 
 *     def wrap_key(self, key,             # <<<<<<<<<<<<<<
 *                  mechanism=None, mechanism_param=None):
 * 
*/

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_9WrapMixin_wrap_key(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param) {
  struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_mech = NULL;
  struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session = 0;
  CK_MECHANISM *__pyx_v_mech_data;
  CK_OBJECT_HANDLE __pyx_v_wrapping_key;
  CK_OBJECT_HANDLE __pyx_v_key_to_wrap;
  CK_ULONG __pyx_v_length;
  CK_RV __pyx_v_retval;
  __Pyx_memviewslice __pyx_v_data = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  CK_MECHANISM *__pyx_t_8;
  CK_OBJECT_HANDLE __pyx_t_9;
  __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_11;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("wrap_key", 0);

  /* "pkcs11/_pkcs11.pyx":1826
 *                  mechanism=None, mechanism_param=None):
 * 
 *         if not isinstance(key, types.Key):             # <<<<<<<<<<<<<<
 *             raise ArgumentsBad("`key` must be a Key.")
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_types); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1826, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1826, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = PyObject_IsInstance(__pyx_v_key, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 1826, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (!__pyx_t_3);
  if (unlikely(__pyx_t_4)) {

    /* "pkcs11/_pkcs11.pyx":1827
 * 
 *         if not isinstance(key, types.Key):
 *             raise ArgumentsBad("`key` must be a Key.")             # <<<<<<<<<<<<<<
 * 
 *         mech = MechanismWithParam(self.key_type, DEFAULT_WRAP_MECHANISMS, mechanism, mechanism_param)
*/
    __pyx_t_1 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ArgumentsBad); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1827, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_1);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_key_must_be_a_Key};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1827, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 1827, __pyx_L1_error)

    /* "pkcs11/_pkcs11.pyx":1826
 *                  mechanism=None, mechanism_param=None):
 * 
 *         if not isinstance(key, types.Key):             # <<<<<<<<<<<<<<
 *             raise ArgumentsBad("`key` must be a Key.")
 * 
*/
  }

  /* "pkcs11/_pkcs11.pyx":1829
 *             raise ArgumentsBad("`key` must be a Key.")
 * 
 *         mech = MechanismWithParam(self.key_type, DEFAULT_WRAP_MECHANISMS, mechanism, mechanism_param)             # <<<<<<<<<<<<<<
 * 
 *         cdef Session session = self.session
*/
  __pyx_t_5 = NULL;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_key_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1829, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_DEFAULT_WRAP_MECHANISMS); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1829, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[5] = {__pyx_t_5, __pyx_t_1, __pyx_t_7, __pyx_v_mechanism, __pyx_v_mechanism_param};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_MechanismWithParam, __pyx_callargs+__pyx_t_6, (5-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1829, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_2);
  }
  __pyx_v_mech = ((struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pkcs11/_pkcs11.pyx":1831
 *         mech = MechanismWithParam(self.key_type, DEFAULT_WRAP_MECHANISMS, mechanism, mechanism_param)
 * 
 *         cdef Session session = self.session             # <<<<<<<<<<<<<<
 *         cdef CK_MECHANISM *mech_data = mech.data
 *         cdef CK_OBJECT_HANDLE wrapping_key = self.handle
*/
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_session); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Session))))) __PYX_ERR(0, 1831, __pyx_L1_error)
  __pyx_v_session = ((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pkcs11/_pkcs11.pyx":1832
 * 
 *         cdef Session session = self.session
 *         cdef CK_MECHANISM *mech_data = mech.data             # <<<<<<<<<<<<<<
 *         cdef CK_OBJECT_HANDLE wrapping_key = self.handle
 *         cdef CK_OBJECT_HANDLE key_to_wrap = key.handle
*/
  __pyx_t_8 = __pyx_v_mech->data;
  __pyx_v_mech_data = __pyx_t_8;

  /* "pkcs11/_pkcs11.pyx":1833
 *         cdef Session session = self.session
 *         cdef CK_MECHANISM *mech_data = mech.data
 *         cdef CK_OBJECT_HANDLE wrapping_key = self.handle             # <<<<<<<<<<<<<<
 *         cdef CK_OBJECT_HANDLE key_to_wrap = key.handle
 *         cdef CK_ULONG length
*/
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_handle); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1833, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_9 = __Pyx_PyLong_As_CK_ULONG(__pyx_t_2); if (unlikely((__pyx_t_9 == ((CK_OBJECT_HANDLE)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1833, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_wrapping_key = __pyx_t_9;

  /* "pkcs11/_pkcs11.pyx":1834
 *         cdef CK_MECHANISM *mech_data = mech.data
 *         cdef CK_OBJECT_HANDLE wrapping_key = self.handle
 *         cdef CK_OBJECT_HANDLE key_to_wrap = key.handle             # <<<<<<<<<<<<<<
 *         cdef CK_ULONG length
 *         cdef CK_RV retval
*/
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_key, __pyx_mstate_global->__pyx_n_u_handle); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1834, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_9 = __Pyx_PyLong_As_CK_ULONG(__pyx_t_2); if (unlikely((__pyx_t_9 == ((CK_OBJECT_HANDLE)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1834, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_key_to_wrap = __pyx_t_9;

  /* "pkcs11/_pkcs11.pyx":1839
 * 
 *         # Find out how many bytes we need to allocate
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = session.funclist.C_WrapKey(session.handle, mech_data, wrapping_key, key_to_wrap, NULL, &length)
 *         assertRV(retval)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":1840
 *         # Find out how many bytes we need to allocate
 *         with nogil:
 *             retval = session.funclist.C_WrapKey(session.handle, mech_data, wrapping_key, key_to_wrap, NULL, &length)             # <<<<<<<<<<<<<<
 *         assertRV(retval)
 * 
*/
        __pyx_v_retval = __pyx_v_session->__pyx_base.funclist->C_WrapKey(__pyx_v_session->handle, __pyx_v_mech_data, __pyx_v_wrapping_key, __pyx_v_key_to_wrap, NULL, (&__pyx_v_length));
      }

      /* "pkcs11/_pkcs11.pyx":1839
 * 
 *         # Find out how many bytes we need to allocate
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = session.funclist.C_WrapKey(session.handle, mech_data, wrapping_key, key_to_wrap, NULL, &length)
 *         assertRV(retval)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L6;
        }
        __pyx_L6:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":1841
 *         with nogil:
 *             retval = session.funclist.C_WrapKey(session.handle, mech_data, wrapping_key, key_to_wrap, NULL, &length)
 *         assertRV(retval)             # <<<<<<<<<<<<<<
 * 
 *         cdef CK_BYTE [:] data = CK_BYTE_buffer(length)
*/
  __pyx_t_2 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1841, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1841, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pkcs11/_pkcs11.pyx":1843
 *         assertRV(retval)
 * 
 *         cdef CK_BYTE [:] data = CK_BYTE_buffer(length)             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
*/
  __pyx_t_7 = __Pyx_PyLong_From_CK_ULONG(__pyx_v_length); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = __pyx_f_6pkcs11_7_pkcs11_CK_BYTE_buffer(__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn_CK_BYTE(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 1843, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_data = __pyx_t_10;
  __pyx_t_10.memview = NULL;
  __pyx_t_10.data = NULL;

  /* "pkcs11/_pkcs11.pyx":1845
 *         cdef CK_BYTE [:] data = CK_BYTE_buffer(length)
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = session.funclist.C_WrapKey(session.handle, mech_data, wrapping_key, key_to_wrap, &data[0], &length)
 *         assertRV(retval)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":1846
 * 
 *         with nogil:
 *             retval = session.funclist.C_WrapKey(session.handle, mech_data, wrapping_key, key_to_wrap, &data[0], &length)             # <<<<<<<<<<<<<<
 *         assertRV(retval)
 * 
*/
        __pyx_t_11 = 0;
        __pyx_t_12 = -1;
        if (__pyx_t_11 < 0) {
          __pyx_t_11 += __pyx_v_data.shape[0];
          if (unlikely(__pyx_t_11 < 0)) __pyx_t_12 = 0;
        } else if (unlikely(__pyx_t_11 >= __pyx_v_data.shape[0])) __pyx_t_12 = 0;
        if (unlikely(__pyx_t_12 != -1)) {
          __Pyx_RaiseBufferIndexErrorNogil(__pyx_t_12);
          __PYX_ERR(0, 1846, __pyx_L8_error)
        }
        __pyx_v_retval = __pyx_v_session->__pyx_base.funclist->C_WrapKey(__pyx_v_session->handle, __pyx_v_mech_data, __pyx_v_wrapping_key, __pyx_v_key_to_wrap, (&(*((CK_BYTE *) ( /* dim=0 */ (__pyx_v_data.data + __pyx_t_11 * __pyx_v_data.strides[0]) )))), (&__pyx_v_length));
      }

      /* "pkcs11/_pkcs11.pyx":1845
 *         cdef CK_BYTE [:] data = CK_BYTE_buffer(length)
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = session.funclist.C_WrapKey(session.handle, mech_data, wrapping_key, key_to_wrap, &data[0], &length)
 *         assertRV(retval)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L9;
        }
        __pyx_L8_error: {
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L1_error;
        }
        __pyx_L9:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":1847
 *         with nogil:
 *             retval = session.funclist.C_WrapKey(session.handle, mech_data, wrapping_key, key_to_wrap, &data[0], &length)
 *         assertRV(retval)             # <<<<<<<<<<<<<<
 * 
 *         return bytes(data[:length])
*/
  __pyx_t_2 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1847, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1847, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pkcs11/_pkcs11.pyx":1849
 *         assertRV(retval)
 * 
 *         return bytes(data[:length])             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __pyx_t_10.data = __pyx_v_data.data;
  __pyx_t_10.memview = __pyx_v_data.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_10, 1);
  __pyx_t_12 = -1;
  if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_10,
    __pyx_v_data.shape[0], __pyx_v_data.strides[0], __pyx_v_data.suboffsets[0],
    0,
    0,
    &__pyx_t_12,
    0,
    __pyx_v_length,
    0,
    0,
    1,
    0,
    1) < 0))
{
    __PYX_ERR(0, 1849, __pyx_L1_error)
}

__pyx_t_1 = __pyx_memoryview_fromslice(__pyx_t_10, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn_CK_BYTE, (int (*)(char *, PyObject *)) __pyx_memview_set_nn_CK_BYTE, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1849, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_10, 1);
  __pyx_t_10.memview = NULL; __pyx_t_10.data = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_1};
    __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)(&PyBytes_Type), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1849, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
  }
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":1823
 *     """Expand WrapMixin with an implementation."""
 * 
 *     def wrap_key(self, key,             # <<<<<<<<<<<<<<
 *                  mechanism=None, mechanism_param=None):
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_10, 1);
  __Pyx_AddTraceback("pkcs11._pkcs11.WrapMixin.wrap_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mech);
  __Pyx_XDECREF((PyObject *)__pyx_v_session);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_data, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1855
 *     """Expand UnwrapMixin with an implementation."""
 * 
 *     def unwrap_key(self, object_class, key_type, key_data,             # <<<<<<<<<<<<<<
 *                    id=None, label=None,
 *                    mechanism=None, mechanism_param=None,
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_11UnwrapMixin_1unwrap_key(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_11UnwrapMixin_1unwrap_key = {"unwrap_key", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_11UnwrapMixin_1unwrap_key, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_11UnwrapMixin_1unwrap_key(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_object_class = 0;
  PyObject *__pyx_v_key_type = 0;
  PyObject *__pyx_v_key_data = 0;
  PyObject *__pyx_v_id = 0;
  PyObject *__pyx_v_label = 0;
  PyObject *__pyx_v_mechanism = 0;
  PyObject *__pyx_v_mechanism_param = 0;
  PyObject *__pyx_v_store = 0;
  PyObject *__pyx_v_capabilities = 0;
  PyObject *__pyx_v_template = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("unwrap_key (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_object_class,&__pyx_mstate_global->__pyx_n_u_key_type,&__pyx_mstate_global->__pyx_n_u_key_data,&__pyx_mstate_global->__pyx_n_u_id,&__pyx_mstate_global->__pyx_n_u_label,&__pyx_mstate_global->__pyx_n_u_mechanism,&__pyx_mstate_global->__pyx_n_u_mechanism_param,&__pyx_mstate_global->__pyx_n_u_store,&__pyx_mstate_global->__pyx_n_u_capabilities,&__pyx_mstate_global->__pyx_n_u_template,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1855, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case 11:
        values[10] = __Pyx_ArgRef_FASTCALL(__pyx_args, 10);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[10])) __PYX_ERR(0, 1855, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 10:
        values[9] = __Pyx_ArgRef_FASTCALL(__pyx_args, 9);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[9])) __PYX_ERR(0, 1855, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  9:
        values[8] = __Pyx_ArgRef_FASTCALL(__pyx_args, 8);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[8])) __PYX_ERR(0, 1855, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  8:
        values[7] = __Pyx_ArgRef_FASTCALL(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 1855, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 1855, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 1855, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1855, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1855, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1855, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1855, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1855, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "unwrap_key", 0) < (0)) __PYX_ERR(0, 1855, __pyx_L3_error)

      /* "pkcs11/_pkcs11.pyx":1856
 * 
 *     def unwrap_key(self, object_class, key_type, key_data,
 *                    id=None, label=None,             # <<<<<<<<<<<<<<
 *                    mechanism=None, mechanism_param=None,
 *                    store=False, capabilities=None,
*/
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":1857
 *     def unwrap_key(self, object_class, key_type, key_data,
 *                    id=None, label=None,
 *                    mechanism=None, mechanism_param=None,             # <<<<<<<<<<<<<<
 *                    store=False, capabilities=None,
 *                    template=None):
*/
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":1858
 *                    id=None, label=None,
 *                    mechanism=None, mechanism_param=None,
 *                    store=False, capabilities=None,             # <<<<<<<<<<<<<<
 *                    template=None):
 * 
*/
      if (!values[8]) values[8] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_False)));
      if (!values[9]) values[9] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":1859
 *                    mechanism=None, mechanism_param=None,
 *                    store=False, capabilities=None,
 *                    template=None):             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(object_class, ObjectClass):
*/
      if (!values[10]) values[10] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("unwrap_key", 0, 4, 11, i); __PYX_ERR(0, 1855, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case 11:
        values[10] = __Pyx_ArgRef_FASTCALL(__pyx_args, 10);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[10])) __PYX_ERR(0, 1855, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 10:
        values[9] = __Pyx_ArgRef_FASTCALL(__pyx_args, 9);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[9])) __PYX_ERR(0, 1855, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  9:
        values[8] = __Pyx_ArgRef_FASTCALL(__pyx_args, 8);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[8])) __PYX_ERR(0, 1855, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  8:
        values[7] = __Pyx_ArgRef_FASTCALL(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 1855, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 1855, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 1855, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1855, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1855, __pyx_L3_error)
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1855, __pyx_L3_error)
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1855, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1855, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }

      /* "pkcs11/_pkcs11.pyx":1856
 * 
 *     def unwrap_key(self, object_class, key_type, key_data,
 *                    id=None, label=None,             # <<<<<<<<<<<<<<
 *                    mechanism=None, mechanism_param=None,
 *                    store=False, capabilities=None,
*/
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":1857
 *     def unwrap_key(self, object_class, key_type, key_data,
 *                    id=None, label=None,
 *                    mechanism=None, mechanism_param=None,             # <<<<<<<<<<<<<<
 *                    store=False, capabilities=None,
 *                    template=None):
*/
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[8]) values[8] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_False)));

      /* "pkcs11/_pkcs11.pyx":1858
 *                    id=None, label=None,
 *                    mechanism=None, mechanism_param=None,
 *                    store=False, capabilities=None,             # <<<<<<<<<<<<<<
 *                    template=None):
 * 
*/
      if (!values[9]) values[9] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":1859
 *                    mechanism=None, mechanism_param=None,
 *                    store=False, capabilities=None,
 *                    template=None):             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(object_class, ObjectClass):
*/
      if (!values[10]) values[10] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_self = values[0];
    __pyx_v_object_class = values[1];
    __pyx_v_key_type = values[2];
    __pyx_v_key_data = values[3];
    __pyx_v_id = values[4];
    __pyx_v_label = values[5];
    __pyx_v_mechanism = values[6];
    __pyx_v_mechanism_param = values[7];
    __pyx_v_store = values[8];
    __pyx_v_capabilities = values[9];
    __pyx_v_template = values[10];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("unwrap_key", 0, 4, 11, __pyx_nargs); __PYX_ERR(0, 1855, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.UnwrapMixin.unwrap_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_11UnwrapMixin_unwrap_key(__pyx_self, __pyx_v_self, __pyx_v_object_class, __pyx_v_key_type, __pyx_v_key_data, __pyx_v_id, __pyx_v_label, __pyx_v_mechanism, __pyx_v_mechanism_param, __pyx_v_store, __pyx_v_capabilities, __pyx_v_template);

  /* "pkcs11/_pkcs11.pyx":1855
 *     """Expand UnwrapMixin with an implementation."""
 * 
 *     def unwrap_key(self, object_class, key_type, key_data,             # <<<<<<<<<<<<<<
 *                    id=None, label=None,
 *                    mechanism=None, mechanism_param=None,
*/

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_11UnwrapMixin_unwrap_key(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_object_class, PyObject *__pyx_v_key_type, PyObject *__pyx_v_key_data, PyObject *__pyx_v_id, PyObject *__pyx_v_label, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param, PyObject *__pyx_v_store, PyObject *__pyx_v_capabilities, PyObject *__pyx_v_template) {
  struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_mech = NULL;
  struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session = 0;
  PyObject *__pyx_v_template_ = NULL;
  struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_attrs = 0;
  CK_MECHANISM *__pyx_v_mech_data;
  CK_OBJECT_HANDLE __pyx_v_unwrapping_key;
  CK_BYTE *__pyx_v_wrapped_key_ptr;
  CK_ULONG __pyx_v_wrapped_key_len;
  CK_ATTRIBUTE *__pyx_v_attr_data;
  CK_ULONG __pyx_v_attr_count;
  CK_OBJECT_HANDLE __pyx_v_key;
  CK_RV __pyx_v_retval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  CK_MECHANISM *__pyx_t_14;
  CK_OBJECT_HANDLE __pyx_t_15;
  CK_BYTE *__pyx_t_16;
  Py_ssize_t __pyx_t_17;
  CK_ATTRIBUTE *__pyx_t_18;
  CK_ULONG __pyx_t_19;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("unwrap_key", 0);
  __Pyx_INCREF(__pyx_v_capabilities);

  /* "pkcs11/_pkcs11.pyx":1861
 *                    template=None):
 * 
 *         if not isinstance(object_class, ObjectClass):             # <<<<<<<<<<<<<<
 *             raise ArgumentsBad("`object_class` must be ObjectClass.")
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_ObjectClass); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1861, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_object_class, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 1861, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!__pyx_t_2);
  if (unlikely(__pyx_t_3)) {

    /* "pkcs11/_pkcs11.pyx":1862
 * 
 *         if not isinstance(object_class, ObjectClass):
 *             raise ArgumentsBad("`object_class` must be ObjectClass.")             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(key_type, KeyType):
*/
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ArgumentsBad); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1862, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_object_class_must_be_ObjectClas};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1862, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 1862, __pyx_L1_error)

    /* "pkcs11/_pkcs11.pyx":1861
 *                    template=None):
 * 
 *         if not isinstance(object_class, ObjectClass):             # <<<<<<<<<<<<<<
 *             raise ArgumentsBad("`object_class` must be ObjectClass.")
 * 
*/
  }

  /* "pkcs11/_pkcs11.pyx":1864
 *             raise ArgumentsBad("`object_class` must be ObjectClass.")
 * 
 *         if not isinstance(key_type, KeyType):             # <<<<<<<<<<<<<<
 *             raise ArgumentsBad("`key_type` must be KeyType.")
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_KeyType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1864, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_IsInstance(__pyx_v_key_type, __pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 1864, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = (!__pyx_t_3);
  if (unlikely(__pyx_t_2)) {

    /* "pkcs11/_pkcs11.pyx":1865
 * 
 *         if not isinstance(key_type, KeyType):
 *             raise ArgumentsBad("`key_type` must be KeyType.")             # <<<<<<<<<<<<<<
 * 
 *         if capabilities is None:
*/
    __pyx_t_5 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_ArgumentsBad); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1865, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_5);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_key_type_must_be_KeyType};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1865, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 1865, __pyx_L1_error)

    /* "pkcs11/_pkcs11.pyx":1864
 *             raise ArgumentsBad("`object_class` must be ObjectClass.")
 * 
 *         if not isinstance(key_type, KeyType):             # <<<<<<<<<<<<<<
 *             raise ArgumentsBad("`key_type` must be KeyType.")
 * 
*/
  }

  /* "pkcs11/_pkcs11.pyx":1867
 *             raise ArgumentsBad("`key_type` must be KeyType.")
 * 
 *         if capabilities is None:             # <<<<<<<<<<<<<<
 *             try:
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[key_type]
*/
  __pyx_t_2 = (__pyx_v_capabilities == Py_None);
  if (__pyx_t_2) {

    /* "pkcs11/_pkcs11.pyx":1868
 * 
 *         if capabilities is None:
 *             try:             # <<<<<<<<<<<<<<
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[key_type]
 *             except KeyError:
*/
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":1869
 *         if capabilities is None:
 *             try:
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[key_type]             # <<<<<<<<<<<<<<
 *             except KeyError:
 *                 raise ArgumentsBad("No default capabilities for this key "
*/
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_DEFAULT_KEY_CAPABILITIES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1869, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_key_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1869, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF_SET(__pyx_v_capabilities, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "pkcs11/_pkcs11.pyx":1868
 * 
 *         if capabilities is None:
 *             try:             # <<<<<<<<<<<<<<
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[key_type]
 *             except KeyError:
*/
      }
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L11_try_end;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "pkcs11/_pkcs11.pyx":1870
 *             try:
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[key_type]
 *             except KeyError:             # <<<<<<<<<<<<<<
 *                 raise ArgumentsBad("No default capabilities for this key "
 *                                    "type. Please specify `capabilities`.")
*/
      __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_KeyError))));
      if (__pyx_t_10) {
        __Pyx_AddTraceback("pkcs11._pkcs11.UnwrapMixin.unwrap_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_1, &__pyx_t_5) < 0) __PYX_ERR(0, 1870, __pyx_L8_except_error)
        __Pyx_XGOTREF(__pyx_t_4);
        __Pyx_XGOTREF(__pyx_t_1);
        __Pyx_XGOTREF(__pyx_t_5);

        /* "pkcs11/_pkcs11.pyx":1871
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[key_type]
 *             except KeyError:
 *                 raise ArgumentsBad("No default capabilities for this key "             # <<<<<<<<<<<<<<
 *                                    "type. Please specify `capabilities`.")
 * 
*/
        __pyx_t_12 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_ArgumentsBad); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1871, __pyx_L8_except_error)
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_6 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_13))) {
          __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_13);
          assert(__pyx_t_12);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_13);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_13, __pyx__function);
          __pyx_t_6 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_mstate_global->__pyx_kp_u_No_default_capabilities_for_this};
          __pyx_t_11 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_13, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1871, __pyx_L8_except_error)
          __Pyx_GOTREF(__pyx_t_11);
        }
        __Pyx_Raise(__pyx_t_11, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __PYX_ERR(0, 1871, __pyx_L8_except_error)
      }
      goto __pyx_L8_except_error;

      /* "pkcs11/_pkcs11.pyx":1868
 * 
 *         if capabilities is None:
 *             try:             # <<<<<<<<<<<<<<
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[key_type]
 *             except KeyError:
*/
      __pyx_L8_except_error:;
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      goto __pyx_L1_error;
      __pyx_L11_try_end:;
    }

    /* "pkcs11/_pkcs11.pyx":1867
 *             raise ArgumentsBad("`key_type` must be KeyType.")
 * 
 *         if capabilities is None:             # <<<<<<<<<<<<<<
 *             try:
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[key_type]
*/
  }

  /* "pkcs11/_pkcs11.pyx":1874
 *                                    "type. Please specify `capabilities`.")
 * 
 *         mech = MechanismWithParam(self.key_type, DEFAULT_WRAP_MECHANISMS, mechanism, mechanism_param)             # <<<<<<<<<<<<<<
 * 
 *         cdef Session session = self.session
*/
  __pyx_t_1 = NULL;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_key_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1874, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_DEFAULT_WRAP_MECHANISMS); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1874, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[5] = {__pyx_t_1, __pyx_t_4, __pyx_t_11, __pyx_v_mechanism, __pyx_v_mechanism_param};
    __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_MechanismWithParam, __pyx_callargs+__pyx_t_6, (5-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1874, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_5);
  }
  __pyx_v_mech = ((struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":1876
 *         mech = MechanismWithParam(self.key_type, DEFAULT_WRAP_MECHANISMS, mechanism, mechanism_param)
 * 
 *         cdef Session session = self.session             # <<<<<<<<<<<<<<
 * 
 *         # Build attributes
*/
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_session); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1876, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Session))))) __PYX_ERR(0, 1876, __pyx_L1_error)
  __pyx_v_session = ((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":1879
 * 
 *         # Build attributes
 *         template_ = session.attribute_mapper.generic_key_template(             # <<<<<<<<<<<<<<
 *             {
 *                 Attribute.CLASS: object_class,
*/
  __pyx_t_11 = __pyx_v_session->attribute_mapper;
  __Pyx_INCREF(__pyx_t_11);

  /* "pkcs11/_pkcs11.pyx":1881
 *         template_ = session.attribute_mapper.generic_key_template(
 *             {
 *                 Attribute.CLASS: object_class,             # <<<<<<<<<<<<<<
 *                 Attribute.KEY_TYPE: key_type,
 *             },
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1881, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Attribute); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1881, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_CLASS); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1881, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_13, __pyx_v_object_class) < (0)) __PYX_ERR(0, 1881, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "pkcs11/_pkcs11.pyx":1882
 *             {
 *                 Attribute.CLASS: object_class,
 *                 Attribute.KEY_TYPE: key_type,             # <<<<<<<<<<<<<<
 *             },
 *             id_=id,
*/
  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_Attribute); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_KEY_TYPE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_1, __pyx_v_key_type) < (0)) __PYX_ERR(0, 1881, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":1887
 *             label=label,
 *             store=store,
 *             capabilities=capabilities,             # <<<<<<<<<<<<<<
 *         )
 *         cdef AttributeList attrs = session.make_attribute_list(merge_templates(template_, template))
*/
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 4 : 0)] = {__pyx_t_11, __pyx_t_4};
    __pyx_t_1 = __Pyx_MakeVectorcallBuilderKwds(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1879, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_id_2, __pyx_v_id, __pyx_t_1, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 1879, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_label, __pyx_v_label, __pyx_t_1, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 1879, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_store, __pyx_v_store, __pyx_t_1, __pyx_callargs+2, 2) < (0)) __PYX_ERR(0, 1879, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_capabilities, __pyx_v_capabilities, __pyx_t_1, __pyx_callargs+2, 3) < (0)) __PYX_ERR(0, 1879, __pyx_L1_error)
    __pyx_t_5 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_generic_key_template, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_1);
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1879, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __pyx_v_template_ = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":1889
 *             capabilities=capabilities,
 *         )
 *         cdef AttributeList attrs = session.make_attribute_list(merge_templates(template_, template))             # <<<<<<<<<<<<<<
 *         cdef CK_MECHANISM *mech_data = mech.data
 *         cdef CK_OBJECT_HANDLE unwrapping_key = self.handle
*/
  __pyx_t_1 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_merge_templates); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_1);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_v_template_, __pyx_v_template};
    __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1889, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __pyx_t_4 = ((PyObject *)((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_Session *)__pyx_v_session->__pyx_vtab)->make_attribute_list(__pyx_v_session, __pyx_t_5)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_attrs = ((struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":1890
 *         )
 *         cdef AttributeList attrs = session.make_attribute_list(merge_templates(template_, template))
 *         cdef CK_MECHANISM *mech_data = mech.data             # <<<<<<<<<<<<<<
 *         cdef CK_OBJECT_HANDLE unwrapping_key = self.handle
 *         cdef CK_BYTE *wrapped_key_ptr = key_data
*/
  __pyx_t_14 = __pyx_v_mech->data;
  __pyx_v_mech_data = __pyx_t_14;

  /* "pkcs11/_pkcs11.pyx":1891
 *         cdef AttributeList attrs = session.make_attribute_list(merge_templates(template_, template))
 *         cdef CK_MECHANISM *mech_data = mech.data
 *         cdef CK_OBJECT_HANDLE unwrapping_key = self.handle             # <<<<<<<<<<<<<<
 *         cdef CK_BYTE *wrapped_key_ptr = key_data
 *         cdef CK_ULONG wrapped_key_len = <CK_ULONG> len(key_data)
*/
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_handle); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1891, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_15 = __Pyx_PyLong_As_CK_ULONG(__pyx_t_4); if (unlikely((__pyx_t_15 == ((CK_OBJECT_HANDLE)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1891, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_unwrapping_key = __pyx_t_15;

  /* "pkcs11/_pkcs11.pyx":1892
 *         cdef CK_MECHANISM *mech_data = mech.data
 *         cdef CK_OBJECT_HANDLE unwrapping_key = self.handle
 *         cdef CK_BYTE *wrapped_key_ptr = key_data             # <<<<<<<<<<<<<<
 *         cdef CK_ULONG wrapped_key_len = <CK_ULONG> len(key_data)
 *         cdef CK_ATTRIBUTE *attr_data = attrs.data
*/
  __pyx_t_16 = __Pyx_PyObject_AsWritableUString(__pyx_v_key_data); if (unlikely((!__pyx_t_16) && PyErr_Occurred())) __PYX_ERR(0, 1892, __pyx_L1_error)
  __pyx_v_wrapped_key_ptr = __pyx_t_16;

  /* "pkcs11/_pkcs11.pyx":1893
 *         cdef CK_OBJECT_HANDLE unwrapping_key = self.handle
 *         cdef CK_BYTE *wrapped_key_ptr = key_data
 *         cdef CK_ULONG wrapped_key_len = <CK_ULONG> len(key_data)             # <<<<<<<<<<<<<<
 *         cdef CK_ATTRIBUTE *attr_data = attrs.data
 *         cdef CK_ULONG attr_count = attrs.count
*/
  __pyx_t_17 = PyObject_Length(__pyx_v_key_data); if (unlikely(__pyx_t_17 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1893, __pyx_L1_error)
  __pyx_v_wrapped_key_len = ((CK_ULONG)__pyx_t_17);

  /* "pkcs11/_pkcs11.pyx":1894
 *         cdef CK_BYTE *wrapped_key_ptr = key_data
 *         cdef CK_ULONG wrapped_key_len = <CK_ULONG> len(key_data)
 *         cdef CK_ATTRIBUTE *attr_data = attrs.data             # <<<<<<<<<<<<<<
 *         cdef CK_ULONG attr_count = attrs.count
 *         cdef CK_OBJECT_HANDLE key
*/
  __pyx_t_18 = __pyx_v_attrs->data;
  __pyx_v_attr_data = __pyx_t_18;

  /* "pkcs11/_pkcs11.pyx":1895
 *         cdef CK_ULONG wrapped_key_len = <CK_ULONG> len(key_data)
 *         cdef CK_ATTRIBUTE *attr_data = attrs.data
 *         cdef CK_ULONG attr_count = attrs.count             # <<<<<<<<<<<<<<
 *         cdef CK_OBJECT_HANDLE key
 *         cdef CK_RV retval
*/
  __pyx_t_19 = __pyx_v_attrs->count;
  __pyx_v_attr_count = __pyx_t_19;

  /* "pkcs11/_pkcs11.pyx":1899
 *         cdef CK_RV retval
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = session.funclist.C_UnwrapKey(session.handle, mech_data, unwrapping_key, wrapped_key_ptr, wrapped_key_len, attr_data, attr_count, &key)
 *         assertRV(retval)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":1900
 * 
 *         with nogil:
 *             retval = session.funclist.C_UnwrapKey(session.handle, mech_data, unwrapping_key, wrapped_key_ptr, wrapped_key_len, attr_data, attr_count, &key)             # <<<<<<<<<<<<<<
 *         assertRV(retval)
 * 
*/
        __pyx_v_retval = __pyx_v_session->__pyx_base.funclist->C_UnwrapKey(__pyx_v_session->handle, __pyx_v_mech_data, __pyx_v_unwrapping_key, __pyx_v_wrapped_key_ptr, __pyx_v_wrapped_key_len, __pyx_v_attr_data, __pyx_v_attr_count, (&__pyx_v_key));
      }

      /* "pkcs11/_pkcs11.pyx":1899
 *         cdef CK_RV retval
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = session.funclist.C_UnwrapKey(session.handle, mech_data, unwrapping_key, wrapped_key_ptr, wrapped_key_len, attr_data, attr_count, &key)
 *         assertRV(retval)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L16;
        }
        __pyx_L16:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":1901
 *         with nogil:
 *             retval = session.funclist.C_UnwrapKey(session.handle, mech_data, unwrapping_key, wrapped_key_ptr, wrapped_key_len, attr_data, attr_count, &key)
 *         assertRV(retval)             # <<<<<<<<<<<<<<
 * 
 *         return make_object(session, key)
*/
  __pyx_t_4 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":1903
 *         assertRV(retval)
 * 
 *         return make_object(session, key)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __pyx_f_6pkcs11_7_pkcs11_make_object(__pyx_v_session, __pyx_v_key); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1903, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":1855
 *     """Expand UnwrapMixin with an implementation."""
 * 
 *     def unwrap_key(self, object_class, key_type, key_data,             # <<<<<<<<<<<<<<
 *                    id=None, label=None,
 *                    mechanism=None, mechanism_param=None,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("pkcs11._pkcs11.UnwrapMixin.unwrap_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mech);
  __Pyx_XDECREF((PyObject *)__pyx_v_session);
  __Pyx_XDECREF(__pyx_v_template_);
  __Pyx_XDECREF((PyObject *)__pyx_v_attrs);
  __Pyx_XDECREF(__pyx_v_capabilities);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1909
 *     """Expand DeriveMixin with an implementation."""
 * 
 *     def derive_key(self, key_type, key_length,             # <<<<<<<<<<<<<<
 *                    id=None, label=None,
 *                    store=False, capabilities=None,
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_11DeriveMixin_1derive_key(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_11DeriveMixin_1derive_key = {"derive_key", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_11DeriveMixin_1derive_key, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_11DeriveMixin_1derive_key(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_key_type = 0;
  PyObject *__pyx_v_key_length = 0;
  PyObject *__pyx_v_id = 0;
  PyObject *__pyx_v_label = 0;
  PyObject *__pyx_v_store = 0;
  PyObject *__pyx_v_capabilities = 0;
  PyObject *__pyx_v_mechanism = 0;
  PyObject *__pyx_v_mechanism_param = 0;
  PyObject *__pyx_v_template = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("derive_key (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_key_type,&__pyx_mstate_global->__pyx_n_u_key_length,&__pyx_mstate_global->__pyx_n_u_id,&__pyx_mstate_global->__pyx_n_u_label,&__pyx_mstate_global->__pyx_n_u_store,&__pyx_mstate_global->__pyx_n_u_capabilities,&__pyx_mstate_global->__pyx_n_u_mechanism,&__pyx_mstate_global->__pyx_n_u_mechanism_param,&__pyx_mstate_global->__pyx_n_u_template,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1909, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case 10:
        values[9] = __Pyx_ArgRef_FASTCALL(__pyx_args, 9);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[9])) __PYX_ERR(0, 1909, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  9:
        values[8] = __Pyx_ArgRef_FASTCALL(__pyx_args, 8);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[8])) __PYX_ERR(0, 1909, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  8:
        values[7] = __Pyx_ArgRef_FASTCALL(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 1909, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 1909, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 1909, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1909, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1909, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1909, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1909, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1909, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "derive_key", 0) < (0)) __PYX_ERR(0, 1909, __pyx_L3_error)

      /* "pkcs11/_pkcs11.pyx":1910
 * 
 *     def derive_key(self, key_type, key_length,
 *                    id=None, label=None,             # <<<<<<<<<<<<<<
 *                    store=False, capabilities=None,
 *                    mechanism=None, mechanism_param=None,
*/
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":1911
 *     def derive_key(self, key_type, key_length,
 *                    id=None, label=None,
 *                    store=False, capabilities=None,             # <<<<<<<<<<<<<<
 *                    mechanism=None, mechanism_param=None,
 *                    template=None):
*/
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_False)));
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":1912
 *                    id=None, label=None,
 *                    store=False, capabilities=None,
 *                    mechanism=None, mechanism_param=None,             # <<<<<<<<<<<<<<
 *                    template=None):
 * 
*/
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[8]) values[8] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":1913
 *                    store=False, capabilities=None,
 *                    mechanism=None, mechanism_param=None,
 *                    template=None):             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(key_type, KeyType):
*/
      if (!values[9]) values[9] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("derive_key", 0, 3, 10, i); __PYX_ERR(0, 1909, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case 10:
        values[9] = __Pyx_ArgRef_FASTCALL(__pyx_args, 9);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[9])) __PYX_ERR(0, 1909, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  9:
        values[8] = __Pyx_ArgRef_FASTCALL(__pyx_args, 8);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[8])) __PYX_ERR(0, 1909, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  8:
        values[7] = __Pyx_ArgRef_FASTCALL(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 1909, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 1909, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 1909, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1909, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1909, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1909, __pyx_L3_error)
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1909, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1909, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }

      /* "pkcs11/_pkcs11.pyx":1910
 * 
 *     def derive_key(self, key_type, key_length,
 *                    id=None, label=None,             # <<<<<<<<<<<<<<
 *                    store=False, capabilities=None,
 *                    mechanism=None, mechanism_param=None,
*/
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_False)));

      /* "pkcs11/_pkcs11.pyx":1911
 *     def derive_key(self, key_type, key_length,
 *                    id=None, label=None,
 *                    store=False, capabilities=None,             # <<<<<<<<<<<<<<
 *                    mechanism=None, mechanism_param=None,
 *                    template=None):
*/
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":1912
 *                    id=None, label=None,
 *                    store=False, capabilities=None,
 *                    mechanism=None, mechanism_param=None,             # <<<<<<<<<<<<<<
 *                    template=None):
 * 
*/
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[8]) values[8] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":1913
 *                    store=False, capabilities=None,
 *                    mechanism=None, mechanism_param=None,
 *                    template=None):             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(key_type, KeyType):
*/
      if (!values[9]) values[9] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_self = values[0];
    __pyx_v_key_type = values[1];
    __pyx_v_key_length = values[2];
    __pyx_v_id = values[3];
    __pyx_v_label = values[4];
    __pyx_v_store = values[5];
    __pyx_v_capabilities = values[6];
    __pyx_v_mechanism = values[7];
    __pyx_v_mechanism_param = values[8];
    __pyx_v_template = values[9];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("derive_key", 0, 3, 10, __pyx_nargs); __PYX_ERR(0, 1909, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.DeriveMixin.derive_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_11DeriveMixin_derive_key(__pyx_self, __pyx_v_self, __pyx_v_key_type, __pyx_v_key_length, __pyx_v_id, __pyx_v_label, __pyx_v_store, __pyx_v_capabilities, __pyx_v_mechanism, __pyx_v_mechanism_param, __pyx_v_template);

  /* "pkcs11/_pkcs11.pyx":1909
 *     """Expand DeriveMixin with an implementation."""
 * 
 *     def derive_key(self, key_type, key_length,             # <<<<<<<<<<<<<<
 *                    id=None, label=None,
 *                    store=False, capabilities=None,
*/

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_11DeriveMixin_derive_key(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_key_type, PyObject *__pyx_v_key_length, PyObject *__pyx_v_id, PyObject *__pyx_v_label, PyObject *__pyx_v_store, PyObject *__pyx_v_capabilities, PyObject *__pyx_v_mechanism, PyObject *__pyx_v_mechanism_param, PyObject *__pyx_v_template) {
  struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *__pyx_v_mech = NULL;
  struct __pyx_obj_6pkcs11_7_pkcs11_Session *__pyx_v_session = 0;
  PyObject *__pyx_v_template_ = NULL;
  struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *__pyx_v_attrs = 0;
  CK_MECHANISM *__pyx_v_mech_data;
  CK_OBJECT_HANDLE __pyx_v_src_key;
  CK_ATTRIBUTE *__pyx_v_attr_data;
  CK_ULONG __pyx_v_attr_count;
  CK_OBJECT_HANDLE __pyx_v_key;
  CK_RV __pyx_v_retval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  CK_MECHANISM *__pyx_t_14;
  CK_OBJECT_HANDLE __pyx_t_15;
  CK_ATTRIBUTE *__pyx_t_16;
  CK_ULONG __pyx_t_17;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("derive_key", 0);
  __Pyx_INCREF(__pyx_v_capabilities);

  /* "pkcs11/_pkcs11.pyx":1915
 *                    template=None):
 * 
 *         if not isinstance(key_type, KeyType):             # <<<<<<<<<<<<<<
 *             raise ArgumentsBad("`key_type` must be KeyType.")
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_KeyType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1915, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_key_type, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 1915, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!__pyx_t_2);
  if (unlikely(__pyx_t_3)) {

    /* "pkcs11/_pkcs11.pyx":1916
 * 
 *         if not isinstance(key_type, KeyType):
 *             raise ArgumentsBad("`key_type` must be KeyType.")             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(key_length, int):
*/
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ArgumentsBad); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1916, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_key_type_must_be_KeyType};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1916, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 1916, __pyx_L1_error)

    /* "pkcs11/_pkcs11.pyx":1915
 *                    template=None):
 * 
 *         if not isinstance(key_type, KeyType):             # <<<<<<<<<<<<<<
 *             raise ArgumentsBad("`key_type` must be KeyType.")
 * 
*/
  }

  /* "pkcs11/_pkcs11.pyx":1918
 *             raise ArgumentsBad("`key_type` must be KeyType.")
 * 
 *         if not isinstance(key_length, int):             # <<<<<<<<<<<<<<
 *             raise ArgumentsBad("`key_length` is the length in bits.")
 * 
*/
  __pyx_t_3 = PyLong_Check(__pyx_v_key_length); 
  __pyx_t_2 = (!__pyx_t_3);
  if (unlikely(__pyx_t_2)) {

    /* "pkcs11/_pkcs11.pyx":1919
 * 
 *         if not isinstance(key_length, int):
 *             raise ArgumentsBad("`key_length` is the length in bits.")             # <<<<<<<<<<<<<<
 * 
 *         if capabilities is None:
*/
    __pyx_t_5 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_ArgumentsBad); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1919, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_5);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_key_length_is_the_length_in_bit};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1919, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 1919, __pyx_L1_error)

    /* "pkcs11/_pkcs11.pyx":1918
 *             raise ArgumentsBad("`key_type` must be KeyType.")
 * 
 *         if not isinstance(key_length, int):             # <<<<<<<<<<<<<<
 *             raise ArgumentsBad("`key_length` is the length in bits.")
 * 
*/
  }

  /* "pkcs11/_pkcs11.pyx":1921
 *             raise ArgumentsBad("`key_length` is the length in bits.")
 * 
 *         if capabilities is None:             # <<<<<<<<<<<<<<
 *             try:
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[key_type]
*/
  __pyx_t_2 = (__pyx_v_capabilities == Py_None);
  if (__pyx_t_2) {

    /* "pkcs11/_pkcs11.pyx":1922
 * 
 *         if capabilities is None:
 *             try:             # <<<<<<<<<<<<<<
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[key_type]
 *             except KeyError:
*/
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":1923
 *         if capabilities is None:
 *             try:
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[key_type]             # <<<<<<<<<<<<<<
 *             except KeyError:
 *                 raise ArgumentsBad("No default capabilities for this key "
*/
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_DEFAULT_KEY_CAPABILITIES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1923, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_key_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1923, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF_SET(__pyx_v_capabilities, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "pkcs11/_pkcs11.pyx":1922
 * 
 *         if capabilities is None:
 *             try:             # <<<<<<<<<<<<<<
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[key_type]
 *             except KeyError:
*/
      }
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L11_try_end;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "pkcs11/_pkcs11.pyx":1924
 *             try:
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[key_type]
 *             except KeyError:             # <<<<<<<<<<<<<<
 *                 raise ArgumentsBad("No default capabilities for this key "
 *                                    "type. Please specify `capabilities`.")
*/
      __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_KeyError))));
      if (__pyx_t_10) {
        __Pyx_AddTraceback("pkcs11._pkcs11.DeriveMixin.derive_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_1, &__pyx_t_5) < 0) __PYX_ERR(0, 1924, __pyx_L8_except_error)
        __Pyx_XGOTREF(__pyx_t_4);
        __Pyx_XGOTREF(__pyx_t_1);
        __Pyx_XGOTREF(__pyx_t_5);

        /* "pkcs11/_pkcs11.pyx":1925
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[key_type]
 *             except KeyError:
 *                 raise ArgumentsBad("No default capabilities for this key "             # <<<<<<<<<<<<<<
 *                                    "type. Please specify `capabilities`.")
 * 
*/
        __pyx_t_12 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_ArgumentsBad); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1925, __pyx_L8_except_error)
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_6 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_13))) {
          __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_13);
          assert(__pyx_t_12);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_13);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_13, __pyx__function);
          __pyx_t_6 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_mstate_global->__pyx_kp_u_No_default_capabilities_for_this};
          __pyx_t_11 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_13, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1925, __pyx_L8_except_error)
          __Pyx_GOTREF(__pyx_t_11);
        }
        __Pyx_Raise(__pyx_t_11, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __PYX_ERR(0, 1925, __pyx_L8_except_error)
      }
      goto __pyx_L8_except_error;

      /* "pkcs11/_pkcs11.pyx":1922
 * 
 *         if capabilities is None:
 *             try:             # <<<<<<<<<<<<<<
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[key_type]
 *             except KeyError:
*/
      __pyx_L8_except_error:;
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      goto __pyx_L1_error;
      __pyx_L11_try_end:;
    }

    /* "pkcs11/_pkcs11.pyx":1921
 *             raise ArgumentsBad("`key_length` is the length in bits.")
 * 
 *         if capabilities is None:             # <<<<<<<<<<<<<<
 *             try:
 *                 capabilities = DEFAULT_KEY_CAPABILITIES[key_type]
*/
  }

  /* "pkcs11/_pkcs11.pyx":1928
 *                                    "type. Please specify `capabilities`.")
 * 
 *         mech = MechanismWithParam(self.key_type, DEFAULT_DERIVE_MECHANISMS, mechanism, mechanism_param)             # <<<<<<<<<<<<<<
 * 
 *         cdef Session session = self.session
*/
  __pyx_t_1 = NULL;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_key_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1928, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_DEFAULT_DERIVE_MECHANISMS); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1928, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[5] = {__pyx_t_1, __pyx_t_4, __pyx_t_11, __pyx_v_mechanism, __pyx_v_mechanism_param};
    __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_MechanismWithParam, __pyx_callargs+__pyx_t_6, (5-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1928, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_5);
  }
  __pyx_v_mech = ((struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":1930
 *         mech = MechanismWithParam(self.key_type, DEFAULT_DERIVE_MECHANISMS, mechanism, mechanism_param)
 * 
 *         cdef Session session = self.session             # <<<<<<<<<<<<<<
 * 
 *         template_ = session.attribute_mapper.secret_key_template(
*/
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_session); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1930, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Session))))) __PYX_ERR(0, 1930, __pyx_L1_error)
  __pyx_v_session = ((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":1932
 *         cdef Session session = self.session
 * 
 *         template_ = session.attribute_mapper.secret_key_template(             # <<<<<<<<<<<<<<
 *             capabilities=capabilities, id_=id, label=label, store=store,
 *         )
*/
  __pyx_t_11 = __pyx_v_session->attribute_mapper;
  __Pyx_INCREF(__pyx_t_11);

  /* "pkcs11/_pkcs11.pyx":1933
 * 
 *         template_ = session.attribute_mapper.secret_key_template(
 *             capabilities=capabilities, id_=id, label=label, store=store,             # <<<<<<<<<<<<<<
 *         )
 *         template_[Attribute.KEY_TYPE] = key_type
*/
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 4 : 0)] = {__pyx_t_11, NULL};
    __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1932, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_capabilities, __pyx_v_capabilities, __pyx_t_4, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 1932, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_id_2, __pyx_v_id, __pyx_t_4, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 1932, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_label, __pyx_v_label, __pyx_t_4, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 1932, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_store, __pyx_v_store, __pyx_t_4, __pyx_callargs+1, 3) < (0)) __PYX_ERR(0, 1932, __pyx_L1_error)
    __pyx_t_5 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_secret_key_template, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1932, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __pyx_v_template_ = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":1935
 *             capabilities=capabilities, id_=id, label=label, store=store,
 *         )
 *         template_[Attribute.KEY_TYPE] = key_type             # <<<<<<<<<<<<<<
 *         template_[Attribute.VALUE_LEN] = key_length // 8  # In bytes
 *         cdef AttributeList attrs = session.make_attribute_list(merge_templates(template_, template))
*/
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Attribute); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_KEY_TYPE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely((PyObject_SetItem(__pyx_v_template_, __pyx_t_4, __pyx_v_key_type) < 0))) __PYX_ERR(0, 1935, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":1936
 *         )
 *         template_[Attribute.KEY_TYPE] = key_type
 *         template_[Attribute.VALUE_LEN] = key_length // 8  # In bytes             # <<<<<<<<<<<<<<
 *         cdef AttributeList attrs = session.make_attribute_list(merge_templates(template_, template))
 *         cdef CK_MECHANISM *mech_data = mech.data
*/
  __pyx_t_4 = __Pyx_PyLong_FloorDivideObjC(__pyx_v_key_length, __pyx_mstate_global->__pyx_int_8, 8, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1936, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Attribute); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1936, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_VALUE_LEN); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1936, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely((PyObject_SetItem(__pyx_v_template_, __pyx_t_11, __pyx_t_4) < 0))) __PYX_ERR(0, 1936, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":1937
 *         template_[Attribute.KEY_TYPE] = key_type
 *         template_[Attribute.VALUE_LEN] = key_length // 8  # In bytes
 *         cdef AttributeList attrs = session.make_attribute_list(merge_templates(template_, template))             # <<<<<<<<<<<<<<
 *         cdef CK_MECHANISM *mech_data = mech.data
 *         cdef CK_OBJECT_HANDLE src_key = self.handle
*/
  __pyx_t_11 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_merge_templates); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1937, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_5);
    assert(__pyx_t_11);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_11);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_11, __pyx_v_template_, __pyx_v_template};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1937, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_5 = ((PyObject *)((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_Session *)__pyx_v_session->__pyx_vtab)->make_attribute_list(__pyx_v_session, __pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1937, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_attrs = ((struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":1938
 *         template_[Attribute.VALUE_LEN] = key_length // 8  # In bytes
 *         cdef AttributeList attrs = session.make_attribute_list(merge_templates(template_, template))
 *         cdef CK_MECHANISM *mech_data = mech.data             # <<<<<<<<<<<<<<
 *         cdef CK_OBJECT_HANDLE src_key = self.handle
 *         cdef CK_ATTRIBUTE *attr_data = attrs.data
*/
  __pyx_t_14 = __pyx_v_mech->data;
  __pyx_v_mech_data = __pyx_t_14;

  /* "pkcs11/_pkcs11.pyx":1939
 *         cdef AttributeList attrs = session.make_attribute_list(merge_templates(template_, template))
 *         cdef CK_MECHANISM *mech_data = mech.data
 *         cdef CK_OBJECT_HANDLE src_key = self.handle             # <<<<<<<<<<<<<<
 *         cdef CK_ATTRIBUTE *attr_data = attrs.data
 *         cdef CK_ULONG attr_count = attrs.count
*/
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_handle); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1939, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_15 = __Pyx_PyLong_As_CK_ULONG(__pyx_t_5); if (unlikely((__pyx_t_15 == ((CK_OBJECT_HANDLE)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1939, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_src_key = __pyx_t_15;

  /* "pkcs11/_pkcs11.pyx":1940
 *         cdef CK_MECHANISM *mech_data = mech.data
 *         cdef CK_OBJECT_HANDLE src_key = self.handle
 *         cdef CK_ATTRIBUTE *attr_data = attrs.data             # <<<<<<<<<<<<<<
 *         cdef CK_ULONG attr_count = attrs.count
 *         cdef CK_OBJECT_HANDLE key
*/
  __pyx_t_16 = __pyx_v_attrs->data;
  __pyx_v_attr_data = __pyx_t_16;

  /* "pkcs11/_pkcs11.pyx":1941
 *         cdef CK_OBJECT_HANDLE src_key = self.handle
 *         cdef CK_ATTRIBUTE *attr_data = attrs.data
 *         cdef CK_ULONG attr_count = attrs.count             # <<<<<<<<<<<<<<
 *         cdef CK_OBJECT_HANDLE key
 *         cdef CK_RV retval
*/
  __pyx_t_17 = __pyx_v_attrs->count;
  __pyx_v_attr_count = __pyx_t_17;

  /* "pkcs11/_pkcs11.pyx":1945
 *         cdef CK_RV retval
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = session.funclist.C_DeriveKey(session.handle, mech_data, src_key, attr_data, attr_count, &key)
 *         assertRV(retval)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":1946
 * 
 *         with nogil:
 *             retval = session.funclist.C_DeriveKey(session.handle, mech_data, src_key, attr_data, attr_count, &key)             # <<<<<<<<<<<<<<
 *         assertRV(retval)
 * 
*/
        __pyx_v_retval = __pyx_v_session->__pyx_base.funclist->C_DeriveKey(__pyx_v_session->handle, __pyx_v_mech_data, __pyx_v_src_key, __pyx_v_attr_data, __pyx_v_attr_count, (&__pyx_v_key));
      }

      /* "pkcs11/_pkcs11.pyx":1945
 *         cdef CK_RV retval
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = session.funclist.C_DeriveKey(session.handle, mech_data, src_key, attr_data, attr_count, &key)
 *         assertRV(retval)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L16;
        }
        __pyx_L16:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":1947
 *         with nogil:
 *             retval = session.funclist.C_DeriveKey(session.handle, mech_data, src_key, attr_data, attr_count, &key)
 *         assertRV(retval)             # <<<<<<<<<<<<<<
 * 
 *         return make_object(session, key)
*/
  __pyx_t_5 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1947, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1947, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":1949
 *         assertRV(retval)
 * 
 *         return make_object(session, key)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __pyx_f_6pkcs11_7_pkcs11_make_object(__pyx_v_session, __pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1949, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":1909
 *     """Expand DeriveMixin with an implementation."""
 * 
 *     def derive_key(self, key_type, key_length,             # <<<<<<<<<<<<<<
 *                    id=None, label=None,
 *                    store=False, capabilities=None,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("pkcs11._pkcs11.DeriveMixin.derive_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mech);
  __Pyx_XDECREF((PyObject *)__pyx_v_session);
  __Pyx_XDECREF(__pyx_v_template_);
  __Pyx_XDECREF((PyObject *)__pyx_v_attrs);
  __Pyx_XDECREF(__pyx_v_capabilities);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":1985
 *     cdef P11_HANDLE *_p11_handle
 * 
 *     cdef _load_pkcs11_lib(self, so) with gil:             # <<<<<<<<<<<<<<
 *         """Load a PKCS#11 library, and extract function calls.
 * 
*/

static PyObject *__pyx_f_6pkcs11_7_pkcs11_3lib__load_pkcs11_lib(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self, PyObject *__pyx_v_so) {
  __pyx_t_6pkcs11_7_pkcs11_C_GetFunctionList_ptr __pyx_v_populate_function_list;
  P11_HANDLE *__pyx_v_handle;
  PyObject *__pyx_v_err = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7[4];
  PyObject *__pyx_t_8 = NULL;
  size_t __pyx_t_9;
  CK_RV __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_load_pkcs11_lib", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_v_so);

  /* "pkcs11/_pkcs11.pyx":2005
 *         cdef CK_RV retval
 * 
 *         cdef P11_HANDLE *handle = p11_open(so)             # <<<<<<<<<<<<<<
 *         if handle == NULL:
 *             err = <str> p11_error()
*/
  __pyx_v_handle = p11_open(__pyx_v_so);

  /* "pkcs11/_pkcs11.pyx":2006
 * 
 *         cdef P11_HANDLE *handle = p11_open(so)
 *         if handle == NULL:             # <<<<<<<<<<<<<<
 *             err = <str> p11_error()
 *             if err:
*/
  __pyx_t_1 = (__pyx_v_handle == NULL);
  if (__pyx_t_1) {

    /* "pkcs11/_pkcs11.pyx":2007
 *         cdef P11_HANDLE *handle = p11_open(so)
 *         if handle == NULL:
 *             err = <str> p11_error()             # <<<<<<<<<<<<<<
 *             if err:
 *                 raise PKCS11Error(f"OS exception while loading {so}: {err}")
*/
    __pyx_t_2 = p11_error(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2007, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __pyx_t_2;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_err = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "pkcs11/_pkcs11.pyx":2008
 *         if handle == NULL:
 *             err = <str> p11_error()
 *             if err:             # <<<<<<<<<<<<<<
 *                 raise PKCS11Error(f"OS exception while loading {so}: {err}")
 *             else:
*/
    if (__pyx_v_err == Py_None) __pyx_t_1 = 0;
    else
    {
      Py_ssize_t __pyx_temp = __Pyx_PyUnicode_IS_TRUE(__pyx_v_err);
      if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(0, 2008, __pyx_L1_error)
      __pyx_t_1 = (__pyx_temp != 0);
    }

    if (unlikely(__pyx_t_1)) {

      /* "pkcs11/_pkcs11.pyx":2009
 *             err = <str> p11_error()
 *             if err:
 *                 raise PKCS11Error(f"OS exception while loading {so}: {err}")             # <<<<<<<<<<<<<<
 *             else:
 *                 raise PKCS11Error(f"Unknown exception while loading {so}")
*/
      __pyx_t_2 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_PKCS11Error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2009, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_so, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2009, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyUnicode_Unicode(__pyx_v_err); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2009, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u_OS_exception_while_loading;
      __pyx_t_7[1] = __pyx_t_5;
      __pyx_t_7[2] = __pyx_mstate_global->__pyx_kp_u_;
      __pyx_t_7[3] = __pyx_t_6;
      __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_7, 4, 27 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6));
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2009, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_9 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
        assert(__pyx_t_2);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
        __pyx_t_9 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_8};
        __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2009, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(0, 2009, __pyx_L1_error)

      /* "pkcs11/_pkcs11.pyx":2008
 *         if handle == NULL:
 *             err = <str> p11_error()
 *             if err:             # <<<<<<<<<<<<<<
 *                 raise PKCS11Error(f"OS exception while loading {so}: {err}")
 *             else:
*/
    }

    /* "pkcs11/_pkcs11.pyx":2011
 *                 raise PKCS11Error(f"OS exception while loading {so}: {err}")
 *             else:
 *                 raise PKCS11Error(f"Unknown exception while loading {so}")             # <<<<<<<<<<<<<<
 *         populate_function_list = <C_GetFunctionList_ptr> handle.get_function_list_ptr
 *         self._p11_handle = handle
*/
    /*else*/ {
      __pyx_t_4 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_PKCS11Error); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2011, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_so, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2011, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Unknown_exception_while_loading, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2011, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_9 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8);
        assert(__pyx_t_4);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
        __pyx_t_9 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_6};
        __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2011, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(0, 2011, __pyx_L1_error)
    }

    /* "pkcs11/_pkcs11.pyx":2006
 * 
 *         cdef P11_HANDLE *handle = p11_open(so)
 *         if handle == NULL:             # <<<<<<<<<<<<<<
 *             err = <str> p11_error()
 *             if err:
*/
  }

  /* "pkcs11/_pkcs11.pyx":2012
 *             else:
 *                 raise PKCS11Error(f"Unknown exception while loading {so}")
 *         populate_function_list = <C_GetFunctionList_ptr> handle.get_function_list_ptr             # <<<<<<<<<<<<<<
 *         self._p11_handle = handle
 * 
*/
  __pyx_v_populate_function_list = ((__pyx_t_6pkcs11_7_pkcs11_C_GetFunctionList_ptr)__pyx_v_handle->get_function_list_ptr);

  /* "pkcs11/_pkcs11.pyx":2013
 *                 raise PKCS11Error(f"Unknown exception while loading {so}")
 *         populate_function_list = <C_GetFunctionList_ptr> handle.get_function_list_ptr
 *         self._p11_handle = handle             # <<<<<<<<<<<<<<
 * 
 *         assertRV(populate_function_list(&self.funclist))
*/
  __pyx_v_self->_p11_handle = __pyx_v_handle;

  /* "pkcs11/_pkcs11.pyx":2015
 *         self._p11_handle = handle
 * 
 *         assertRV(populate_function_list(&self.funclist))             # <<<<<<<<<<<<<<
 * 
 *     def __cinit__(self, so):
*/
  __pyx_t_10 = __pyx_v_populate_function_list((&__pyx_v_self->__pyx_base.funclist)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2015, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyLong_From_CK_RV(__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_8 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "pkcs11/_pkcs11.pyx":1985
 *     cdef P11_HANDLE *_p11_handle
 * 
 *     cdef _load_pkcs11_lib(self, so) with gil:             # <<<<<<<<<<<<<<
 *         """Load a PKCS#11 library, and extract function calls.
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pkcs11._pkcs11.lib._load_pkcs11_lib", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_err);
  __Pyx_XDECREF((PyObject *)__pyx_v_self);
  __Pyx_XDECREF(__pyx_v_so);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":2017
 *         assertRV(populate_function_list(&self.funclist))
 * 
 *     def __cinit__(self, so):             # <<<<<<<<<<<<<<
 *         cdef CK_RV retval
 *         self._p11_handle = NULL
*/

/* Python wrapper */
static int __pyx_pw_6pkcs11_7_pkcs11_3lib_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6pkcs11_7_pkcs11_3lib_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_so = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_so,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 2017, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2017, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(0, 2017, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, i); __PYX_ERR(0, 2017, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2017, __pyx_L3_error)
    }
    __pyx_v_so = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2017, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.lib.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_3lib___cinit__(((struct __pyx_obj_6pkcs11_7_pkcs11_lib *)__pyx_v_self), __pyx_v_so);

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

static int __pyx_pf_6pkcs11_7_pkcs11_3lib___cinit__(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self, PyObject *__pyx_v_so) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "pkcs11/_pkcs11.pyx":2019
 *     def __cinit__(self, so):
 *         cdef CK_RV retval
 *         self._p11_handle = NULL             # <<<<<<<<<<<<<<
 *         self._load_pkcs11_lib(so)
 *         self.initialized = False
*/
  __pyx_v_self->_p11_handle = NULL;

  /* "pkcs11/_pkcs11.pyx":2020
 *         cdef CK_RV retval
 *         self._p11_handle = NULL
 *         self._load_pkcs11_lib(so)             # <<<<<<<<<<<<<<
 *         self.initialized = False
 *         # at this point, _funclist contains all function pointers to the library
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_lib *)__pyx_v_self->__pyx_vtab)->_load_pkcs11_lib(__pyx_v_self, __pyx_v_so); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2020, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":2021
 *         self._p11_handle = NULL
 *         self._load_pkcs11_lib(so)
 *         self.initialized = False             # <<<<<<<<<<<<<<
 *         # at this point, _funclist contains all function pointers to the library
 * 
*/
  __pyx_v_self->initialized = 0;

  /* "pkcs11/_pkcs11.pyx":2017
 *         assertRV(populate_function_list(&self.funclist))
 * 
 *     def __cinit__(self, so):             # <<<<<<<<<<<<<<
 *         cdef CK_RV retval
 *         self._p11_handle = NULL
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pkcs11._pkcs11.lib.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":2024
 *         # at this point, _funclist contains all function pointers to the library
 * 
 *     cpdef initialize(self):             # <<<<<<<<<<<<<<
 *         cdef CK_RV retval
 *         if self.funclist != NULL and not self.initialized:
*/

static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_3initialize(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_6pkcs11_7_pkcs11_3lib_initialize(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self, int __pyx_skip_dispatch) {
  CK_RV __pyx_v_retval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("initialize", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (
  #if !CYTHON_USE_TYPE_SLOTS
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_lib &&
  __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
  #else
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
  #endif
  ) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_initialize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2024, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6pkcs11_7_pkcs11_3lib_3initialize)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; 
        __pyx_t_5 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_5 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
          __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2024, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "pkcs11/_pkcs11.pyx":2026
 *     cpdef initialize(self):
 *         cdef CK_RV retval
 *         if self.funclist != NULL and not self.initialized:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 retval = self.funclist.C_Initialize(NULL)
*/
  __pyx_t_7 = (__pyx_v_self->__pyx_base.funclist != NULL);
  if (__pyx_t_7) {
  } else {
    __pyx_t_6 = __pyx_t_7;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_7 = (!__pyx_v_self->initialized);
  __pyx_t_6 = __pyx_t_7;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_6) {

    /* "pkcs11/_pkcs11.pyx":2027
 *         cdef CK_RV retval
 *         if self.funclist != NULL and not self.initialized:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 retval = self.funclist.C_Initialize(NULL)
 *             assertRV(retval)
*/
    {
        PyThreadState * _save;
        _save = PyEval_SaveThread();
        __Pyx_FastGIL_Remember();
        /*try:*/ {

          /* "pkcs11/_pkcs11.pyx":2028
 *         if self.funclist != NULL and not self.initialized:
 *             with nogil:
 *                 retval = self.funclist.C_Initialize(NULL)             # <<<<<<<<<<<<<<
 *             assertRV(retval)
 *             self.initialized = True
*/
          __pyx_v_retval = __pyx_v_self->__pyx_base.funclist->C_Initialize(NULL);
        }

        /* "pkcs11/_pkcs11.pyx":2027
 *         cdef CK_RV retval
 *         if self.funclist != NULL and not self.initialized:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 retval = self.funclist.C_Initialize(NULL)
 *             assertRV(retval)
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_FastGIL_Forget();
            PyEval_RestoreThread(_save);
            goto __pyx_L8;
          }
          __pyx_L8:;
        }
    }

    /* "pkcs11/_pkcs11.pyx":2029
 *             with nogil:
 *                 retval = self.funclist.C_Initialize(NULL)
 *             assertRV(retval)             # <<<<<<<<<<<<<<
 *             self.initialized = True
 * 
*/
    __pyx_t_1 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2029, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2029, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pkcs11/_pkcs11.pyx":2030
 *                 retval = self.funclist.C_Initialize(NULL)
 *             assertRV(retval)
 *             self.initialized = True             # <<<<<<<<<<<<<<
 * 
 *     cdef CK_RV _finalize(self):
*/
    __pyx_v_self->initialized = 1;

    /* "pkcs11/_pkcs11.pyx":2026
 *     cpdef initialize(self):
 *         cdef CK_RV retval
 *         if self.funclist != NULL and not self.initialized:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 retval = self.funclist.C_Initialize(NULL)
*/
  }

  /* "pkcs11/_pkcs11.pyx":2024
 *         # at this point, _funclist contains all function pointers to the library
 * 
 *     cpdef initialize(self):             # <<<<<<<<<<<<<<
 *         cdef CK_RV retval
 *         if self.funclist != NULL and not self.initialized:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pkcs11._pkcs11.lib.initialize", __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_6pkcs11_7_pkcs11_3lib_3initialize(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_3lib_3initialize = {"initialize", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_3lib_3initialize, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_3initialize(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("initialize (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("initialize", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("initialize", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_3lib_2initialize(((struct __pyx_obj_6pkcs11_7_pkcs11_lib *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_2initialize(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("initialize", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pkcs11_7_pkcs11_3lib_initialize(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2024, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pkcs11._pkcs11.lib.initialize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":2032
 *             self.initialized = True
 * 
 *     cdef CK_RV _finalize(self):             # <<<<<<<<<<<<<<
 *         cdef CK_RV retval = CKR_OK
 *         if self.funclist != NULL and self.initialized:
*/

static CK_RV __pyx_f_6pkcs11_7_pkcs11_3lib__finalize(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self) {
  CK_RV __pyx_v_retval;
  CK_RV __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "pkcs11/_pkcs11.pyx":2033
 * 
 *     cdef CK_RV _finalize(self):
 *         cdef CK_RV retval = CKR_OK             # <<<<<<<<<<<<<<
 *         if self.funclist != NULL and self.initialized:
 *             retval = self.funclist.C_Finalize(NULL)
*/
  __pyx_v_retval = CKR_OK;

  /* "pkcs11/_pkcs11.pyx":2034
 *     cdef CK_RV _finalize(self):
 *         cdef CK_RV retval = CKR_OK
 *         if self.funclist != NULL and self.initialized:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_Finalize(NULL)
 *             self.initialized = False
*/
  __pyx_t_2 = (__pyx_v_self->__pyx_base.funclist != NULL);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_1 = __pyx_v_self->initialized;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "pkcs11/_pkcs11.pyx":2035
 *         cdef CK_RV retval = CKR_OK
 *         if self.funclist != NULL and self.initialized:
 *             retval = self.funclist.C_Finalize(NULL)             # <<<<<<<<<<<<<<
 *             self.initialized = False
 *         return retval
*/
    __pyx_v_retval = __pyx_v_self->__pyx_base.funclist->C_Finalize(NULL);

    /* "pkcs11/_pkcs11.pyx":2036
 *         if self.funclist != NULL and self.initialized:
 *             retval = self.funclist.C_Finalize(NULL)
 *             self.initialized = False             # <<<<<<<<<<<<<<
 *         return retval
 * 
*/
    __pyx_v_self->initialized = 0;

    /* "pkcs11/_pkcs11.pyx":2034
 *     cdef CK_RV _finalize(self):
 *         cdef CK_RV retval = CKR_OK
 *         if self.funclist != NULL and self.initialized:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_Finalize(NULL)
 *             self.initialized = False
*/
  }

  /* "pkcs11/_pkcs11.pyx":2037
 *             retval = self.funclist.C_Finalize(NULL)
 *             self.initialized = False
 *         return retval             # <<<<<<<<<<<<<<
 * 
 *     def finalize(self):
*/
  __pyx_r = __pyx_v_retval;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":2032
 *             self.initialized = True
 * 
 *     cdef CK_RV _finalize(self):             # <<<<<<<<<<<<<<
 *         cdef CK_RV retval = CKR_OK
 *         if self.funclist != NULL and self.initialized:
*/

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

/* "pkcs11/_pkcs11.pyx":2039
 *         return retval
 * 
 *     def finalize(self):             # <<<<<<<<<<<<<<
 *         assertRV(self._finalize())
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_5finalize(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_3lib_5finalize = {"finalize", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_3lib_5finalize, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_5finalize(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("finalize (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("finalize", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("finalize", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_3lib_4finalize(((struct __pyx_obj_6pkcs11_7_pkcs11_lib *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_4finalize(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  CK_RV __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("finalize", 0);

  /* "pkcs11/_pkcs11.pyx":2040
 * 
 *     def finalize(self):
 *         assertRV(self._finalize())             # <<<<<<<<<<<<<<
 * 
 *     def reinitialize(self):
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_lib *)__pyx_v_self->__pyx_vtab)->_finalize(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2040, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyLong_From_CK_RV(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2040, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2040, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pkcs11/_pkcs11.pyx":2039
 *         return retval
 * 
 *     def finalize(self):             # <<<<<<<<<<<<<<
 *         assertRV(self._finalize())
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pkcs11._pkcs11.lib.finalize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":2042
 *         assertRV(self._finalize())
 * 
 *     def reinitialize(self):             # <<<<<<<<<<<<<<
 *         if self.funclist != NULL:
 *             self.finalize()
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_7reinitialize(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_3lib_7reinitialize = {"reinitialize", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_3lib_7reinitialize, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_7reinitialize(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reinitialize (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("reinitialize", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("reinitialize", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_3lib_6reinitialize(((struct __pyx_obj_6pkcs11_7_pkcs11_lib *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_6reinitialize(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reinitialize", 0);

  /* "pkcs11/_pkcs11.pyx":2043
 * 
 *     def reinitialize(self):
 *         if self.funclist != NULL:             # <<<<<<<<<<<<<<
 *             self.finalize()
 *             self.initialize()
*/
  __pyx_t_1 = (__pyx_v_self->__pyx_base.funclist != NULL);
  if (__pyx_t_1) {

    /* "pkcs11/_pkcs11.pyx":2044
 *     def reinitialize(self):
 *         if self.funclist != NULL:
 *             self.finalize()             # <<<<<<<<<<<<<<
 *             self.initialize()
 * 
*/
    __pyx_t_3 = ((PyObject *)__pyx_v_self);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_finalize_2, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2044, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pkcs11/_pkcs11.pyx":2045
 *         if self.funclist != NULL:
 *             self.finalize()
 *             self.initialize()             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, so):
*/
    __pyx_t_2 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_lib *)__pyx_v_self->__pyx_vtab)->initialize(__pyx_v_self, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2045, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pkcs11/_pkcs11.pyx":2043
 * 
 *     def reinitialize(self):
 *         if self.funclist != NULL:             # <<<<<<<<<<<<<<
 *             self.finalize()
 *             self.initialize()
*/
  }

  /* "pkcs11/_pkcs11.pyx":2042
 *         assertRV(self._finalize())
 * 
 *     def reinitialize(self):             # <<<<<<<<<<<<<<
 *         if self.funclist != NULL:
 *             self.finalize()
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pkcs11._pkcs11.lib.reinitialize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":2047
 *             self.initialize()
 * 
 *     def __init__(self, so):             # <<<<<<<<<<<<<<
 *         self.so = so
 *         cdef CK_INFO info
*/

/* Python wrapper */
static int __pyx_pw_6pkcs11_7_pkcs11_3lib_9__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6pkcs11_7_pkcs11_3lib_9__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_so = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_so,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 2047, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2047, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 2047, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, i); __PYX_ERR(0, 2047, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2047, __pyx_L3_error)
    }
    __pyx_v_so = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2047, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.lib.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_3lib_8__init__(((struct __pyx_obj_6pkcs11_7_pkcs11_lib *)__pyx_v_self), __pyx_v_so);

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

static int __pyx_pf_6pkcs11_7_pkcs11_3lib_8__init__(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self, PyObject *__pyx_v_so) {
  CK_INFO __pyx_v_info;
  CK_RV __pyx_v_retval;
  PyObject *__pyx_v_manufacturerID = NULL;
  PyObject *__pyx_v_libraryDescription = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  CK_VERSION __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pkcs11/_pkcs11.pyx":2048
 * 
 *     def __init__(self, so):
 *         self.so = so             # <<<<<<<<<<<<<<
 *         cdef CK_INFO info
 *         cdef CK_RV retval
*/
  __pyx_t_1 = __pyx_v_so;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_1))) __PYX_ERR(0, 2048, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->so);
  __Pyx_DECREF(__pyx_v_self->so);
  __pyx_v_self->so = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":2052
 *         cdef CK_RV retval
 * 
 *         self.initialize()             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_lib *)__pyx_v_self->__pyx_vtab)->initialize(__pyx_v_self, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2052, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":2054
 *         self.initialize()
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_GetInfo(&info)
 *         assertRV(retval)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":2055
 * 
 *         with nogil:
 *             retval = self.funclist.C_GetInfo(&info)             # <<<<<<<<<<<<<<
 *         assertRV(retval)
 * 
*/
        __pyx_v_retval = __pyx_v_self->__pyx_base.funclist->C_GetInfo((&__pyx_v_info));
      }

      /* "pkcs11/_pkcs11.pyx":2054
 *         self.initialize()
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_GetInfo(&info)
 *         assertRV(retval)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":2056
 *         with nogil:
 *             retval = self.funclist.C_GetInfo(&info)
 *         assertRV(retval)             # <<<<<<<<<<<<<<
 * 
 *         manufacturerID = info.manufacturerID[:sizeof(info.manufacturerID)]
*/
  __pyx_t_1 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2056, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2056, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pkcs11/_pkcs11.pyx":2058
 *         assertRV(retval)
 * 
 *         manufacturerID = info.manufacturerID[:sizeof(info.manufacturerID)]             # <<<<<<<<<<<<<<
 *         libraryDescription = info.libraryDescription[:sizeof(info.libraryDescription)]
 * 
*/
  __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(((char const *)__pyx_v_info.manufacturerID) + 0, (sizeof(__pyx_v_info.manufacturerID)) - 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2058, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_manufacturerID = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pkcs11/_pkcs11.pyx":2059
 * 
 *         manufacturerID = info.manufacturerID[:sizeof(info.manufacturerID)]
 *         libraryDescription = info.libraryDescription[:sizeof(info.libraryDescription)]             # <<<<<<<<<<<<<<
 * 
 *         self.manufacturer_id = _CK_UTF8CHAR_to_str(manufacturerID)
*/
  __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(((char const *)__pyx_v_info.libraryDescription) + 0, (sizeof(__pyx_v_info.libraryDescription)) - 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2059, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_libraryDescription = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pkcs11/_pkcs11.pyx":2061
 *         libraryDescription = info.libraryDescription[:sizeof(info.libraryDescription)]
 * 
 *         self.manufacturer_id = _CK_UTF8CHAR_to_str(manufacturerID)             # <<<<<<<<<<<<<<
 *         self.library_description = _CK_UTF8CHAR_to_str(libraryDescription)
 *         self._cryptoki_version = info.cryptokiVersion
*/
  __pyx_t_1 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_CK_UTF8CHAR_to_str); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2061, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_1);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_manufacturerID};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2061, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (!(likely(PyUnicode_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_2))) __PYX_ERR(0, 2061, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->manufacturer_id);
  __Pyx_DECREF(__pyx_v_self->manufacturer_id);
  __pyx_v_self->manufacturer_id = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pkcs11/_pkcs11.pyx":2062
 * 
 *         self.manufacturer_id = _CK_UTF8CHAR_to_str(manufacturerID)
 *         self.library_description = _CK_UTF8CHAR_to_str(libraryDescription)             # <<<<<<<<<<<<<<
 *         self._cryptoki_version = info.cryptokiVersion
 *         self._library_version = info.libraryVersion
*/
  __pyx_t_3 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_CK_UTF8CHAR_to_str); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2062, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
    assert(__pyx_t_3);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_libraryDescription};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2062, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (!(likely(PyUnicode_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_2))) __PYX_ERR(0, 2062, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->library_description);
  __Pyx_DECREF(__pyx_v_self->library_description);
  __pyx_v_self->library_description = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pkcs11/_pkcs11.pyx":2063
 *         self.manufacturer_id = _CK_UTF8CHAR_to_str(manufacturerID)
 *         self.library_description = _CK_UTF8CHAR_to_str(libraryDescription)
 *         self._cryptoki_version = info.cryptokiVersion             # <<<<<<<<<<<<<<
 *         self._library_version = info.libraryVersion
 * 
*/
  __pyx_t_5 = __pyx_v_info.cryptokiVersion;
  __pyx_v_self->_cryptoki_version = __pyx_t_5;

  /* "pkcs11/_pkcs11.pyx":2064
 *         self.library_description = _CK_UTF8CHAR_to_str(libraryDescription)
 *         self._cryptoki_version = info.cryptokiVersion
 *         self._library_version = info.libraryVersion             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_t_5 = __pyx_v_info.libraryVersion;
  __pyx_v_self->_library_version = __pyx_t_5;

  /* "pkcs11/_pkcs11.pyx":2047
 *             self.initialize()
 * 
 *     def __init__(self, so):             # <<<<<<<<<<<<<<
 *         self.so = so
 *         cdef CK_INFO info
*/

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

/* "pkcs11/_pkcs11.pyx":2066
 *         self._library_version = info.libraryVersion
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def library_version(self):
 *         """Hardware version (:class:`tuple`)."""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_15library_version_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_15library_version_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_3lib_15library_version___get__(((struct __pyx_obj_6pkcs11_7_pkcs11_lib *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_15library_version___get__(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "pkcs11/_pkcs11.pyx":2069
 *     def library_version(self):
 *         """Hardware version (:class:`tuple`)."""
 *         return _CK_VERSION_to_tuple(self._library_version)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_CK_VERSION_to_tuple); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2069, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_convert__to_py_CK_VERSION(__pyx_v_self->_library_version); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2069, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2069, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":2066
 *         self._library_version = info.libraryVersion
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def library_version(self):
 *         """Hardware version (:class:`tuple`)."""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pkcs11._pkcs11.lib.library_version.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":2071
 *         return _CK_VERSION_to_tuple(self._library_version)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def cryptoki_version(self):
 *         """PKCS#11 (cryptoki) API version (:class:`tuple`)."""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_16cryptoki_version_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_16cryptoki_version_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_3lib_16cryptoki_version___get__(((struct __pyx_obj_6pkcs11_7_pkcs11_lib *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_16cryptoki_version___get__(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "pkcs11/_pkcs11.pyx":2074
 *     def cryptoki_version(self):
 *         """PKCS#11 (cryptoki) API version (:class:`tuple`)."""
 *         return _CK_VERSION_to_tuple(self._cryptoki_version)             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_CK_VERSION_to_tuple); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2074, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_convert__to_py_CK_VERSION(__pyx_v_self->_cryptoki_version); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2074, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2074, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":2071
 *         return _CK_VERSION_to_tuple(self._library_version)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def cryptoki_version(self):
 *         """PKCS#11 (cryptoki) API version (:class:`tuple`)."""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pkcs11._pkcs11.lib.cryptoki_version.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":2076
 *         return _CK_VERSION_to_tuple(self._cryptoki_version)
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return '\n'.join((
 *             "Library: %s" % self.so,
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_11__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_11__str__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_3lib_10__str__(((struct __pyx_obj_6pkcs11_7_pkcs11_lib *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_10__str__(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "pkcs11/_pkcs11.pyx":2077
 * 
 *     def __str__(self):
 *         return '\n'.join((             # <<<<<<<<<<<<<<
 *             "Library: %s" % self.so,
 *             "Manufacturer ID: %s" % self.manufacturer_id,
*/
  __Pyx_XDECREF(__pyx_r);

  /* "pkcs11/_pkcs11.pyx":2078
 *     def __str__(self):
 *         return '\n'.join((
 *             "Library: %s" % self.so,             # <<<<<<<<<<<<<<
 *             "Manufacturer ID: %s" % self.manufacturer_id,
 *             "Library Description: %s" % self.library_description,
*/
  __pyx_t_1 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_Library_s, __pyx_v_self->so); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2078, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "pkcs11/_pkcs11.pyx":2079
 *         return '\n'.join((
 *             "Library: %s" % self.so,
 *             "Manufacturer ID: %s" % self.manufacturer_id,             # <<<<<<<<<<<<<<
 *             "Library Description: %s" % self.library_description,
 *             "Cryptoki Version: %s.%s" % self.cryptoki_version,
*/
  __pyx_t_2 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_Manufacturer_ID_s, __pyx_v_self->manufacturer_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2079, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "pkcs11/_pkcs11.pyx":2080
 *             "Library: %s" % self.so,
 *             "Manufacturer ID: %s" % self.manufacturer_id,
 *             "Library Description: %s" % self.library_description,             # <<<<<<<<<<<<<<
 *             "Cryptoki Version: %s.%s" % self.cryptoki_version,
 *             "Library Version: %s.%s" % self.library_version,
*/
  __pyx_t_3 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_Library_Description_s, __pyx_v_self->library_description); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2080, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "pkcs11/_pkcs11.pyx":2081
 *             "Manufacturer ID: %s" % self.manufacturer_id,
 *             "Library Description: %s" % self.library_description,
 *             "Cryptoki Version: %s.%s" % self.cryptoki_version,             # <<<<<<<<<<<<<<
 *             "Library Version: %s.%s" % self.library_version,
 *         ))
*/
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_cryptoki_version); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2081, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_Cryptoki_Version_s_s, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2081, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":2082
 *             "Library Description: %s" % self.library_description,
 *             "Cryptoki Version: %s.%s" % self.cryptoki_version,
 *             "Library Version: %s.%s" % self.library_version,             # <<<<<<<<<<<<<<
 *         ))
 * 
*/
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_library_version); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2082, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_Library_Version_s_s, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2082, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":2078
 *     def __str__(self):
 *         return '\n'.join((
 *             "Library: %s" % self.so,             # <<<<<<<<<<<<<<
 *             "Manufacturer ID: %s" % self.manufacturer_id,
 *             "Library Description: %s" % self.library_description,
*/
  __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2078, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 2078, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 2078, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 2078, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_5);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_5) != (0)) __PYX_ERR(0, 2078, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_6);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_t_6) != (0)) __PYX_ERR(0, 2078, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;

  /* "pkcs11/_pkcs11.pyx":2077
 * 
 *     def __str__(self):
 *         return '\n'.join((             # <<<<<<<<<<<<<<
 *             "Library: %s" % self.so,
 *             "Manufacturer ID: %s" % self.manufacturer_id,
*/
  __pyx_t_6 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__8, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2077, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":2076
 *         return _CK_VERSION_to_tuple(self._cryptoki_version)
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return '\n'.join((
 *             "Library: %s" % self.so,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pkcs11._pkcs11.lib.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":2085
 *         ))
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '<pkcs11.lib ({so})>'.format(
 *             so=self.so)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_13__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_13__repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_3lib_12__repr__(((struct __pyx_obj_6pkcs11_7_pkcs11_lib *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_12__repr__(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "pkcs11/_pkcs11.pyx":2086
 * 
 *     def __repr__(self):
 *         return '<pkcs11.lib ({so})>'.format(             # <<<<<<<<<<<<<<
 *             so=self.so)
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_mstate_global->__pyx_kp_u_pkcs11_lib_so;
  __Pyx_INCREF(__pyx_t_2);

  /* "pkcs11/_pkcs11.pyx":2087
 *     def __repr__(self):
 *         return '<pkcs11.lib ({so})>'.format(
 *             so=self.so)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, NULL};
    __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2086, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_so, __pyx_v_self->so, __pyx_t_4, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 2086, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2086, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":2085
 *         ))
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '<pkcs11.lib ({so})>'.format(
 *             so=self.so)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pkcs11._pkcs11.lib.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":2090
 * 
 * 
 *     def get_slots(self, token_present=False):             # <<<<<<<<<<<<<<
 *         """Get all slots."""
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_15get_slots(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6pkcs11_7_pkcs11_3lib_14get_slots, "Get all slots.");
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_3lib_15get_slots = {"get_slots", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_3lib_15get_slots, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6pkcs11_7_pkcs11_3lib_14get_slots};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_15get_slots(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_token_present = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_slots (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_token_present,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 2090, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2090, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_slots", 0) < (0)) __PYX_ERR(0, 2090, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_False));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2090, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_False));
    }
    __pyx_v_token_present = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_slots", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 2090, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.lib.get_slots", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_3lib_14get_slots(((struct __pyx_obj_6pkcs11_7_pkcs11_lib *)__pyx_v_self), __pyx_v_token_present);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_14get_slots(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self, PyObject *__pyx_v_token_present) {
  CK_BBOOL __pyx_v_present;
  CK_ULONG __pyx_v_count;
  CK_RV __pyx_v_retval;
  __Pyx_memviewslice __pyx_v_slot_list = { 0, 0, { 0 }, { 0 }, { 0 } };
  CK_SLOT_ID __pyx_v_slot_id;
  CK_SLOT_INFO __pyx_v_info;
  PyObject *__pyx_v_slots = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  CK_BBOOL __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_slots", 0);

  /* "pkcs11/_pkcs11.pyx":2093
 *         """Get all slots."""
 * 
 *         cdef CK_BBOOL present = token_present             # <<<<<<<<<<<<<<
 *         cdef CK_ULONG count
 *         cdef CK_RV retval
*/
  __pyx_t_1 = __Pyx_PyLong_As_CK_BYTE(__pyx_v_token_present); if (unlikely((__pyx_t_1 == ((CK_BBOOL)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2093, __pyx_L1_error)
  __pyx_v_present = __pyx_t_1;

  /* "pkcs11/_pkcs11.pyx":2097
 *         cdef CK_RV retval
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_GetSlotList(present, NULL, &count)
 *         assertRV(retval)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":2098
 * 
 *         with nogil:
 *             retval = self.funclist.C_GetSlotList(present, NULL, &count)             # <<<<<<<<<<<<<<
 *         assertRV(retval)
 * 
*/
        __pyx_v_retval = __pyx_v_self->__pyx_base.funclist->C_GetSlotList(__pyx_v_present, NULL, (&__pyx_v_count));
      }

      /* "pkcs11/_pkcs11.pyx":2097
 *         cdef CK_RV retval
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_GetSlotList(present, NULL, &count)
 *         assertRV(retval)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":2099
 *         with nogil:
 *             retval = self.funclist.C_GetSlotList(present, NULL, &count)
 *         assertRV(retval)             # <<<<<<<<<<<<<<
 * 
 *         if count == 0:
*/
  __pyx_t_2 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2099, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2099, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pkcs11/_pkcs11.pyx":2101
 *         assertRV(retval)
 * 
 *         if count == 0:             # <<<<<<<<<<<<<<
 *             return []
 * 
*/
  __pyx_t_4 = (__pyx_v_count == 0);
  if (__pyx_t_4) {

    /* "pkcs11/_pkcs11.pyx":2102
 * 
 *         if count == 0:
 *             return []             # <<<<<<<<<<<<<<
 * 
 *         cdef CK_SLOT_ID [:] slot_list = CK_ULONG_buffer(count)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2102, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "pkcs11/_pkcs11.pyx":2101
 *         assertRV(retval)
 * 
 *         if count == 0:             # <<<<<<<<<<<<<<
 *             return []
 * 
*/
  }

  /* "pkcs11/_pkcs11.pyx":2104
 *             return []
 * 
 *         cdef CK_SLOT_ID [:] slot_list = CK_ULONG_buffer(count)             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
*/
  __pyx_t_3 = __Pyx_PyLong_From_CK_ULONG(__pyx_v_count); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __pyx_f_6pkcs11_7_pkcs11_CK_ULONG_buffer(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn_CK_SLOT_ID(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 2104, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_slot_list = __pyx_t_5;
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "pkcs11/_pkcs11.pyx":2106
 *         cdef CK_SLOT_ID [:] slot_list = CK_ULONG_buffer(count)
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_GetSlotList(present, &slot_list[0], &count)
 *         assertRV(retval)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":2107
 * 
 *         with nogil:
 *             retval = self.funclist.C_GetSlotList(present, &slot_list[0], &count)             # <<<<<<<<<<<<<<
 *         assertRV(retval)
 * 
*/
        __pyx_t_6 = 0;
        __pyx_t_7 = -1;
        if (__pyx_t_6 < 0) {
          __pyx_t_6 += __pyx_v_slot_list.shape[0];
          if (unlikely(__pyx_t_6 < 0)) __pyx_t_7 = 0;
        } else if (unlikely(__pyx_t_6 >= __pyx_v_slot_list.shape[0])) __pyx_t_7 = 0;
        if (unlikely(__pyx_t_7 != -1)) {
          __Pyx_RaiseBufferIndexErrorNogil(__pyx_t_7);
          __PYX_ERR(0, 2107, __pyx_L8_error)
        }
        __pyx_v_retval = __pyx_v_self->__pyx_base.funclist->C_GetSlotList(__pyx_v_present, (&(*((CK_SLOT_ID *) ( /* dim=0 */ (__pyx_v_slot_list.data + __pyx_t_6 * __pyx_v_slot_list.strides[0]) )))), (&__pyx_v_count));
      }

      /* "pkcs11/_pkcs11.pyx":2106
 *         cdef CK_SLOT_ID [:] slot_list = CK_ULONG_buffer(count)
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_GetSlotList(present, &slot_list[0], &count)
 *         assertRV(retval)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L9;
        }
        __pyx_L8_error: {
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L1_error;
        }
        __pyx_L9:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":2108
 *         with nogil:
 *             retval = self.funclist.C_GetSlotList(present, &slot_list[0], &count)
 *         assertRV(retval)             # <<<<<<<<<<<<<<
 * 
 *         cdef CK_SLOT_ID slot_id
*/
  __pyx_t_2 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pkcs11/_pkcs11.pyx":2113
 *         cdef CK_SLOT_INFO info
 * 
 *         slots = []             # <<<<<<<<<<<<<<
 * 
 *         for slot_id in slot_list:
*/
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_slots = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pkcs11/_pkcs11.pyx":2115
 *         slots = []
 * 
 *         for slot_id in slot_list:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 retval = self.funclist.C_GetSlotInfo(slot_id, &info)
*/
  if (unlikely(((PyObject *) __pyx_v_slot_list.memview) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
    __PYX_ERR(0, 2115, __pyx_L1_error)
  }
  __PYX_INC_MEMVIEW(&__pyx_v_slot_list, 1);
  __pyx_t_5 = __pyx_v_slot_list;
  __pyx_t_8 = __Pyx_MemoryView_Len(__pyx_t_5); 
  __pyx_t_4 = 1;
  __pyx_t_9 = -1L;
  while (1) {
    if (!__pyx_t_4) break;
    __pyx_t_9 = (__pyx_t_9 + 1);
    __pyx_t_10 = (__pyx_t_9 < __pyx_t_8);
    if (__pyx_t_10) {
      __pyx_t_6 = __pyx_t_9;
      __pyx_v_slot_id = (*((CK_SLOT_ID *) ( /* dim=0 */ (__pyx_t_5.data + __pyx_t_6 * __pyx_t_5.strides[0]) )));
      goto __pyx_L12;
    }
    /*else*/ {
      __pyx_t_4 = 0;
      goto __pyx_L10_continue;
    }
    __pyx_L12:;

    /* "pkcs11/_pkcs11.pyx":2116
 * 
 *         for slot_id in slot_list:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 retval = self.funclist.C_GetSlotInfo(slot_id, &info)
 *             assertRV(retval)
*/
    {
        PyThreadState * _save;
        _save = PyEval_SaveThread();
        __Pyx_FastGIL_Remember();
        /*try:*/ {

          /* "pkcs11/_pkcs11.pyx":2117
 *         for slot_id in slot_list:
 *             with nogil:
 *                 retval = self.funclist.C_GetSlotInfo(slot_id, &info)             # <<<<<<<<<<<<<<
 *             assertRV(retval)
 * 
*/
          __pyx_v_retval = __pyx_v_self->__pyx_base.funclist->C_GetSlotInfo(__pyx_v_slot_id, (&__pyx_v_info));
        }

        /* "pkcs11/_pkcs11.pyx":2116
 * 
 *         for slot_id in slot_list:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 retval = self.funclist.C_GetSlotInfo(slot_id, &info)
 *             assertRV(retval)
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_FastGIL_Forget();
            PyEval_RestoreThread(_save);
            goto __pyx_L17;
          }
          __pyx_L17:;
        }
    }

    /* "pkcs11/_pkcs11.pyx":2118
 *             with nogil:
 *                 retval = self.funclist.C_GetSlotInfo(slot_id, &info)
 *             assertRV(retval)             # <<<<<<<<<<<<<<
 * 
 *             slots.append(
*/
    __pyx_t_3 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pkcs11/_pkcs11.pyx":2121
 * 
 *             slots.append(
 *                 Slot.make(self.funclist, slot_id, info, self._cryptoki_version)             # <<<<<<<<<<<<<<
 *             )
 * 
*/
    __pyx_t_2 = ((PyObject *)__pyx_f_6pkcs11_7_pkcs11_4Slot_make(__pyx_v_self->__pyx_base.funclist, __pyx_v_slot_id, __pyx_v_info, __pyx_v_self->_cryptoki_version)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2121, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "pkcs11/_pkcs11.pyx":2120
 *             assertRV(retval)
 * 
 *             slots.append(             # <<<<<<<<<<<<<<
 *                 Slot.make(self.funclist, slot_id, info, self._cryptoki_version)
 *             )
*/
    __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_slots, __pyx_t_2); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 2120, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_L10_continue:;
  }
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_5, 1);
  __pyx_t_5.memview = NULL; __pyx_t_5.data = NULL;

  /* "pkcs11/_pkcs11.pyx":2124
 *             )
 * 
 *         return slots             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_slots);
  __pyx_r = __pyx_v_slots;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":2090
 * 
 * 
 *     def get_slots(self, token_present=False):             # <<<<<<<<<<<<<<
 *         """Get all slots."""
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_AddTraceback("pkcs11._pkcs11.lib.get_slots", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_slot_list, 1);
  __Pyx_XDECREF(__pyx_v_slots);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6pkcs11_7_pkcs11_3lib_18generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pkcs11/_pkcs11.pyx":2127
 * 
 * 
 *     def get_tokens(self,             # <<<<<<<<<<<<<<
 *                    token_label=None,
 *                    token_serial=None,
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_17get_tokens(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6pkcs11_7_pkcs11_3lib_16get_tokens, "Search for a token matching the parameters.");
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_3lib_17get_tokens = {"get_tokens", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_3lib_17get_tokens, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6pkcs11_7_pkcs11_3lib_16get_tokens};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_17get_tokens(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_token_label = 0;
  PyObject *__pyx_v_token_serial = 0;
  PyObject *__pyx_v_token_flags = 0;
  PyObject *__pyx_v_slot_flags = 0;
  PyObject *__pyx_v_mechanisms = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_tokens (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_token_label,&__pyx_mstate_global->__pyx_n_u_token_serial,&__pyx_mstate_global->__pyx_n_u_token_flags,&__pyx_mstate_global->__pyx_n_u_slot_flags,&__pyx_mstate_global->__pyx_n_u_mechanisms,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 2127, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 2127, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 2127, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 2127, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 2127, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2127, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_tokens", 0) < (0)) __PYX_ERR(0, 2127, __pyx_L3_error)

      /* "pkcs11/_pkcs11.pyx":2128
 * 
 *     def get_tokens(self,
 *                    token_label=None,             # <<<<<<<<<<<<<<
 *                    token_serial=None,
 *                    token_flags=None,
*/
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":2129
 *     def get_tokens(self,
 *                    token_label=None,
 *                    token_serial=None,             # <<<<<<<<<<<<<<
 *                    token_flags=None,
 *                    slot_flags=None,
*/
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":2130
 *                    token_label=None,
 *                    token_serial=None,
 *                    token_flags=None,             # <<<<<<<<<<<<<<
 *                    slot_flags=None,
 *                    mechanisms=None):
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":2131
 *                    token_serial=None,
 *                    token_flags=None,
 *                    slot_flags=None,             # <<<<<<<<<<<<<<
 *                    mechanisms=None):
 *         """Search for a token matching the parameters."""
*/
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":2132
 *                    token_flags=None,
 *                    slot_flags=None,
 *                    mechanisms=None):             # <<<<<<<<<<<<<<
 *         """Search for a token matching the parameters."""
 * 
*/
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 2127, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 2127, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 2127, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 2127, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2127, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }

      /* "pkcs11/_pkcs11.pyx":2128
 * 
 *     def get_tokens(self,
 *                    token_label=None,             # <<<<<<<<<<<<<<
 *                    token_serial=None,
 *                    token_flags=None,
*/
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":2129
 *     def get_tokens(self,
 *                    token_label=None,
 *                    token_serial=None,             # <<<<<<<<<<<<<<
 *                    token_flags=None,
 *                    slot_flags=None,
*/
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":2130
 *                    token_label=None,
 *                    token_serial=None,
 *                    token_flags=None,             # <<<<<<<<<<<<<<
 *                    slot_flags=None,
 *                    mechanisms=None):
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":2131
 *                    token_serial=None,
 *                    token_flags=None,
 *                    slot_flags=None,             # <<<<<<<<<<<<<<
 *                    mechanisms=None):
 *         """Search for a token matching the parameters."""
*/
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pkcs11/_pkcs11.pyx":2132
 *                    token_flags=None,
 *                    slot_flags=None,
 *                    mechanisms=None):             # <<<<<<<<<<<<<<
 *         """Search for a token matching the parameters."""
 * 
*/
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_token_label = values[0];
    __pyx_v_token_serial = values[1];
    __pyx_v_token_flags = values[2];
    __pyx_v_slot_flags = values[3];
    __pyx_v_mechanisms = values[4];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_tokens", 0, 0, 5, __pyx_nargs); __PYX_ERR(0, 2127, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.lib.get_tokens", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_3lib_16get_tokens(((struct __pyx_obj_6pkcs11_7_pkcs11_lib *)__pyx_v_self), __pyx_v_token_label, __pyx_v_token_serial, __pyx_v_token_flags, __pyx_v_slot_flags, __pyx_v_mechanisms);

  /* "pkcs11/_pkcs11.pyx":2127
 * 
 * 
 *     def get_tokens(self,             # <<<<<<<<<<<<<<
 *                    token_label=None,
 *                    token_serial=None,
*/

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_16get_tokens(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self, PyObject *__pyx_v_token_label, PyObject *__pyx_v_token_serial, PyObject *__pyx_v_token_flags, PyObject *__pyx_v_slot_flags, PyObject *__pyx_v_mechanisms) {
  struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_tokens", 0);
  __pyx_cur_scope = (struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens *)__pyx_tp_new_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 2127, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_token_label = __pyx_v_token_label;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_token_label);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_token_label);
  __pyx_cur_scope->__pyx_v_token_serial = __pyx_v_token_serial;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_token_serial);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_token_serial);
  __pyx_cur_scope->__pyx_v_token_flags = __pyx_v_token_flags;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_token_flags);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_token_flags);
  __pyx_cur_scope->__pyx_v_slot_flags = __pyx_v_slot_flags;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_slot_flags);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_slot_flags);
  __pyx_cur_scope->__pyx_v_mechanisms = __pyx_v_mechanisms;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_mechanisms);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_mechanisms);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6pkcs11_7_pkcs11_3lib_18generator5, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_get_tokens, __pyx_mstate_global->__pyx_n_u_lib_get_tokens, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11); if (unlikely(!gen)) __PYX_ERR(0, 2127, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.lib.get_tokens", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6pkcs11_7_pkcs11_3lib_18generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens *__pyx_cur_scope = ((struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_t_16;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_tokens", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L29_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(0, 2127, __pyx_L1_error)
  }

  /* "pkcs11/_pkcs11.pyx":2135
 *         """Search for a token matching the parameters."""
 * 
 *         for slot in self.get_slots():             # <<<<<<<<<<<<<<
 *             try:
 *                 token = slot.get_token()
*/
  __pyx_t_2 = ((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_slots, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2135, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2);
    __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2135, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2135, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2135, __pyx_L1_error)
          #endif
          if (__pyx_t_4 >= __pyx_temp) break;
        }
        __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_4, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_4;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2135, __pyx_L1_error)
          #endif
          if (__pyx_t_4 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4));
        #else
        __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_4);
        #endif
        ++__pyx_t_4;
      }
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2135, __pyx_L1_error)
    } else {
      __pyx_t_1 = __pyx_t_5(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 2135, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_slot);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_slot, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;

    /* "pkcs11/_pkcs11.pyx":2136
 * 
 *         for slot in self.get_slots():
 *             try:             # <<<<<<<<<<<<<<
 *                 token = slot.get_token()
 *                 token_mechanisms = slot.get_mechanisms()
*/
    {
      __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:*/ {

        /* "pkcs11/_pkcs11.pyx":2137
 *         for slot in self.get_slots():
 *             try:
 *                 token = slot.get_token()             # <<<<<<<<<<<<<<
 *                 token_mechanisms = slot.get_mechanisms()
 * 
*/
        __pyx_t_9 = __pyx_cur_scope->__pyx_v_slot;
        __Pyx_INCREF(__pyx_t_9);
        __pyx_t_3 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_9, NULL};
          __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_token, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2137, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_token);
        __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_token, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        __pyx_t_1 = 0;

        /* "pkcs11/_pkcs11.pyx":2138
 *             try:
 *                 token = slot.get_token()
 *                 token_mechanisms = slot.get_mechanisms()             # <<<<<<<<<<<<<<
 * 
 *                 if token_label is not None and \
*/
        __pyx_t_9 = __pyx_cur_scope->__pyx_v_slot;
        __Pyx_INCREF(__pyx_t_9);
        __pyx_t_3 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_9, NULL};
          __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_mechanisms, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2138, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_token_mechanisms);
        __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_token_mechanisms, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        __pyx_t_1 = 0;

        /* "pkcs11/_pkcs11.pyx":2140
 *                 token_mechanisms = slot.get_mechanisms()
 * 
 *                 if token_label is not None and \             # <<<<<<<<<<<<<<
 *                         token.label != token_label:
 *                     continue
*/
        __pyx_t_11 = (__pyx_cur_scope->__pyx_v_token_label != Py_None);
        if (__pyx_t_11) {
        } else {
          __pyx_t_10 = __pyx_t_11;
          goto __pyx_L15_bool_binop_done;
        }

        /* "pkcs11/_pkcs11.pyx":2141
 * 
 *                 if token_label is not None and \
 *                         token.label != token_label:             # <<<<<<<<<<<<<<
 *                     continue
 * 
*/
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_token, __pyx_mstate_global->__pyx_n_u_label); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2141, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_9 = PyObject_RichCompare(__pyx_t_1, __pyx_cur_scope->__pyx_v_token_label, Py_NE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2141, __pyx_L6_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 2141, __pyx_L6_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_10 = __pyx_t_11;
        __pyx_L15_bool_binop_done:;

        /* "pkcs11/_pkcs11.pyx":2140
 *                 token_mechanisms = slot.get_mechanisms()
 * 
 *                 if token_label is not None and \             # <<<<<<<<<<<<<<
 *                         token.label != token_label:
 *                     continue
*/
        if (__pyx_t_10) {

          /* "pkcs11/_pkcs11.pyx":2142
 *                 if token_label is not None and \
 *                         token.label != token_label:
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *                 if token_serial is not None and \
*/
          goto __pyx_L12_try_continue;

          /* "pkcs11/_pkcs11.pyx":2140
 *                 token_mechanisms = slot.get_mechanisms()
 * 
 *                 if token_label is not None and \             # <<<<<<<<<<<<<<
 *                         token.label != token_label:
 *                     continue
*/
        }

        /* "pkcs11/_pkcs11.pyx":2144
 *                     continue
 * 
 *                 if token_serial is not None and \             # <<<<<<<<<<<<<<
 *                         token.serial != token_serial:
 *                     continue
*/
        __pyx_t_11 = (__pyx_cur_scope->__pyx_v_token_serial != Py_None);
        if (__pyx_t_11) {
        } else {
          __pyx_t_10 = __pyx_t_11;
          goto __pyx_L18_bool_binop_done;
        }

        /* "pkcs11/_pkcs11.pyx":2145
 * 
 *                 if token_serial is not None and \
 *                         token.serial != token_serial:             # <<<<<<<<<<<<<<
 *                     continue
 * 
*/
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_token, __pyx_mstate_global->__pyx_n_u_serial); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2145, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_1 = PyObject_RichCompare(__pyx_t_9, __pyx_cur_scope->__pyx_v_token_serial, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2145, __pyx_L6_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 2145, __pyx_L6_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_10 = __pyx_t_11;
        __pyx_L18_bool_binop_done:;

        /* "pkcs11/_pkcs11.pyx":2144
 *                     continue
 * 
 *                 if token_serial is not None and \             # <<<<<<<<<<<<<<
 *                         token.serial != token_serial:
 *                     continue
*/
        if (__pyx_t_10) {

          /* "pkcs11/_pkcs11.pyx":2146
 *                 if token_serial is not None and \
 *                         token.serial != token_serial:
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *                 if token_flags is not None and \
*/
          goto __pyx_L12_try_continue;

          /* "pkcs11/_pkcs11.pyx":2144
 *                     continue
 * 
 *                 if token_serial is not None and \             # <<<<<<<<<<<<<<
 *                         token.serial != token_serial:
 *                     continue
*/
        }

        /* "pkcs11/_pkcs11.pyx":2148
 *                     continue
 * 
 *                 if token_flags is not None and \             # <<<<<<<<<<<<<<
 *                         not token.flags & token_flags:
 *                     continue
*/
        __pyx_t_11 = (__pyx_cur_scope->__pyx_v_token_flags != Py_None);
        if (__pyx_t_11) {
        } else {
          __pyx_t_10 = __pyx_t_11;
          goto __pyx_L21_bool_binop_done;
        }

        /* "pkcs11/_pkcs11.pyx":2149
 * 
 *                 if token_flags is not None and \
 *                         not token.flags & token_flags:             # <<<<<<<<<<<<<<
 *                     continue
 * 
*/
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_token, __pyx_mstate_global->__pyx_n_u_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2149, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_9 = PyNumber_And(__pyx_t_1, __pyx_cur_scope->__pyx_v_token_flags); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2149, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 2149, __pyx_L6_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_12 = (!__pyx_t_11);
        __pyx_t_10 = __pyx_t_12;
        __pyx_L21_bool_binop_done:;

        /* "pkcs11/_pkcs11.pyx":2148
 *                     continue
 * 
 *                 if token_flags is not None and \             # <<<<<<<<<<<<<<
 *                         not token.flags & token_flags:
 *                     continue
*/
        if (__pyx_t_10) {

          /* "pkcs11/_pkcs11.pyx":2150
 *                 if token_flags is not None and \
 *                         not token.flags & token_flags:
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *                 if slot_flags is not None and \
*/
          goto __pyx_L12_try_continue;

          /* "pkcs11/_pkcs11.pyx":2148
 *                     continue
 * 
 *                 if token_flags is not None and \             # <<<<<<<<<<<<<<
 *                         not token.flags & token_flags:
 *                     continue
*/
        }

        /* "pkcs11/_pkcs11.pyx":2152
 *                     continue
 * 
 *                 if slot_flags is not None and \             # <<<<<<<<<<<<<<
 *                         not slot.flags & slot_flags:
 *                     continue
*/
        __pyx_t_12 = (__pyx_cur_scope->__pyx_v_slot_flags != Py_None);
        if (__pyx_t_12) {
        } else {
          __pyx_t_10 = __pyx_t_12;
          goto __pyx_L24_bool_binop_done;
        }

        /* "pkcs11/_pkcs11.pyx":2153
 * 
 *                 if slot_flags is not None and \
 *                         not slot.flags & slot_flags:             # <<<<<<<<<<<<<<
 *                     continue
 * 
*/
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_slot, __pyx_mstate_global->__pyx_n_u_flags); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2153, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_1 = PyNumber_And(__pyx_t_9, __pyx_cur_scope->__pyx_v_slot_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2153, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_12 < 0))) __PYX_ERR(0, 2153, __pyx_L6_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_11 = (!__pyx_t_12);
        __pyx_t_10 = __pyx_t_11;
        __pyx_L24_bool_binop_done:;

        /* "pkcs11/_pkcs11.pyx":2152
 *                     continue
 * 
 *                 if slot_flags is not None and \             # <<<<<<<<<<<<<<
 *                         not slot.flags & slot_flags:
 *                     continue
*/
        if (__pyx_t_10) {

          /* "pkcs11/_pkcs11.pyx":2154
 *                 if slot_flags is not None and \
 *                         not slot.flags & slot_flags:
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *                 if mechanisms is not None and \
*/
          goto __pyx_L12_try_continue;

          /* "pkcs11/_pkcs11.pyx":2152
 *                     continue
 * 
 *                 if slot_flags is not None and \             # <<<<<<<<<<<<<<
 *                         not slot.flags & slot_flags:
 *                     continue
*/
        }

        /* "pkcs11/_pkcs11.pyx":2156
 *                     continue
 * 
 *                 if mechanisms is not None and \             # <<<<<<<<<<<<<<
 *                         set(mechanisms) not in token_mechanisms:
 *                     continue
*/
        __pyx_t_11 = (__pyx_cur_scope->__pyx_v_mechanisms != Py_None);
        if (__pyx_t_11) {
        } else {
          __pyx_t_10 = __pyx_t_11;
          goto __pyx_L27_bool_binop_done;
        }

        /* "pkcs11/_pkcs11.pyx":2157
 * 
 *                 if mechanisms is not None and \
 *                         set(mechanisms) not in token_mechanisms:             # <<<<<<<<<<<<<<
 *                     continue
 * 
*/
        __pyx_t_1 = PySet_New(__pyx_cur_scope->__pyx_v_mechanisms); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2157, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_11 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_cur_scope->__pyx_v_token_mechanisms, Py_NE)); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 2157, __pyx_L6_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_10 = __pyx_t_11;
        __pyx_L27_bool_binop_done:;

        /* "pkcs11/_pkcs11.pyx":2156
 *                     continue
 * 
 *                 if mechanisms is not None and \             # <<<<<<<<<<<<<<
 *                         set(mechanisms) not in token_mechanisms:
 *                     continue
*/
        if (__pyx_t_10) {

          /* "pkcs11/_pkcs11.pyx":2158
 *                 if mechanisms is not None and \
 *                         set(mechanisms) not in token_mechanisms:
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *                 yield token
*/
          goto __pyx_L12_try_continue;

          /* "pkcs11/_pkcs11.pyx":2156
 *                     continue
 * 
 *                 if mechanisms is not None and \             # <<<<<<<<<<<<<<
 *                         set(mechanisms) not in token_mechanisms:
 *                     continue
*/
        }

        /* "pkcs11/_pkcs11.pyx":2160
 *                     continue
 * 
 *                 yield token             # <<<<<<<<<<<<<<
 *             except (TokenNotPresent, TokenNotRecognised):
 *                 continue
*/
        __Pyx_INCREF(__pyx_cur_scope->__pyx_v_token);
        __pyx_r = __pyx_cur_scope->__pyx_v_token;
        __Pyx_XGIVEREF(__pyx_t_2);
        __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
        __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
        __pyx_cur_scope->__pyx_t_2 = __pyx_t_5;
        __Pyx_XGIVEREF(__pyx_t_6);
        __pyx_cur_scope->__pyx_t_3 = __pyx_t_6;
        __Pyx_XGIVEREF(__pyx_t_7);
        __pyx_cur_scope->__pyx_t_4 = __pyx_t_7;
        __Pyx_XGIVEREF(__pyx_t_8);
        __pyx_cur_scope->__pyx_t_5 = __pyx_t_8;
        __Pyx_XGIVEREF(__pyx_r);
        __Pyx_RefNannyFinishContext();
        __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
        /* return from generator, yielding value */
        __pyx_generator->resume_label = 1;
        return __pyx_r;
        __pyx_L29_resume_from_yield:;
        __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
        __pyx_cur_scope->__pyx_t_0 = 0;
        __Pyx_XGOTREF(__pyx_t_2);
        __pyx_t_4 = __pyx_cur_scope->__pyx_t_1;
        __pyx_t_5 = __pyx_cur_scope->__pyx_t_2;
        __pyx_t_6 = __pyx_cur_scope->__pyx_t_3;
        __pyx_cur_scope->__pyx_t_3 = 0;
        __Pyx_XGOTREF(__pyx_t_6);
        __pyx_t_7 = __pyx_cur_scope->__pyx_t_4;
        __pyx_cur_scope->__pyx_t_4 = 0;
        __Pyx_XGOTREF(__pyx_t_7);
        __pyx_t_8 = __pyx_cur_scope->__pyx_t_5;
        __pyx_cur_scope->__pyx_t_5 = 0;
        __Pyx_XGOTREF(__pyx_t_8);
        if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2160, __pyx_L6_error)

        /* "pkcs11/_pkcs11.pyx":2136
 * 
 *         for slot in self.get_slots():
 *             try:             # <<<<<<<<<<<<<<
 *                 token = slot.get_token()
 *                 token_mechanisms = slot.get_mechanisms()
*/
      }
      __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_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "pkcs11/_pkcs11.pyx":2161
 * 
 *                 yield token
 *             except (TokenNotPresent, TokenNotRecognised):             # <<<<<<<<<<<<<<
 *                 continue
 * 
*/
      __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_9, &__pyx_t_13);
      __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_TokenNotPresent); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2161, __pyx_L8_except_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_TokenNotRecognised); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 2161, __pyx_L8_except_error)
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_16 = __Pyx_PyErr_GivenExceptionMatches2(__pyx_t_1, __pyx_t_14, __pyx_t_15);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_ErrRestore(__pyx_t_1, __pyx_t_9, __pyx_t_13);
      __pyx_t_1 = 0; __pyx_t_9 = 0; __pyx_t_13 = 0;
      if (__pyx_t_16) {
        __Pyx_AddTraceback("pkcs11._pkcs11.lib.get_tokens", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_13, &__pyx_t_9, &__pyx_t_1) < 0) __PYX_ERR(0, 2161, __pyx_L8_except_error)
        __Pyx_XGOTREF(__pyx_t_13);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_1);

        /* "pkcs11/_pkcs11.pyx":2162
 *                 yield token
 *             except (TokenNotPresent, TokenNotRecognised):
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *     def get_token(self, **kwargs):
*/
        goto __pyx_L30_except_continue;
        __pyx_L30_except_continue:;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L12_try_continue;
      }
      goto __pyx_L8_except_error;

      /* "pkcs11/_pkcs11.pyx":2136
 * 
 *         for slot in self.get_slots():
 *             try:             # <<<<<<<<<<<<<<
 *                 token = slot.get_token()
 *                 token_mechanisms = slot.get_mechanisms()
*/
      __pyx_L8_except_error:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      goto __pyx_L1_error;
      __pyx_L12_try_continue:;
      __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_L4_continue;
      __pyx_L13_try_end:;
    }

    /* "pkcs11/_pkcs11.pyx":2135
 *         """Search for a token matching the parameters."""
 * 
 *         for slot in self.get_slots():             # <<<<<<<<<<<<<<
 *             try:
 *                 token = slot.get_token()
*/
    __pyx_L4_continue:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "pkcs11/_pkcs11.pyx":2127
 * 
 * 
 *     def get_tokens(self,             # <<<<<<<<<<<<<<
 *                    token_label=None,
 *                    token_serial=None,
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("get_tokens", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":2164
 *                 continue
 * 
 *     def get_token(self, **kwargs):             # <<<<<<<<<<<<<<
 *         """Get a single token."""
 *         iterator = self.get_tokens(**kwargs)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_20get_token(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6pkcs11_7_pkcs11_3lib_19get_token, "Get a single token.");
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_3lib_20get_token = {"get_token", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_3lib_20get_token, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6pkcs11_7_pkcs11_3lib_19get_token};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_20get_token(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_kwargs = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_token (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("get_token", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (__pyx_kwds_len > 0) {
    if (unlikely(__Pyx_CheckKeywordStrings("get_token", __pyx_kwds) == -1)) return NULL;
    __pyx_v_kwargs = __Pyx_KwargsAsDict_FASTCALL(__pyx_kwds, __pyx_kwvalues);
    if (unlikely(!__pyx_v_kwargs)) return NULL;
    __Pyx_GOTREF(__pyx_v_kwargs);
  } else {
    __pyx_v_kwargs = PyDict_New();
    if (unlikely(!__pyx_v_kwargs)) return NULL;
    __Pyx_GOTREF(__pyx_v_kwargs);
  }
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_3lib_19get_token(((struct __pyx_obj_6pkcs11_7_pkcs11_lib *)__pyx_v_self), __pyx_v_kwargs);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_19get_token(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_iterator = NULL;
  PyObject *__pyx_v_token = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  size_t __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_token", 0);

  /* "pkcs11/_pkcs11.pyx":2166
 *     def get_token(self, **kwargs):
 *         """Get a single token."""
 *         iterator = self.get_tokens(**kwargs)             # <<<<<<<<<<<<<<
 * 
 *         try:
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_get_tokens); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_mstate_global->__pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_iterator = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pkcs11/_pkcs11.pyx":2168
 *         iterator = self.get_tokens(**kwargs)
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             token = next(iterator)
 *         except StopIteration:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "pkcs11/_pkcs11.pyx":2169
 * 
 *         try:
 *             token = next(iterator)             # <<<<<<<<<<<<<<
 *         except StopIteration:
 *             raise NoSuchToken("No token matching %s" % kwargs)
*/
      __pyx_t_3 = __Pyx_PyIter_Next(__pyx_v_iterator); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2169, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_v_token = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "pkcs11/_pkcs11.pyx":2168
 *         iterator = self.get_tokens(**kwargs)
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             token = next(iterator)
 *         except StopIteration:
*/
    }
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "pkcs11/_pkcs11.pyx":2170
 *         try:
 *             token = next(iterator)
 *         except StopIteration:             # <<<<<<<<<<<<<<
 *             raise NoSuchToken("No token matching %s" % kwargs)
 * 
*/
    __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_StopIteration))));
    if (__pyx_t_7) {
      __Pyx_AddTraceback("pkcs11._pkcs11.lib.get_token", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0) __PYX_ERR(0, 2170, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_1);

      /* "pkcs11/_pkcs11.pyx":2171
 *             token = next(iterator)
 *         except StopIteration:
 *             raise NoSuchToken("No token matching %s" % kwargs)             # <<<<<<<<<<<<<<
 * 
 *         try:
*/
      __pyx_t_9 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_NoSuchToken); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2171, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_No_token_matching_s, __pyx_v_kwargs); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2171, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
        assert(__pyx_t_9);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_10, __pyx__function);
        __pyx_t_12 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_11};
        __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_10, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2171, __pyx_L5_except_error)
        __Pyx_GOTREF(__pyx_t_8);
      }
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(0, 2171, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;

    /* "pkcs11/_pkcs11.pyx":2168
 *         iterator = self.get_tokens(**kwargs)
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             token = next(iterator)
 *         except StopIteration:
*/
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "pkcs11/_pkcs11.pyx":2173
 *             raise NoSuchToken("No token matching %s" % kwargs)
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             next(iterator)
 *             raise MultipleTokensReturned(
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "pkcs11/_pkcs11.pyx":2174
 * 
 *         try:
 *             next(iterator)             # <<<<<<<<<<<<<<
 *             raise MultipleTokensReturned(
 *                 "More than 1 token matches %s" % kwargs)
*/
      __pyx_t_1 = __Pyx_PyIter_Next(__pyx_v_iterator); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2174, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "pkcs11/_pkcs11.pyx":2175
 *         try:
 *             next(iterator)
 *             raise MultipleTokensReturned(             # <<<<<<<<<<<<<<
 *                 "More than 1 token matches %s" % kwargs)
 *         except StopIteration:
*/
      __pyx_t_2 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_MultipleTokensReturned); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2175, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_3);

      /* "pkcs11/_pkcs11.pyx":2176
 *             next(iterator)
 *             raise MultipleTokensReturned(
 *                 "More than 1 token matches %s" % kwargs)             # <<<<<<<<<<<<<<
 *         except StopIteration:
 *             return token
*/
      __pyx_t_8 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_More_than_1_token_matches_s, __pyx_v_kwargs); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2176, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_12 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        assert(__pyx_t_2);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
        __pyx_t_12 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_8};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2175, __pyx_L11_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(0, 2175, __pyx_L11_error)

      /* "pkcs11/_pkcs11.pyx":2173
 *             raise NoSuchToken("No token matching %s" % kwargs)
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             next(iterator)
 *             raise MultipleTokensReturned(
*/
    }
    __pyx_L11_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "pkcs11/_pkcs11.pyx":2177
 *             raise MultipleTokensReturned(
 *                 "More than 1 token matches %s" % kwargs)
 *         except StopIteration:             # <<<<<<<<<<<<<<
 *             return token
 * 
*/
    __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_StopIteration))));
    if (__pyx_t_7) {
      __Pyx_ErrRestore(0,0,0);

      /* "pkcs11/_pkcs11.pyx":2178
 *                 "More than 1 token matches %s" % kwargs)
 *         except StopIteration:
 *             return token             # <<<<<<<<<<<<<<
 * 
 *     def wait_for_slot_event(self, blocking=True):
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_token);
      __pyx_r = __pyx_v_token;
      goto __pyx_L14_except_return;
    }
    goto __pyx_L13_except_error;

    /* "pkcs11/_pkcs11.pyx":2173
 *             raise NoSuchToken("No token matching %s" % kwargs)
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             next(iterator)
 *             raise MultipleTokensReturned(
*/
    __pyx_L13_except_error:;
    __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_L14_except_return:;
    __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_L0;
  }

  /* "pkcs11/_pkcs11.pyx":2164
 *                 continue
 * 
 *     def get_token(self, **kwargs):             # <<<<<<<<<<<<<<
 *         """Get a single token."""
 *         iterator = self.get_tokens(**kwargs)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("pkcs11._pkcs11.lib.get_token", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_iterator);
  __Pyx_XDECREF(__pyx_v_token);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":2180
 *             return token
 * 
 *     def wait_for_slot_event(self, blocking=True):             # <<<<<<<<<<<<<<
 *         cdef CK_SLOT_ID slot_id
 *         cdef CK_FLAGS flag = 0
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_22wait_for_slot_event(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_3lib_22wait_for_slot_event = {"wait_for_slot_event", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_3lib_22wait_for_slot_event, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_22wait_for_slot_event(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_blocking = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("wait_for_slot_event (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_blocking,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 2180, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2180, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "wait_for_slot_event", 0) < (0)) __PYX_ERR(0, 2180, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_True));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2180, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_True));
    }
    __pyx_v_blocking = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("wait_for_slot_event", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 2180, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.lib.wait_for_slot_event", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_3lib_21wait_for_slot_event(((struct __pyx_obj_6pkcs11_7_pkcs11_lib *)__pyx_v_self), __pyx_v_blocking);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_21wait_for_slot_event(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self, PyObject *__pyx_v_blocking) {
  CK_SLOT_ID __pyx_v_slot_id;
  CK_FLAGS __pyx_v_flag;
  CK_RV __pyx_v_retval;
  CK_SLOT_INFO __pyx_v_info;
  PyObject *__pyx_v_slotDescription = NULL;
  PyObject *__pyx_v_manufacturerID = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  size_t __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("wait_for_slot_event", 0);

  /* "pkcs11/_pkcs11.pyx":2182
 *     def wait_for_slot_event(self, blocking=True):
 *         cdef CK_SLOT_ID slot_id
 *         cdef CK_FLAGS flag = 0             # <<<<<<<<<<<<<<
 *         cdef CK_RV retval
 * 
*/
  __pyx_v_flag = 0;

  /* "pkcs11/_pkcs11.pyx":2185
 *         cdef CK_RV retval
 * 
 *         if not blocking:             # <<<<<<<<<<<<<<
 *             flag |= CKF_DONT_BLOCK
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_blocking); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 2185, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "pkcs11/_pkcs11.pyx":2186
 * 
 *         if not blocking:
 *             flag |= CKF_DONT_BLOCK             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
*/
    __pyx_v_flag = (__pyx_v_flag | CKF_DONT_BLOCK);

    /* "pkcs11/_pkcs11.pyx":2185
 *         cdef CK_RV retval
 * 
 *         if not blocking:             # <<<<<<<<<<<<<<
 *             flag |= CKF_DONT_BLOCK
 * 
*/
  }

  /* "pkcs11/_pkcs11.pyx":2188
 *             flag |= CKF_DONT_BLOCK
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_WaitForSlotEvent(flag, &slot_id, NULL)
 *         assertRV(retval)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":2189
 * 
 *         with nogil:
 *             retval = self.funclist.C_WaitForSlotEvent(flag, &slot_id, NULL)             # <<<<<<<<<<<<<<
 *         assertRV(retval)
 * 
*/
        __pyx_v_retval = __pyx_v_self->__pyx_base.funclist->C_WaitForSlotEvent(__pyx_v_flag, (&__pyx_v_slot_id), NULL);
      }

      /* "pkcs11/_pkcs11.pyx":2188
 *             flag |= CKF_DONT_BLOCK
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_WaitForSlotEvent(flag, &slot_id, NULL)
 *         assertRV(retval)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L6;
        }
        __pyx_L6:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":2190
 *         with nogil:
 *             retval = self.funclist.C_WaitForSlotEvent(flag, &slot_id, NULL)
 *         assertRV(retval)             # <<<<<<<<<<<<<<
 * 
 *         cdef CK_SLOT_INFO info
*/
  __pyx_t_3 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":2194
 *         cdef CK_SLOT_INFO info
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_GetSlotInfo(slot_id, &info)
 *         assertRV(retval)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pkcs11/_pkcs11.pyx":2195
 * 
 *         with nogil:
 *             retval = self.funclist.C_GetSlotInfo(slot_id, &info)             # <<<<<<<<<<<<<<
 *         assertRV(retval)
 * 
*/
        __pyx_v_retval = __pyx_v_self->__pyx_base.funclist->C_GetSlotInfo(__pyx_v_slot_id, (&__pyx_v_info));
      }

      /* "pkcs11/_pkcs11.pyx":2194
 *         cdef CK_SLOT_INFO info
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             retval = self.funclist.C_GetSlotInfo(slot_id, &info)
 *         assertRV(retval)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L9;
        }
        __pyx_L9:;
      }
  }

  /* "pkcs11/_pkcs11.pyx":2196
 *         with nogil:
 *             retval = self.funclist.C_GetSlotInfo(slot_id, &info)
 *         assertRV(retval)             # <<<<<<<<<<<<<<
 * 
 *         slotDescription = info.slotDescription[:sizeof(info.slotDescription)]
*/
  __pyx_t_4 = __Pyx_PyLong_From_CK_RV(__pyx_v_retval); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __pyx_f_6pkcs11_7_pkcs11_assertRV(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pkcs11/_pkcs11.pyx":2198
 *         assertRV(retval)
 * 
 *         slotDescription = info.slotDescription[:sizeof(info.slotDescription)]             # <<<<<<<<<<<<<<
 *         manufacturerID = info.manufacturerID[:sizeof(info.manufacturerID)]
 * 
*/
  __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(((char const *)__pyx_v_info.slotDescription) + 0, (sizeof(__pyx_v_info.slotDescription)) - 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_slotDescription = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pkcs11/_pkcs11.pyx":2199
 * 
 *         slotDescription = info.slotDescription[:sizeof(info.slotDescription)]
 *         manufacturerID = info.manufacturerID[:sizeof(info.manufacturerID)]             # <<<<<<<<<<<<<<
 * 
 *         return Slot(self, slot_id, slotDescription, manufacturerID,
*/
  __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(((char const *)__pyx_v_info.manufacturerID) + 0, (sizeof(__pyx_v_info.manufacturerID)) - 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_manufacturerID = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pkcs11/_pkcs11.pyx":2201
 *         manufacturerID = info.manufacturerID[:sizeof(info.manufacturerID)]
 * 
 *         return Slot(self, slot_id, slotDescription, manufacturerID,             # <<<<<<<<<<<<<<
 *                  info.hardwareVersion, info.firmwareVersion, info.flags)
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = NULL;
  __pyx_t_5 = __Pyx_PyLong_From_CK_ULONG(__pyx_v_slot_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "pkcs11/_pkcs11.pyx":2202
 * 
 *         return Slot(self, slot_id, slotDescription, manufacturerID,
 *                  info.hardwareVersion, info.firmwareVersion, info.flags)             # <<<<<<<<<<<<<<
 * 
 *     def unload(self):
*/
  __pyx_t_6 = __pyx_convert__to_py_CK_VERSION(__pyx_v_info.hardwareVersion); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __pyx_convert__to_py_CK_VERSION(__pyx_v_info.firmwareVersion); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyLong_From_CK_ULONG(__pyx_v_info.flags); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = 1;
  {
    PyObject *__pyx_callargs[8] = {__pyx_t_4, ((PyObject *)__pyx_v_self), __pyx_t_5, __pyx_v_slotDescription, __pyx_v_manufacturerID, __pyx_t_6, __pyx_t_7, __pyx_t_8};
    __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Slot, __pyx_callargs+__pyx_t_9, (8-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2201, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_3);
  }
  __pyx_r = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "pkcs11/_pkcs11.pyx":2180
 *             return token
 * 
 *     def wait_for_slot_event(self, blocking=True):             # <<<<<<<<<<<<<<
 *         cdef CK_SLOT_ID slot_id
 *         cdef CK_FLAGS flag = 0
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pkcs11._pkcs11.lib.wait_for_slot_event", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_slotDescription);
  __Pyx_XDECREF(__pyx_v_manufacturerID);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":2204
 *                  info.hardwareVersion, info.firmwareVersion, info.flags)
 * 
 *     def unload(self):             # <<<<<<<<<<<<<<
 *         self._finalize()
 *         self.funclist = NULL
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_24unload(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_3lib_24unload = {"unload", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_3lib_24unload, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_24unload(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("unload (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("unload", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("unload", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_3lib_23unload(((struct __pyx_obj_6pkcs11_7_pkcs11_lib *)__pyx_v_self));

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

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

  /* "pkcs11/_pkcs11.pyx":2205
 * 
 *     def unload(self):
 *         self._finalize()             # <<<<<<<<<<<<<<
 *         self.funclist = NULL
 *         if self._p11_handle != NULL:
*/
  ((struct __pyx_vtabstruct_6pkcs11_7_pkcs11_lib *)__pyx_v_self->__pyx_vtab)->_finalize(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2205, __pyx_L1_error)

  /* "pkcs11/_pkcs11.pyx":2206
 *     def unload(self):
 *         self._finalize()
 *         self.funclist = NULL             # <<<<<<<<<<<<<<
 *         if self._p11_handle != NULL:
 *             p11_close(self._p11_handle)
*/
  __pyx_v_self->__pyx_base.funclist = NULL;

  /* "pkcs11/_pkcs11.pyx":2207
 *         self._finalize()
 *         self.funclist = NULL
 *         if self._p11_handle != NULL:             # <<<<<<<<<<<<<<
 *             p11_close(self._p11_handle)
 *             self._p11_handle = NULL
*/
  __pyx_t_1 = (__pyx_v_self->_p11_handle != NULL);
  if (__pyx_t_1) {

    /* "pkcs11/_pkcs11.pyx":2208
 *         self.funclist = NULL
 *         if self._p11_handle != NULL:
 *             p11_close(self._p11_handle)             # <<<<<<<<<<<<<<
 *             self._p11_handle = NULL
 * 
*/
    (void)(p11_close(__pyx_v_self->_p11_handle));

    /* "pkcs11/_pkcs11.pyx":2209
 *         if self._p11_handle != NULL:
 *             p11_close(self._p11_handle)
 *             self._p11_handle = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
    __pyx_v_self->_p11_handle = NULL;

    /* "pkcs11/_pkcs11.pyx":2207
 *         self._finalize()
 *         self.funclist = NULL
 *         if self._p11_handle != NULL:             # <<<<<<<<<<<<<<
 *             p11_close(self._p11_handle)
 *             self._p11_handle = NULL
*/
  }

  /* "pkcs11/_pkcs11.pyx":2204
 *                  info.hardwareVersion, info.firmwareVersion, info.flags)
 * 
 *     def unload(self):             # <<<<<<<<<<<<<<
 *         self._finalize()
 *         self.funclist = NULL
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.lib.unload", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pkcs11/_pkcs11.pyx":2211
 *             self._p11_handle = NULL
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self.unload()
*/

/* Python wrapper */
static void __pyx_pw_6pkcs11_7_pkcs11_3lib_26__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_6pkcs11_7_pkcs11_3lib_26__dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_6pkcs11_7_pkcs11_3lib_25__dealloc__(((struct __pyx_obj_6pkcs11_7_pkcs11_lib *)__pyx_v_self));

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

static void __pyx_pf_6pkcs11_7_pkcs11_3lib_25__dealloc__(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "pkcs11/_pkcs11.pyx":2212
 * 
 *     def __dealloc__(self):
 *         self.unload()             # <<<<<<<<<<<<<<
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_unload, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2212, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pkcs11/_pkcs11.pyx":2211
 *             self._p11_handle = NULL
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self.unload()
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("pkcs11._pkcs11.lib.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "pkcs11/_pkcs11.pyx":1977
 *     """
 * 
 *     cdef readonly str so             # <<<<<<<<<<<<<<
 *     cdef readonly str manufacturer_id
 *     cdef readonly str library_description
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_2so_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_2so_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_3lib_2so___get__(((struct __pyx_obj_6pkcs11_7_pkcs11_lib *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_2so___get__(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->so);
  __pyx_r = __pyx_v_self->so;
  goto __pyx_L0;

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

/* "pkcs11/_pkcs11.pyx":1978
 * 
 *     cdef readonly str so
 *     cdef readonly str manufacturer_id             # <<<<<<<<<<<<<<
 *     cdef readonly str library_description
 *     cdef readonly bint initialized
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_15manufacturer_id_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_15manufacturer_id_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_3lib_15manufacturer_id___get__(((struct __pyx_obj_6pkcs11_7_pkcs11_lib *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_15manufacturer_id___get__(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->manufacturer_id);
  __pyx_r = __pyx_v_self->manufacturer_id;
  goto __pyx_L0;

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

/* "pkcs11/_pkcs11.pyx":1979
 *     cdef readonly str so
 *     cdef readonly str manufacturer_id
 *     cdef readonly str library_description             # <<<<<<<<<<<<<<
 *     cdef readonly bint initialized
 *     cdef CK_VERSION _cryptoki_version
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_19library_description_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_19library_description_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_3lib_19library_description___get__(((struct __pyx_obj_6pkcs11_7_pkcs11_lib *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_19library_description___get__(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->library_description);
  __pyx_r = __pyx_v_self->library_description;
  goto __pyx_L0;

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

/* "pkcs11/_pkcs11.pyx":1980
 *     cdef readonly str manufacturer_id
 *     cdef readonly str library_description
 *     cdef readonly bint initialized             # <<<<<<<<<<<<<<
 *     cdef CK_VERSION _cryptoki_version
 *     cdef CK_VERSION _library_version
*/

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_11initialized_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_11initialized_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_3lib_11initialized___get__(((struct __pyx_obj_6pkcs11_7_pkcs11_lib *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_11initialized___get__(struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->initialized); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1980, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pkcs11._pkcs11.lib.initialized.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_28__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_3lib_28__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_3lib_28__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_28__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_3lib_27__reduce_cython__(((struct __pyx_obj_6pkcs11_7_pkcs11_lib *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_27__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 2, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.lib.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_30__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6pkcs11_7_pkcs11_3lib_30__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_3lib_30__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pkcs11_7_pkcs11_3lib_30__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("pkcs11._pkcs11.lib.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pkcs11_7_pkcs11_3lib_29__setstate_cython__(((struct __pyx_obj_6pkcs11_7_pkcs11_lib *)__pyx_v_self), __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_6pkcs11_7_pkcs11_3lib_29__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pkcs11_7_pkcs11_lib *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 4, __pyx_L1_error)

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11.lib.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* #### Code section: module_exttypes ### */

static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11_HasFuncList(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  if (unlikely(__pyx_pw_6pkcs11_7_pkcs11_11HasFuncList_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_6pkcs11_7_pkcs11_HasFuncList(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6pkcs11_7_pkcs11_HasFuncList) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static PyMethodDef __pyx_methods_6pkcs11_7_pkcs11_HasFuncList[] = {
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_11HasFuncList_3__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_11HasFuncList_5__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6pkcs11_7_pkcs11_HasFuncList_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6pkcs11_7_pkcs11_HasFuncList},
  {Py_tp_methods, (void *)__pyx_methods_6pkcs11_7_pkcs11_HasFuncList},
  {Py_tp_new, (void *)__pyx_tp_new_6pkcs11_7_pkcs11_HasFuncList},
  {0, 0},
};
static PyType_Spec __pyx_type_6pkcs11_7_pkcs11_HasFuncList_spec = {
  "pkcs11._pkcs11.HasFuncList",
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11_HasFuncList),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  __pyx_type_6pkcs11_7_pkcs11_HasFuncList_slots,
};
#else

static PyTypeObject __pyx_type_6pkcs11_7_pkcs11_HasFuncList = {
  PyVarObject_HEAD_INIT(0, 0)
  "pkcs11._pkcs11.""HasFuncList", /*tp_name*/
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11_HasFuncList), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pkcs11_7_pkcs11_HasFuncList, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pkcs11_7_pkcs11_HasFuncList, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pkcs11_7_pkcs11_HasFuncList, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6pkcs11_7_pkcs11_lib __pyx_vtable_6pkcs11_7_pkcs11_lib;

static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11_lib(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pkcs11_7_pkcs11_lib *p;
  PyObject *o = __pyx_tp_new_6pkcs11_7_pkcs11_HasFuncList(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6pkcs11_7_pkcs11_lib *)o);
  p->__pyx_vtab = __pyx_vtabptr_6pkcs11_7_pkcs11_lib;
  p->so = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->manufacturer_id = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->library_description = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_6pkcs11_7_pkcs11_3lib_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_6pkcs11_7_pkcs11_lib(PyObject *o) {
  struct __pyx_obj_6pkcs11_7_pkcs11_lib *p = (struct __pyx_obj_6pkcs11_7_pkcs11_lib *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6pkcs11_7_pkcs11_lib) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_DeallocKeepAliveBegin(o);
    __pyx_pw_6pkcs11_7_pkcs11_3lib_26__dealloc__(o);
    __Pyx_DeallocKeepAliveEnd(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->so);
  Py_CLEAR(p->manufacturer_id);
  Py_CLEAR(p->library_description);
  __pyx_tp_dealloc_6pkcs11_7_pkcs11_HasFuncList(o);
}

static PyObject *__pyx_getprop_6pkcs11_7_pkcs11_3lib_library_version(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pkcs11_7_pkcs11_3lib_15library_version_1__get__(o);
}

static PyObject *__pyx_getprop_6pkcs11_7_pkcs11_3lib_cryptoki_version(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pkcs11_7_pkcs11_3lib_16cryptoki_version_1__get__(o);
}

static PyObject *__pyx_getprop_6pkcs11_7_pkcs11_3lib_so(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pkcs11_7_pkcs11_3lib_2so_1__get__(o);
}

static PyObject *__pyx_getprop_6pkcs11_7_pkcs11_3lib_manufacturer_id(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pkcs11_7_pkcs11_3lib_15manufacturer_id_1__get__(o);
}

static PyObject *__pyx_getprop_6pkcs11_7_pkcs11_3lib_library_description(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pkcs11_7_pkcs11_3lib_19library_description_1__get__(o);
}

static PyObject *__pyx_getprop_6pkcs11_7_pkcs11_3lib_initialized(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pkcs11_7_pkcs11_3lib_11initialized_1__get__(o);
}

static PyMethodDef __pyx_methods_6pkcs11_7_pkcs11_lib[] = {
  {"finalize", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_3lib_5finalize, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"reinitialize", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_3lib_7reinitialize, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"get_slots", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_3lib_15get_slots, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6pkcs11_7_pkcs11_3lib_14get_slots},
  {"get_tokens", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_3lib_17get_tokens, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6pkcs11_7_pkcs11_3lib_16get_tokens},
  {"get_token", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_3lib_20get_token, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6pkcs11_7_pkcs11_3lib_19get_token},
  {"wait_for_slot_event", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_3lib_22wait_for_slot_event, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"unload", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_3lib_24unload, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_3lib_28__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_3lib_30__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6pkcs11_7_pkcs11_lib[] = {
  {"library_version", __pyx_getprop_6pkcs11_7_pkcs11_3lib_library_version, 0, PyDoc_STR("Hardware version (:class:`tuple`)."), 0},
  {"cryptoki_version", __pyx_getprop_6pkcs11_7_pkcs11_3lib_cryptoki_version, 0, PyDoc_STR("PKCS#11 (cryptoki) API version (:class:`tuple`)."), 0},
  {"so", __pyx_getprop_6pkcs11_7_pkcs11_3lib_so, 0, 0, 0},
  {"manufacturer_id", __pyx_getprop_6pkcs11_7_pkcs11_3lib_manufacturer_id, 0, 0, 0},
  {"library_description", __pyx_getprop_6pkcs11_7_pkcs11_3lib_library_description, 0, 0, 0},
  {"initialized", __pyx_getprop_6pkcs11_7_pkcs11_3lib_initialized, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6pkcs11_7_pkcs11_lib_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6pkcs11_7_pkcs11_lib},
  {Py_tp_repr, (void *)__pyx_pw_6pkcs11_7_pkcs11_3lib_13__repr__},
  {Py_tp_str, (void *)__pyx_pw_6pkcs11_7_pkcs11_3lib_11__str__},
  {Py_tp_doc, (void *)PyDoc_STR("\n    Main entry point.\n\n    This class needs to be defined cdef, so it can't shadow a class in\n    pkcs11.types.\n    ")},
  {Py_tp_methods, (void *)__pyx_methods_6pkcs11_7_pkcs11_lib},
  {Py_tp_getset, (void *)__pyx_getsets_6pkcs11_7_pkcs11_lib},
  {Py_tp_init, (void *)__pyx_pw_6pkcs11_7_pkcs11_3lib_9__init__},
  {Py_tp_new, (void *)__pyx_tp_new_6pkcs11_7_pkcs11_lib},
  {0, 0},
};
static PyType_Spec __pyx_type_6pkcs11_7_pkcs11_lib_spec = {
  "pkcs11._pkcs11.lib",
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11_lib),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  __pyx_type_6pkcs11_7_pkcs11_lib_slots,
};
#else

static PyTypeObject __pyx_type_6pkcs11_7_pkcs11_lib = {
  PyVarObject_HEAD_INIT(0, 0)
  "pkcs11._pkcs11.""lib", /*tp_name*/
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11_lib), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pkcs11_7_pkcs11_lib, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_pw_6pkcs11_7_pkcs11_3lib_13__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pw_6pkcs11_7_pkcs11_3lib_11__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  PyDoc_STR("\n    Main entry point.\n\n    This class needs to be defined cdef, so it can't shadow a class in\n    pkcs11.types.\n    "), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pkcs11_7_pkcs11_lib, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6pkcs11_7_pkcs11_lib, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_6pkcs11_7_pkcs11_3lib_9__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pkcs11_7_pkcs11_lib, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6pkcs11_7_pkcs11_AttributeList __pyx_vtable_6pkcs11_7_pkcs11_AttributeList;

static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11_AttributeList(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *)o);
  p->__pyx_vtab = __pyx_vtabptr_6pkcs11_7_pkcs11_AttributeList;
  if (unlikely(__pyx_pw_6pkcs11_7_pkcs11_13AttributeList_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_6pkcs11_7_pkcs11_AttributeList(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6pkcs11_7_pkcs11_AttributeList) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_DeallocKeepAliveBegin(o);
    __pyx_pw_6pkcs11_7_pkcs11_13AttributeList_9__dealloc__(o);
    __Pyx_DeallocKeepAliveEnd(o);
    PyErr_Restore(etype, eval, etb);
  }
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static PyMethodDef __pyx_methods_6pkcs11_7_pkcs11_AttributeList[] = {
  {"as_dict", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_13AttributeList_5as_dict, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_13AttributeList_7get, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_13AttributeList_11__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_13AttributeList_13__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6pkcs11_7_pkcs11_AttributeList_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6pkcs11_7_pkcs11_AttributeList},
  {Py_tp_doc, (void *)PyDoc_STR("\n    A list of CK_ATTRIBUTE objects.\n    ")},
  {Py_tp_methods, (void *)__pyx_methods_6pkcs11_7_pkcs11_AttributeList},
  {Py_tp_init, (void *)__pyx_pw_6pkcs11_7_pkcs11_13AttributeList_3__init__},
  {Py_tp_new, (void *)__pyx_tp_new_6pkcs11_7_pkcs11_AttributeList},
  {0, 0},
};
static PyType_Spec __pyx_type_6pkcs11_7_pkcs11_AttributeList_spec = {
  "pkcs11._pkcs11.AttributeList",
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  __pyx_type_6pkcs11_7_pkcs11_AttributeList_slots,
};
#else

static PyTypeObject __pyx_type_6pkcs11_7_pkcs11_AttributeList = {
  PyVarObject_HEAD_INIT(0, 0)
  "pkcs11._pkcs11.""AttributeList", /*tp_name*/
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pkcs11_7_pkcs11_AttributeList, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  PyDoc_STR("\n    A list of CK_ATTRIBUTE objects.\n    "), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pkcs11_7_pkcs11_AttributeList, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_6pkcs11_7_pkcs11_13AttributeList_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pkcs11_7_pkcs11_AttributeList, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11_MechanismWithParam(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *)o);
  p->_python_param = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_6pkcs11_7_pkcs11_18MechanismWithParam_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_6pkcs11_7_pkcs11_MechanismWithParam(PyObject *o) {
  struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *p = (struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6pkcs11_7_pkcs11_MechanismWithParam) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_DeallocKeepAliveBegin(o);
    __pyx_pw_6pkcs11_7_pkcs11_18MechanismWithParam_5__dealloc__(o);
    __Pyx_DeallocKeepAliveEnd(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_python_param);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_6pkcs11_7_pkcs11_MechanismWithParam(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *p = (struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_python_param) {
    e = (*v)(p->_python_param, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pkcs11_7_pkcs11_MechanismWithParam(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *p = (struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *)o;
  tmp = ((PyObject*)p->_python_param);
  p->_python_param = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_6pkcs11_7_pkcs11_MechanismWithParam[] = {
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_18MechanismWithParam_7__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_18MechanismWithParam_9__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6pkcs11_7_pkcs11_MechanismWithParam_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6pkcs11_7_pkcs11_MechanismWithParam},
  {Py_tp_doc, (void *)PyDoc_STR("\n    Python wrapper for a Mechanism with its parameter\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6pkcs11_7_pkcs11_MechanismWithParam},
  {Py_tp_clear, (void *)__pyx_tp_clear_6pkcs11_7_pkcs11_MechanismWithParam},
  {Py_tp_methods, (void *)__pyx_methods_6pkcs11_7_pkcs11_MechanismWithParam},
  {Py_tp_init, (void *)__pyx_pw_6pkcs11_7_pkcs11_18MechanismWithParam_3__init__},
  {Py_tp_new, (void *)__pyx_tp_new_6pkcs11_7_pkcs11_MechanismWithParam},
  {0, 0},
};
static PyType_Spec __pyx_type_6pkcs11_7_pkcs11_MechanismWithParam_spec = {
  "pkcs11._pkcs11.MechanismWithParam",
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6pkcs11_7_pkcs11_MechanismWithParam_slots,
};
#else

static PyTypeObject __pyx_type_6pkcs11_7_pkcs11_MechanismWithParam = {
  PyVarObject_HEAD_INIT(0, 0)
  "pkcs11._pkcs11.""MechanismWithParam", /*tp_name*/
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pkcs11_7_pkcs11_MechanismWithParam, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("\n    Python wrapper for a Mechanism with its parameter\n    "), /*tp_doc*/
  __pyx_tp_traverse_6pkcs11_7_pkcs11_MechanismWithParam, /*tp_traverse*/
  __pyx_tp_clear_6pkcs11_7_pkcs11_MechanismWithParam, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pkcs11_7_pkcs11_MechanismWithParam, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_6pkcs11_7_pkcs11_18MechanismWithParam_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pkcs11_7_pkcs11_MechanismWithParam, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6pkcs11_7_pkcs11_Slot __pyx_vtable_6pkcs11_7_pkcs11_Slot;

static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11_Slot(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pkcs11_7_pkcs11_Slot *p;
  PyObject *o = __pyx_tp_new_6pkcs11_7_pkcs11_HasFuncList(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6pkcs11_7_pkcs11_Slot *)o);
  p->__pyx_vtab = __pyx_vtabptr_6pkcs11_7_pkcs11_Slot;
  p->slot_description = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->manufacturer_id = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6pkcs11_7_pkcs11_Slot(PyObject *o) {
  struct __pyx_obj_6pkcs11_7_pkcs11_Slot *p = (struct __pyx_obj_6pkcs11_7_pkcs11_Slot *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6pkcs11_7_pkcs11_Slot) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  Py_CLEAR(p->slot_description);
  Py_CLEAR(p->manufacturer_id);
  __pyx_tp_dealloc_6pkcs11_7_pkcs11_HasFuncList(o);
}

static PyObject *__pyx_getprop_6pkcs11_7_pkcs11_4Slot_flags(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pkcs11_7_pkcs11_4Slot_5flags_1__get__(o);
}

static PyObject *__pyx_getprop_6pkcs11_7_pkcs11_4Slot_hardware_version(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pkcs11_7_pkcs11_4Slot_16hardware_version_1__get__(o);
}

static PyObject *__pyx_getprop_6pkcs11_7_pkcs11_4Slot_firmware_version(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pkcs11_7_pkcs11_4Slot_16firmware_version_1__get__(o);
}

static PyObject *__pyx_getprop_6pkcs11_7_pkcs11_4Slot_cryptoki_version(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pkcs11_7_pkcs11_4Slot_16cryptoki_version_1__get__(o);
}

static PyObject *__pyx_getprop_6pkcs11_7_pkcs11_4Slot_slot_id(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pkcs11_7_pkcs11_4Slot_7slot_id_1__get__(o);
}

static PyObject *__pyx_getprop_6pkcs11_7_pkcs11_4Slot_slot_description(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pkcs11_7_pkcs11_4Slot_16slot_description_1__get__(o);
}

static PyObject *__pyx_getprop_6pkcs11_7_pkcs11_4Slot_manufacturer_id(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pkcs11_7_pkcs11_4Slot_15manufacturer_id_1__get__(o);
}

static PyMethodDef __pyx_methods_6pkcs11_7_pkcs11_Slot[] = {
  {"get_token", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_4Slot_3get_token, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"get_mechanisms", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_4Slot_5get_mechanisms, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"get_mechanism_info", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_4Slot_7get_mechanism_info, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"_identity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_4Slot_9_identity, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_4Slot_15__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_4Slot_17__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6pkcs11_7_pkcs11_Slot[] = {
  {"flags", __pyx_getprop_6pkcs11_7_pkcs11_4Slot_flags, 0, PyDoc_STR("Capabilities of this slot (:class:`SlotFlag`)."), 0},
  {"hardware_version", __pyx_getprop_6pkcs11_7_pkcs11_4Slot_hardware_version, 0, PyDoc_STR("Hardware version (:class:`tuple`)."), 0},
  {"firmware_version", __pyx_getprop_6pkcs11_7_pkcs11_4Slot_firmware_version, 0, PyDoc_STR("Firmware version (:class:`tuple`)."), 0},
  {"cryptoki_version", __pyx_getprop_6pkcs11_7_pkcs11_4Slot_cryptoki_version, 0, PyDoc_STR("PKCS#11 (cryptoki) API version (:class:`tuple`)."), 0},
  {"slot_id", __pyx_getprop_6pkcs11_7_pkcs11_4Slot_slot_id, 0, 0, 0},
  {"slot_description", __pyx_getprop_6pkcs11_7_pkcs11_4Slot_slot_description, 0, 0, 0},
  {"manufacturer_id", __pyx_getprop_6pkcs11_7_pkcs11_4Slot_manufacturer_id, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6pkcs11_7_pkcs11_Slot_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6pkcs11_7_pkcs11_Slot},
  {Py_tp_repr, (void *)__pyx_pw_6pkcs11_7_pkcs11_4Slot_13__repr__},
  {Py_tp_str, (void *)__pyx_pw_6pkcs11_7_pkcs11_4Slot_11__str__},
  {Py_tp_doc, (void *)PyDoc_STR("Extend Slot with implementation.")},
  {Py_tp_methods, (void *)__pyx_methods_6pkcs11_7_pkcs11_Slot},
  {Py_tp_getset, (void *)__pyx_getsets_6pkcs11_7_pkcs11_Slot},
  {Py_tp_init, (void *)__pyx_pw_6pkcs11_7_pkcs11_4Slot_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_6pkcs11_7_pkcs11_Slot},
  {0, 0},
};
static PyType_Spec __pyx_type_6pkcs11_7_pkcs11_Slot_spec = {
  "pkcs11._pkcs11.Slot",
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11_Slot),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  __pyx_type_6pkcs11_7_pkcs11_Slot_slots,
};
#else

static PyTypeObject __pyx_type_6pkcs11_7_pkcs11_Slot = {
  PyVarObject_HEAD_INIT(0, 0)
  "pkcs11._pkcs11.""Slot", /*tp_name*/
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11_Slot), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pkcs11_7_pkcs11_Slot, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_pw_6pkcs11_7_pkcs11_4Slot_13__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pw_6pkcs11_7_pkcs11_4Slot_11__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  PyDoc_STR("Extend Slot with implementation."), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pkcs11_7_pkcs11_Slot, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6pkcs11_7_pkcs11_Slot, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_6pkcs11_7_pkcs11_4Slot_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pkcs11_7_pkcs11_Slot, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6pkcs11_7_pkcs11_Token __pyx_vtable_6pkcs11_7_pkcs11_Token;

static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11_Token(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pkcs11_7_pkcs11_Token *p;
  PyObject *o = __pyx_tp_new_6pkcs11_7_pkcs11_HasFuncList(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6pkcs11_7_pkcs11_Token *)o);
  p->__pyx_vtab = __pyx_vtabptr_6pkcs11_7_pkcs11_Token;
  p->slot = ((struct __pyx_obj_6pkcs11_7_pkcs11_Slot *)Py_None); Py_INCREF(Py_None);
  p->label = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->serial = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->manufacturer_id = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->model = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6pkcs11_7_pkcs11_Token(PyObject *o) {
  struct __pyx_obj_6pkcs11_7_pkcs11_Token *p = (struct __pyx_obj_6pkcs11_7_pkcs11_Token *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6pkcs11_7_pkcs11_Token) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->slot);
  Py_CLEAR(p->label);
  Py_CLEAR(p->serial);
  Py_CLEAR(p->manufacturer_id);
  Py_CLEAR(p->model);
  __pyx_tp_dealloc_6pkcs11_7_pkcs11_HasFuncList(o);
}

static int __pyx_tp_traverse_6pkcs11_7_pkcs11_Token(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pkcs11_7_pkcs11_Token *p = (struct __pyx_obj_6pkcs11_7_pkcs11_Token *)o;
  #if !CYTHON_USE_MODULE_STATE
  e = 0;
  if (likely(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList)) {
    traverseproc traverse = __Pyx_PyType_GetSlot(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList, tp_traverse, traverseproc);
    if (traverse) { e = traverse(o, v, a); }
  } else
  #endif
  { e = __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_6pkcs11_7_pkcs11_Token); }
  if (e) return e;
  {
    e = __Pyx_call_type_traverse(o, 0, v, a);
    if (e) return e;
  }
  if (p->slot) {
    e = (*v)(((PyObject *)p->slot), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pkcs11_7_pkcs11_Token(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6pkcs11_7_pkcs11_Token *p = (struct __pyx_obj_6pkcs11_7_pkcs11_Token *)o;
  #if !CYTHON_USE_MODULE_STATE
  if (likely(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList)) {
    inquiry clear = __Pyx_PyType_GetSlot(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList, tp_clear, inquiry);
    if (clear) clear(o);
  } else
  #endif
  { __Pyx_call_next_tp_clear(o, __pyx_tp_clear_6pkcs11_7_pkcs11_Token); }
  tmp = ((PyObject*)p->slot);
  p->slot = ((struct __pyx_obj_6pkcs11_7_pkcs11_Slot *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_6pkcs11_7_pkcs11_5Token_flags(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pkcs11_7_pkcs11_5Token_5flags_1__get__(o);
}

static PyObject *__pyx_getprop_6pkcs11_7_pkcs11_5Token_hardware_version(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pkcs11_7_pkcs11_5Token_16hardware_version_1__get__(o);
}

static PyObject *__pyx_getprop_6pkcs11_7_pkcs11_5Token_firmware_version(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pkcs11_7_pkcs11_5Token_16firmware_version_1__get__(o);
}

static PyObject *__pyx_getprop_6pkcs11_7_pkcs11_5Token_slot(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pkcs11_7_pkcs11_5Token_4slot_1__get__(o);
}

static PyObject *__pyx_getprop_6pkcs11_7_pkcs11_5Token_label(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pkcs11_7_pkcs11_5Token_5label_1__get__(o);
}

static PyObject *__pyx_getprop_6pkcs11_7_pkcs11_5Token_serial(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pkcs11_7_pkcs11_5Token_6serial_1__get__(o);
}

static PyObject *__pyx_getprop_6pkcs11_7_pkcs11_5Token_manufacturer_id(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pkcs11_7_pkcs11_5Token_15manufacturer_id_1__get__(o);
}

static PyObject *__pyx_getprop_6pkcs11_7_pkcs11_5Token_model(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pkcs11_7_pkcs11_5Token_5model_1__get__(o);
}

static PyMethodDef __pyx_methods_6pkcs11_7_pkcs11_Token[] = {
  {"open", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_5Token_3open, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"_identity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_5Token_7_identity, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_5Token_11__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_5Token_13__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6pkcs11_7_pkcs11_Token[] = {
  {"flags", __pyx_getprop_6pkcs11_7_pkcs11_5Token_flags, 0, PyDoc_STR("Capabilities of this token (:class:`TokenFlag`)."), 0},
  {"hardware_version", __pyx_getprop_6pkcs11_7_pkcs11_5Token_hardware_version, 0, PyDoc_STR("Hardware version (:class:`tuple`)."), 0},
  {"firmware_version", __pyx_getprop_6pkcs11_7_pkcs11_5Token_firmware_version, 0, PyDoc_STR("Firmware version (:class:`tuple`)."), 0},
  {"slot", __pyx_getprop_6pkcs11_7_pkcs11_5Token_slot, 0, 0, 0},
  {"label", __pyx_getprop_6pkcs11_7_pkcs11_5Token_label, 0, 0, 0},
  {"serial", __pyx_getprop_6pkcs11_7_pkcs11_5Token_serial, 0, 0, 0},
  {"manufacturer_id", __pyx_getprop_6pkcs11_7_pkcs11_5Token_manufacturer_id, 0, 0, 0},
  {"model", __pyx_getprop_6pkcs11_7_pkcs11_5Token_model, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6pkcs11_7_pkcs11_Token_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6pkcs11_7_pkcs11_Token},
  {Py_tp_repr, (void *)__pyx_pw_6pkcs11_7_pkcs11_5Token_9__repr__},
  {Py_tp_str, (void *)__pyx_pw_6pkcs11_7_pkcs11_5Token_5__str__},
  {Py_tp_doc, (void *)PyDoc_STR("Extend Token with implementation.")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6pkcs11_7_pkcs11_Token},
  {Py_tp_clear, (void *)__pyx_tp_clear_6pkcs11_7_pkcs11_Token},
  {Py_tp_methods, (void *)__pyx_methods_6pkcs11_7_pkcs11_Token},
  {Py_tp_getset, (void *)__pyx_getsets_6pkcs11_7_pkcs11_Token},
  {Py_tp_init, (void *)__pyx_pw_6pkcs11_7_pkcs11_5Token_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_6pkcs11_7_pkcs11_Token},
  {0, 0},
};
static PyType_Spec __pyx_type_6pkcs11_7_pkcs11_Token_spec = {
  "pkcs11._pkcs11.Token",
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11_Token),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6pkcs11_7_pkcs11_Token_slots,
};
#else

static PyTypeObject __pyx_type_6pkcs11_7_pkcs11_Token = {
  PyVarObject_HEAD_INIT(0, 0)
  "pkcs11._pkcs11.""Token", /*tp_name*/
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11_Token), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pkcs11_7_pkcs11_Token, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_pw_6pkcs11_7_pkcs11_5Token_9__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pw_6pkcs11_7_pkcs11_5Token_5__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Extend Token with implementation."), /*tp_doc*/
  __pyx_tp_traverse_6pkcs11_7_pkcs11_Token, /*tp_traverse*/
  __pyx_tp_clear_6pkcs11_7_pkcs11_Token, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pkcs11_7_pkcs11_Token, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6pkcs11_7_pkcs11_Token, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_6pkcs11_7_pkcs11_5Token_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pkcs11_7_pkcs11_Token, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6pkcs11_7_pkcs11_OperationContext __pyx_vtable_6pkcs11_7_pkcs11_OperationContext;

static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11_OperationContext(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *)o);
  p->__pyx_vtab = __pyx_vtabptr_6pkcs11_7_pkcs11_OperationContext;
  p->session = ((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_6pkcs11_7_pkcs11_16OperationContext_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

#if CYTHON_USE_TP_FINALIZE

static void __pyx_tp_finalize_6pkcs11_7_pkcs11_OperationContext(PyObject *o) {
  PyObject *etype, *eval, *etb;
  PyErr_Fetch(&etype, &eval, &etb);
  __pyx_pw_6pkcs11_7_pkcs11_16OperationContext_13__del__(o);
  PyErr_Restore(etype, eval, etb);
}
#endif

static void __pyx_tp_dealloc_6pkcs11_7_pkcs11_OperationContext(PyObject *o) {
  struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *p = (struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6pkcs11_7_pkcs11_OperationContext) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->session);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_6pkcs11_7_pkcs11_OperationContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *p = (struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->session) {
    e = (*v)(((PyObject *)p->session), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pkcs11_7_pkcs11_OperationContext(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *p = (struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *)o;
  tmp = ((PyObject*)p->session);
  p->session = ((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_6pkcs11_7_pkcs11_OperationContext[] = {
  {"__enter__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_16OperationContext_5__enter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__exit__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_16OperationContext_7__exit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"_initiate", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_16OperationContext_9_initiate, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"_finalize", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_16OperationContext_11_finalize, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_16OperationContext_15__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_16OperationContext_17__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6pkcs11_7_pkcs11_OperationContext_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6pkcs11_7_pkcs11_OperationContext},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6pkcs11_7_pkcs11_OperationContext},
  {Py_tp_clear, (void *)__pyx_tp_clear_6pkcs11_7_pkcs11_OperationContext},
  {Py_tp_methods, (void *)__pyx_methods_6pkcs11_7_pkcs11_OperationContext},
  {Py_tp_init, (void *)__pyx_pw_6pkcs11_7_pkcs11_16OperationContext_3__init__},
  {Py_tp_new, (void *)__pyx_tp_new_6pkcs11_7_pkcs11_OperationContext},
  #if CYTHON_USE_TP_FINALIZE
  {Py_tp_finalize, (void *)__pyx_tp_finalize_6pkcs11_7_pkcs11_OperationContext},
  #endif
  {0, 0},
};
static PyType_Spec __pyx_type_6pkcs11_7_pkcs11_OperationContext_spec = {
  "pkcs11._pkcs11.OperationContext",
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6pkcs11_7_pkcs11_OperationContext_slots,
};
#else

static PyTypeObject __pyx_type_6pkcs11_7_pkcs11_OperationContext = {
  PyVarObject_HEAD_INIT(0, 0)
  "pkcs11._pkcs11.""OperationContext", /*tp_name*/
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pkcs11_7_pkcs11_OperationContext, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6pkcs11_7_pkcs11_OperationContext, /*tp_traverse*/
  __pyx_tp_clear_6pkcs11_7_pkcs11_OperationContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pkcs11_7_pkcs11_OperationContext, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_6pkcs11_7_pkcs11_16OperationContext_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pkcs11_7_pkcs11_OperationContext, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  __pyx_tp_finalize_6pkcs11_7_pkcs11_OperationContext, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6pkcs11_7_pkcs11_OperationWithBinaryOutput __pyx_vtable_6pkcs11_7_pkcs11_OperationWithBinaryOutput;

static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11_OperationWithBinaryOutput(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *p;
  PyObject *o = __pyx_tp_new_6pkcs11_7_pkcs11_OperationContext(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6pkcs11_7_pkcs11_OperationContext*)__pyx_vtabptr_6pkcs11_7_pkcs11_OperationWithBinaryOutput;
  p->mech = ((struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *)Py_None); Py_INCREF(Py_None);
  p->output_buf.data = NULL;
  p->output_buf.memview = NULL;
  return o;
}

static void __pyx_tp_dealloc_6pkcs11_7_pkcs11_OperationWithBinaryOutput(PyObject *o) {
  struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *p = (struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6pkcs11_7_pkcs11_OperationWithBinaryOutput) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->mech);
  __PYX_XCLEAR_MEMVIEW(&p->output_buf, 1);
  p->output_buf.memview = NULL; p->output_buf.data = NULL;
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_6pkcs11_7_pkcs11_OperationContext(o);
}

static int __pyx_tp_traverse_6pkcs11_7_pkcs11_OperationWithBinaryOutput(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *p = (struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *)o;
  e = __pyx_tp_traverse_6pkcs11_7_pkcs11_OperationContext(o, v, a); if (e) return e;
  if (p->mech) {
    e = (*v)(((PyObject *)p->mech), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pkcs11_7_pkcs11_OperationWithBinaryOutput(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *p = (struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *)o;
  __pyx_tp_clear_6pkcs11_7_pkcs11_OperationContext(o);
  tmp = ((PyObject*)p->mech);
  p->mech = ((struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_6pkcs11_7_pkcs11_OperationWithBinaryOutput[] = {
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6pkcs11_7_pkcs11_OperationWithBinaryOutput_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6pkcs11_7_pkcs11_OperationWithBinaryOutput},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6pkcs11_7_pkcs11_OperationWithBinaryOutput},
  {Py_tp_clear, (void *)__pyx_tp_clear_6pkcs11_7_pkcs11_OperationWithBinaryOutput},
  {Py_tp_methods, (void *)__pyx_methods_6pkcs11_7_pkcs11_OperationWithBinaryOutput},
  {Py_tp_new, (void *)__pyx_tp_new_6pkcs11_7_pkcs11_OperationWithBinaryOutput},
  {0, 0},
};
static PyType_Spec __pyx_type_6pkcs11_7_pkcs11_OperationWithBinaryOutput_spec = {
  "pkcs11._pkcs11.OperationWithBinaryOutput",
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6pkcs11_7_pkcs11_OperationWithBinaryOutput_slots,
};
#else

static PyTypeObject __pyx_type_6pkcs11_7_pkcs11_OperationWithBinaryOutput = {
  PyVarObject_HEAD_INIT(0, 0)
  "pkcs11._pkcs11.""OperationWithBinaryOutput", /*tp_name*/
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pkcs11_7_pkcs11_OperationWithBinaryOutput, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6pkcs11_7_pkcs11_OperationWithBinaryOutput, /*tp_traverse*/
  __pyx_tp_clear_6pkcs11_7_pkcs11_OperationWithBinaryOutput, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pkcs11_7_pkcs11_OperationWithBinaryOutput, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_6pkcs11_7_pkcs11_16OperationContext_3__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_6pkcs11_7_pkcs11_OperationWithBinaryOutput, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6pkcs11_7_pkcs11_SearchIter __pyx_vtable_6pkcs11_7_pkcs11_SearchIter;

static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11_SearchIter(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter *p;
  PyObject *o = __pyx_tp_new_6pkcs11_7_pkcs11_OperationContext(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6pkcs11_7_pkcs11_OperationContext*)__pyx_vtabptr_6pkcs11_7_pkcs11_SearchIter;
  p->__pyx_template = ((struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6pkcs11_7_pkcs11_SearchIter(PyObject *o) {
  struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter *p = (struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6pkcs11_7_pkcs11_SearchIter) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_template);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_6pkcs11_7_pkcs11_OperationContext(o);
}

static int __pyx_tp_traverse_6pkcs11_7_pkcs11_SearchIter(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter *p = (struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter *)o;
  e = __pyx_tp_traverse_6pkcs11_7_pkcs11_OperationContext(o, v, a); if (e) return e;
  if (p->__pyx_template) {
    e = (*v)(((PyObject *)p->__pyx_template), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pkcs11_7_pkcs11_SearchIter(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter *p = (struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter *)o;
  __pyx_tp_clear_6pkcs11_7_pkcs11_OperationContext(o);
  tmp = ((PyObject*)p->__pyx_template);
  p->__pyx_template = ((struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_specialmethod___pyx_pw_6pkcs11_7_pkcs11_10SearchIter_8__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  PyObject *res = __pyx_pw_6pkcs11_7_pkcs11_10SearchIter_8__next__(self);
  if (!res && !PyErr_Occurred()) { PyErr_SetNone(PyExc_StopIteration); }
  return res;
}

static PyMethodDef __pyx_methods_6pkcs11_7_pkcs11_SearchIter[] = {
  {"_batch_iter", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_10SearchIter_5_batch_iter, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_6pkcs11_7_pkcs11_10SearchIter_8__next__, METH_NOARGS|METH_COEXIST, __pyx_doc_6pkcs11_7_pkcs11_10SearchIter_7__next__},
  {"_initiate", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_10SearchIter_10_initiate, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"_finalize", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_10SearchIter_12_finalize, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6pkcs11_7_pkcs11_10SearchIter_11_finalize},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_10SearchIter_14__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_10SearchIter_16__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6pkcs11_7_pkcs11_SearchIter_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6pkcs11_7_pkcs11_SearchIter},
  {Py_tp_doc, (void *)PyDoc_STR("Iterate a search for objects on a session.")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6pkcs11_7_pkcs11_SearchIter},
  {Py_tp_clear, (void *)__pyx_tp_clear_6pkcs11_7_pkcs11_SearchIter},
  {Py_tp_iter, (void *)__pyx_pw_6pkcs11_7_pkcs11_10SearchIter_3__iter__},
  {Py_tp_iternext, (void *)__pyx_pw_6pkcs11_7_pkcs11_10SearchIter_8__next__},
  {Py_tp_methods, (void *)__pyx_methods_6pkcs11_7_pkcs11_SearchIter},
  {Py_tp_init, (void *)__pyx_pw_6pkcs11_7_pkcs11_10SearchIter_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_6pkcs11_7_pkcs11_SearchIter},
  {0, 0},
};
static PyType_Spec __pyx_type_6pkcs11_7_pkcs11_SearchIter_spec = {
  "pkcs11._pkcs11.SearchIter",
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6pkcs11_7_pkcs11_SearchIter_slots,
};
#else

static PyTypeObject __pyx_type_6pkcs11_7_pkcs11_SearchIter = {
  PyVarObject_HEAD_INIT(0, 0)
  "pkcs11._pkcs11.""SearchIter", /*tp_name*/
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11_SearchIter), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pkcs11_7_pkcs11_SearchIter, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Iterate a search for objects on a session."), /*tp_doc*/
  __pyx_tp_traverse_6pkcs11_7_pkcs11_SearchIter, /*tp_traverse*/
  __pyx_tp_clear_6pkcs11_7_pkcs11_SearchIter, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_6pkcs11_7_pkcs11_10SearchIter_3__iter__, /*tp_iter*/
  __pyx_pw_6pkcs11_7_pkcs11_10SearchIter_8__next__, /*tp_iternext*/
  __pyx_methods_6pkcs11_7_pkcs11_SearchIter, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_6pkcs11_7_pkcs11_10SearchIter_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pkcs11_7_pkcs11_SearchIter, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DigestOperation __pyx_vtable_6pkcs11_7_pkcs11_DigestOperation;

static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11_DigestOperation(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *p;
  PyObject *o = __pyx_tp_new_6pkcs11_7_pkcs11_OperationWithBinaryOutput(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6pkcs11_7_pkcs11_OperationContext*)__pyx_vtabptr_6pkcs11_7_pkcs11_DigestOperation;
  return o;
}

static PyMethodDef __pyx_methods_6pkcs11_7_pkcs11_DigestOperation[] = {
  {"_initiate", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_15DigestOperation_1_initiate, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"ingest_chunks", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_15DigestOperation_3ingest_chunks, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"_finalize", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_15DigestOperation_5_finalize, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_15DigestOperation_7__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_15DigestOperation_9__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6pkcs11_7_pkcs11_DigestOperation_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6pkcs11_7_pkcs11_OperationWithBinaryOutput},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6pkcs11_7_pkcs11_OperationWithBinaryOutput},
  {Py_tp_clear, (void *)__pyx_tp_clear_6pkcs11_7_pkcs11_OperationWithBinaryOutput},
  {Py_tp_methods, (void *)__pyx_methods_6pkcs11_7_pkcs11_DigestOperation},
  {Py_tp_new, (void *)__pyx_tp_new_6pkcs11_7_pkcs11_DigestOperation},
  {0, 0},
};
static PyType_Spec __pyx_type_6pkcs11_7_pkcs11_DigestOperation_spec = {
  "pkcs11._pkcs11.DigestOperation",
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6pkcs11_7_pkcs11_DigestOperation_slots,
};
#else

static PyTypeObject __pyx_type_6pkcs11_7_pkcs11_DigestOperation = {
  PyVarObject_HEAD_INIT(0, 0)
  "pkcs11._pkcs11.""DigestOperation", /*tp_name*/
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pkcs11_7_pkcs11_OperationWithBinaryOutput, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6pkcs11_7_pkcs11_OperationWithBinaryOutput, /*tp_traverse*/
  __pyx_tp_clear_6pkcs11_7_pkcs11_OperationWithBinaryOutput, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pkcs11_7_pkcs11_DigestOperation, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_6pkcs11_7_pkcs11_16OperationContext_3__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_6pkcs11_7_pkcs11_DigestOperation, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6pkcs11_7_pkcs11_Session __pyx_vtable_6pkcs11_7_pkcs11_Session;

static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11_Session(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pkcs11_7_pkcs11_Session *p;
  PyObject *o = __pyx_tp_new_6pkcs11_7_pkcs11_HasFuncList(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)o);
  p->__pyx_vtab = __pyx_vtabptr_6pkcs11_7_pkcs11_Session;
  p->token = ((struct __pyx_obj_6pkcs11_7_pkcs11_Token *)Py_None); Py_INCREF(Py_None);
  p->operation_lock = Py_None; Py_INCREF(Py_None);
  p->attribute_mapper = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6pkcs11_7_pkcs11_Session(PyObject *o) {
  struct __pyx_obj_6pkcs11_7_pkcs11_Session *p = (struct __pyx_obj_6pkcs11_7_pkcs11_Session *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6pkcs11_7_pkcs11_Session) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->token);
  Py_CLEAR(p->operation_lock);
  Py_CLEAR(p->attribute_mapper);
  __pyx_tp_dealloc_6pkcs11_7_pkcs11_HasFuncList(o);
}

static int __pyx_tp_traverse_6pkcs11_7_pkcs11_Session(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pkcs11_7_pkcs11_Session *p = (struct __pyx_obj_6pkcs11_7_pkcs11_Session *)o;
  #if !CYTHON_USE_MODULE_STATE
  e = 0;
  if (likely(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList)) {
    traverseproc traverse = __Pyx_PyType_GetSlot(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList, tp_traverse, traverseproc);
    if (traverse) { e = traverse(o, v, a); }
  } else
  #endif
  { e = __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_6pkcs11_7_pkcs11_Session); }
  if (e) return e;
  {
    e = __Pyx_call_type_traverse(o, 0, v, a);
    if (e) return e;
  }
  if (p->token) {
    e = (*v)(((PyObject *)p->token), a); if (e) return e;
  }
  if (p->operation_lock) {
    e = (*v)(p->operation_lock, a); if (e) return e;
  }
  if (p->attribute_mapper) {
    e = (*v)(p->attribute_mapper, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pkcs11_7_pkcs11_Session(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6pkcs11_7_pkcs11_Session *p = (struct __pyx_obj_6pkcs11_7_pkcs11_Session *)o;
  #if !CYTHON_USE_MODULE_STATE
  if (likely(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList)) {
    inquiry clear = __Pyx_PyType_GetSlot(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList, tp_clear, inquiry);
    if (clear) clear(o);
  } else
  #endif
  { __Pyx_call_next_tp_clear(o, __pyx_tp_clear_6pkcs11_7_pkcs11_Session); }
  tmp = ((PyObject*)p->token);
  p->token = ((struct __pyx_obj_6pkcs11_7_pkcs11_Token *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->operation_lock);
  p->operation_lock = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->attribute_mapper);
  p->attribute_mapper = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_6pkcs11_7_pkcs11_7Session_user_type(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pkcs11_7_pkcs11_7Session_9user_type_1__get__(o);
}

static PyObject *__pyx_getprop_6pkcs11_7_pkcs11_7Session_handle(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pkcs11_7_pkcs11_7Session_6handle_1__get__(o);
}

static PyObject *__pyx_getprop_6pkcs11_7_pkcs11_7Session_token(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pkcs11_7_pkcs11_7Session_5token_1__get__(o);
}

static PyObject *__pyx_getprop_6pkcs11_7_pkcs11_7Session_rw(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pkcs11_7_pkcs11_7Session_2rw_1__get__(o);
}

static PyMethodDef __pyx_methods_6pkcs11_7_pkcs11_Session[] = {
  {"_identity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_3_identity, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"close", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_5close, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"get_objects", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_7get_objects, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"reaffirm_credentials", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_10reaffirm_credentials, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"create_object", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_12create_object, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"create_domain_parameters", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_14create_domain_parameters, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"generate_domain_parameters", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_16generate_domain_parameters, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"generate_key", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_18generate_key, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"_generate_keypair", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_20_generate_keypair, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"seed_random", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_22seed_random, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"generate_random", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_24generate_random, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"_Session__digest_operation", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_26_Session__digest_operation, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"_digest", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_28_digest, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"_digest_generator", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_30_digest_generator, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"set_pin", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_32set_pin, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"init_pin", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_34init_pin, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_36__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_7Session_38__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6pkcs11_7_pkcs11_Session[] = {
  {"user_type", __pyx_getprop_6pkcs11_7_pkcs11_7Session_user_type, 0, PyDoc_STR("User type for this session (:class:`pkcs11.constants.UserType` or :class:`int` for vendor-specific values)."), 0},
  {"handle", __pyx_getprop_6pkcs11_7_pkcs11_7Session_handle, 0, 0, 0},
  {"token", __pyx_getprop_6pkcs11_7_pkcs11_7Session_token, 0, 0, 0},
  {"rw", __pyx_getprop_6pkcs11_7_pkcs11_7Session_rw, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6pkcs11_7_pkcs11_Session_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6pkcs11_7_pkcs11_Session},
  {Py_tp_doc, (void *)PyDoc_STR("Extend Session with implementation.")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6pkcs11_7_pkcs11_Session},
  {Py_tp_clear, (void *)__pyx_tp_clear_6pkcs11_7_pkcs11_Session},
  {Py_tp_methods, (void *)__pyx_methods_6pkcs11_7_pkcs11_Session},
  {Py_tp_getset, (void *)__pyx_getsets_6pkcs11_7_pkcs11_Session},
  {Py_tp_init, (void *)__pyx_pw_6pkcs11_7_pkcs11_7Session_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_6pkcs11_7_pkcs11_Session},
  {0, 0},
};
static PyType_Spec __pyx_type_6pkcs11_7_pkcs11_Session_spec = {
  "pkcs11._pkcs11.Session",
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11_Session),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6pkcs11_7_pkcs11_Session_slots,
};
#else

static PyTypeObject __pyx_type_6pkcs11_7_pkcs11_Session = {
  PyVarObject_HEAD_INIT(0, 0)
  "pkcs11._pkcs11.""Session", /*tp_name*/
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11_Session), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pkcs11_7_pkcs11_Session, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Extend Session with implementation."), /*tp_doc*/
  __pyx_tp_traverse_6pkcs11_7_pkcs11_Session, /*tp_traverse*/
  __pyx_tp_clear_6pkcs11_7_pkcs11_Session, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pkcs11_7_pkcs11_Session, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6pkcs11_7_pkcs11_Session, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_6pkcs11_7_pkcs11_7Session_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pkcs11_7_pkcs11_Session, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6pkcs11_7_pkcs11_ObjectHandleWrapper __pyx_vtable_6pkcs11_7_pkcs11_ObjectHandleWrapper;

static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11_ObjectHandleWrapper(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *p;
  PyObject *o = __pyx_tp_new_6pkcs11_7_pkcs11_HasFuncList(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *)o);
  p->__pyx_vtab = __pyx_vtabptr_6pkcs11_7_pkcs11_ObjectHandleWrapper;
  p->session = ((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6pkcs11_7_pkcs11_ObjectHandleWrapper(PyObject *o) {
  struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *p = (struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6pkcs11_7_pkcs11_ObjectHandleWrapper) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->session);
  __pyx_tp_dealloc_6pkcs11_7_pkcs11_HasFuncList(o);
}

static int __pyx_tp_traverse_6pkcs11_7_pkcs11_ObjectHandleWrapper(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *p = (struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *)o;
  #if !CYTHON_USE_MODULE_STATE
  e = 0;
  if (likely(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList)) {
    traverseproc traverse = __Pyx_PyType_GetSlot(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList, tp_traverse, traverseproc);
    if (traverse) { e = traverse(o, v, a); }
  } else
  #endif
  { e = __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_6pkcs11_7_pkcs11_ObjectHandleWrapper); }
  if (e) return e;
  {
    e = __Pyx_call_type_traverse(o, 0, v, a);
    if (e) return e;
  }
  if (p->session) {
    e = (*v)(((PyObject *)p->session), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pkcs11_7_pkcs11_ObjectHandleWrapper(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *p = (struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *)o;
  #if !CYTHON_USE_MODULE_STATE
  if (likely(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList)) {
    inquiry clear = __Pyx_PyType_GetSlot(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList, tp_clear, inquiry);
    if (clear) clear(o);
  } else
  #endif
  { __Pyx_call_next_tp_clear(o, __pyx_tp_clear_6pkcs11_7_pkcs11_ObjectHandleWrapper); }
  tmp = ((PyObject*)p->session);
  p->session = ((struct __pyx_obj_6pkcs11_7_pkcs11_Session *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_sq_item_6pkcs11_7_pkcs11_ObjectHandleWrapper(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0;
  #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000)
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  #else
  r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x);
  #endif
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_6pkcs11_7_pkcs11_ObjectHandleWrapper(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_5__setitem__(o, i, v);
  }
  else {
    __Pyx_TypeName o_type_name;
    objobjargproc f = __Pyx_PyType_TryGetSubSlot(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList, tp_as_mapping, mp_ass_subscript, objobjargproc);
    if (f)
    return f(o, i, v);
    o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o));
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name);
    __Pyx_DECREF_TypeName(o_type_name);
    return -1;
  }
}

static PyObject *__pyx_getprop_6pkcs11_7_pkcs11_19ObjectHandleWrapper_session(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_7session_1__get__(o);
}

static PyObject *__pyx_getprop_6pkcs11_7_pkcs11_19ObjectHandleWrapper_handle(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_6handle_1__get__(o);
}

static PyMethodDef __pyx_methods_6pkcs11_7_pkcs11_ObjectHandleWrapper[] = {
  {"destroy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_7destroy, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"copy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_9copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"identity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_11identity, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_13__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_15__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6pkcs11_7_pkcs11_ObjectHandleWrapper[] = {
  {"session", __pyx_getprop_6pkcs11_7_pkcs11_19ObjectHandleWrapper_session, 0, 0, 0},
  {"handle", __pyx_getprop_6pkcs11_7_pkcs11_19ObjectHandleWrapper_handle, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6pkcs11_7_pkcs11_ObjectHandleWrapper_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6pkcs11_7_pkcs11_ObjectHandleWrapper},
  {Py_sq_item, (void *)__pyx_sq_item_6pkcs11_7_pkcs11_ObjectHandleWrapper},
  {Py_mp_subscript, (void *)__pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_3__getitem__},
  {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_6pkcs11_7_pkcs11_ObjectHandleWrapper},
  {Py_tp_doc, (void *)PyDoc_STR("\n    Class implementing generic operations on PKCS#11 objects.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6pkcs11_7_pkcs11_ObjectHandleWrapper},
  {Py_tp_clear, (void *)__pyx_tp_clear_6pkcs11_7_pkcs11_ObjectHandleWrapper},
  {Py_tp_methods, (void *)__pyx_methods_6pkcs11_7_pkcs11_ObjectHandleWrapper},
  {Py_tp_getset, (void *)__pyx_getsets_6pkcs11_7_pkcs11_ObjectHandleWrapper},
  {Py_tp_init, (void *)__pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_6pkcs11_7_pkcs11_ObjectHandleWrapper},
  {0, 0},
};
static PyType_Spec __pyx_type_6pkcs11_7_pkcs11_ObjectHandleWrapper_spec = {
  "pkcs11._pkcs11.ObjectHandleWrapper",
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6pkcs11_7_pkcs11_ObjectHandleWrapper_slots,
};
#else

static PySequenceMethods __pyx_tp_as_sequence_ObjectHandleWrapper = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_6pkcs11_7_pkcs11_ObjectHandleWrapper, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_ObjectHandleWrapper = {
  0, /*mp_length*/
  __pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_3__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_6pkcs11_7_pkcs11_ObjectHandleWrapper, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_6pkcs11_7_pkcs11_ObjectHandleWrapper = {
  PyVarObject_HEAD_INIT(0, 0)
  "pkcs11._pkcs11.""ObjectHandleWrapper", /*tp_name*/
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pkcs11_7_pkcs11_ObjectHandleWrapper, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_ObjectHandleWrapper, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_ObjectHandleWrapper, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("\n    Class implementing generic operations on PKCS#11 objects.\n    "), /*tp_doc*/
  __pyx_tp_traverse_6pkcs11_7_pkcs11_ObjectHandleWrapper, /*tp_traverse*/
  __pyx_tp_clear_6pkcs11_7_pkcs11_ObjectHandleWrapper, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pkcs11_7_pkcs11_ObjectHandleWrapper, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6pkcs11_7_pkcs11_ObjectHandleWrapper, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_6pkcs11_7_pkcs11_19ObjectHandleWrapper_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pkcs11_7_pkcs11_ObjectHandleWrapper, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6pkcs11_7_pkcs11_KeyOperation __pyx_vtable_6pkcs11_7_pkcs11_KeyOperation;

static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11_KeyOperation(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pkcs11_7_pkcs11_KeyOperation *p;
  PyObject *o = __pyx_tp_new_6pkcs11_7_pkcs11_OperationWithBinaryOutput(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6pkcs11_7_pkcs11_KeyOperation *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6pkcs11_7_pkcs11_OperationContext*)__pyx_vtabptr_6pkcs11_7_pkcs11_KeyOperation;
  return o;
}

static PyMethodDef __pyx_methods_6pkcs11_7_pkcs11_KeyOperation[] = {
  {"unclean_shutdown", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_12KeyOperation_1unclean_shutdown, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6pkcs11_7_pkcs11_12KeyOperation_unclean_shutdown},
  {"_initiate", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_12KeyOperation_3_initiate, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"_cancel_operation", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_12KeyOperation_5_cancel_operation, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"_finalize", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_12KeyOperation_7_finalize, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_12KeyOperation_9__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_12KeyOperation_11__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6pkcs11_7_pkcs11_KeyOperation_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6pkcs11_7_pkcs11_OperationWithBinaryOutput},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6pkcs11_7_pkcs11_OperationWithBinaryOutput},
  {Py_tp_clear, (void *)__pyx_tp_clear_6pkcs11_7_pkcs11_OperationWithBinaryOutput},
  {Py_tp_methods, (void *)__pyx_methods_6pkcs11_7_pkcs11_KeyOperation},
  {Py_tp_new, (void *)__pyx_tp_new_6pkcs11_7_pkcs11_KeyOperation},
  {0, 0},
};
static PyType_Spec __pyx_type_6pkcs11_7_pkcs11_KeyOperation_spec = {
  "pkcs11._pkcs11.KeyOperation",
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11_KeyOperation),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6pkcs11_7_pkcs11_KeyOperation_slots,
};
#else

static PyTypeObject __pyx_type_6pkcs11_7_pkcs11_KeyOperation = {
  PyVarObject_HEAD_INIT(0, 0)
  "pkcs11._pkcs11.""KeyOperation", /*tp_name*/
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11_KeyOperation), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pkcs11_7_pkcs11_OperationWithBinaryOutput, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6pkcs11_7_pkcs11_OperationWithBinaryOutput, /*tp_traverse*/
  __pyx_tp_clear_6pkcs11_7_pkcs11_OperationWithBinaryOutput, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pkcs11_7_pkcs11_KeyOperation, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_6pkcs11_7_pkcs11_16OperationContext_3__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_6pkcs11_7_pkcs11_KeyOperation, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DataCryptOperation __pyx_vtable_6pkcs11_7_pkcs11_DataCryptOperation;

static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11_DataCryptOperation(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *p;
  PyObject *o = __pyx_tp_new_6pkcs11_7_pkcs11_KeyOperation(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *)o);
  p->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6pkcs11_7_pkcs11_OperationContext*)__pyx_vtabptr_6pkcs11_7_pkcs11_DataCryptOperation;
  return o;
}

static PyMethodDef __pyx_methods_6pkcs11_7_pkcs11_DataCryptOperation[] = {
  {"unclean_shutdown", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_18DataCryptOperation_1unclean_shutdown, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"update_chunks", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_18DataCryptOperation_3update_chunks, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_18DataCryptOperation_6__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_18DataCryptOperation_8__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6pkcs11_7_pkcs11_DataCryptOperation_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6pkcs11_7_pkcs11_OperationWithBinaryOutput},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6pkcs11_7_pkcs11_OperationWithBinaryOutput},
  {Py_tp_clear, (void *)__pyx_tp_clear_6pkcs11_7_pkcs11_OperationWithBinaryOutput},
  {Py_tp_methods, (void *)__pyx_methods_6pkcs11_7_pkcs11_DataCryptOperation},
  {Py_tp_new, (void *)__pyx_tp_new_6pkcs11_7_pkcs11_DataCryptOperation},
  {0, 0},
};
static PyType_Spec __pyx_type_6pkcs11_7_pkcs11_DataCryptOperation_spec = {
  "pkcs11._pkcs11.DataCryptOperation",
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6pkcs11_7_pkcs11_DataCryptOperation_slots,
};
#else

static PyTypeObject __pyx_type_6pkcs11_7_pkcs11_DataCryptOperation = {
  PyVarObject_HEAD_INIT(0, 0)
  "pkcs11._pkcs11.""DataCryptOperation", /*tp_name*/
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pkcs11_7_pkcs11_OperationWithBinaryOutput, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6pkcs11_7_pkcs11_OperationWithBinaryOutput, /*tp_traverse*/
  __pyx_tp_clear_6pkcs11_7_pkcs11_OperationWithBinaryOutput, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pkcs11_7_pkcs11_DataCryptOperation, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_6pkcs11_7_pkcs11_16OperationContext_3__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_6pkcs11_7_pkcs11_DataCryptOperation, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6pkcs11_7_pkcs11_SignOrVerifyOperation __pyx_vtable_6pkcs11_7_pkcs11_SignOrVerifyOperation;

static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11_SignOrVerifyOperation(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pkcs11_7_pkcs11_SignOrVerifyOperation *p;
  PyObject *o = __pyx_tp_new_6pkcs11_7_pkcs11_KeyOperation(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6pkcs11_7_pkcs11_SignOrVerifyOperation *)o);
  p->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6pkcs11_7_pkcs11_OperationContext*)__pyx_vtabptr_6pkcs11_7_pkcs11_SignOrVerifyOperation;
  return o;
}

static PyMethodDef __pyx_methods_6pkcs11_7_pkcs11_SignOrVerifyOperation[] = {
  {"ingest_chunks", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_21SignOrVerifyOperation_1ingest_chunks, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_21SignOrVerifyOperation_3__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_21SignOrVerifyOperation_5__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6pkcs11_7_pkcs11_SignOrVerifyOperation_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6pkcs11_7_pkcs11_OperationWithBinaryOutput},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6pkcs11_7_pkcs11_OperationWithBinaryOutput},
  {Py_tp_clear, (void *)__pyx_tp_clear_6pkcs11_7_pkcs11_OperationWithBinaryOutput},
  {Py_tp_methods, (void *)__pyx_methods_6pkcs11_7_pkcs11_SignOrVerifyOperation},
  {Py_tp_new, (void *)__pyx_tp_new_6pkcs11_7_pkcs11_SignOrVerifyOperation},
  {0, 0},
};
static PyType_Spec __pyx_type_6pkcs11_7_pkcs11_SignOrVerifyOperation_spec = {
  "pkcs11._pkcs11.SignOrVerifyOperation",
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11_SignOrVerifyOperation),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6pkcs11_7_pkcs11_SignOrVerifyOperation_slots,
};
#else

static PyTypeObject __pyx_type_6pkcs11_7_pkcs11_SignOrVerifyOperation = {
  PyVarObject_HEAD_INIT(0, 0)
  "pkcs11._pkcs11.""SignOrVerifyOperation", /*tp_name*/
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11_SignOrVerifyOperation), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pkcs11_7_pkcs11_OperationWithBinaryOutput, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6pkcs11_7_pkcs11_OperationWithBinaryOutput, /*tp_traverse*/
  __pyx_tp_clear_6pkcs11_7_pkcs11_OperationWithBinaryOutput, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pkcs11_7_pkcs11_SignOrVerifyOperation, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_6pkcs11_7_pkcs11_16OperationContext_3__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_6pkcs11_7_pkcs11_SignOrVerifyOperation, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DataSignOperation __pyx_vtable_6pkcs11_7_pkcs11_DataSignOperation;

static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11_DataSignOperation(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pkcs11_7_pkcs11_DataSignOperation *p;
  PyObject *o = __pyx_tp_new_6pkcs11_7_pkcs11_SignOrVerifyOperation(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6pkcs11_7_pkcs11_DataSignOperation *)o);
  p->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6pkcs11_7_pkcs11_OperationContext*)__pyx_vtabptr_6pkcs11_7_pkcs11_DataSignOperation;
  return o;
}

static PyMethodDef __pyx_methods_6pkcs11_7_pkcs11_DataSignOperation[] = {
  {"unclean_shutdown", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_17DataSignOperation_1unclean_shutdown, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_17DataSignOperation_3__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_17DataSignOperation_5__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6pkcs11_7_pkcs11_DataSignOperation_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6pkcs11_7_pkcs11_OperationWithBinaryOutput},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6pkcs11_7_pkcs11_OperationWithBinaryOutput},
  {Py_tp_clear, (void *)__pyx_tp_clear_6pkcs11_7_pkcs11_OperationWithBinaryOutput},
  {Py_tp_methods, (void *)__pyx_methods_6pkcs11_7_pkcs11_DataSignOperation},
  {Py_tp_new, (void *)__pyx_tp_new_6pkcs11_7_pkcs11_DataSignOperation},
  {0, 0},
};
static PyType_Spec __pyx_type_6pkcs11_7_pkcs11_DataSignOperation_spec = {
  "pkcs11._pkcs11.DataSignOperation",
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11_DataSignOperation),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6pkcs11_7_pkcs11_DataSignOperation_slots,
};
#else

static PyTypeObject __pyx_type_6pkcs11_7_pkcs11_DataSignOperation = {
  PyVarObject_HEAD_INIT(0, 0)
  "pkcs11._pkcs11.""DataSignOperation", /*tp_name*/
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11_DataSignOperation), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pkcs11_7_pkcs11_OperationWithBinaryOutput, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6pkcs11_7_pkcs11_OperationWithBinaryOutput, /*tp_traverse*/
  __pyx_tp_clear_6pkcs11_7_pkcs11_OperationWithBinaryOutput, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pkcs11_7_pkcs11_DataSignOperation, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_6pkcs11_7_pkcs11_16OperationContext_3__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_6pkcs11_7_pkcs11_DataSignOperation, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6pkcs11_7_pkcs11_DataVerifyOperation __pyx_vtable_6pkcs11_7_pkcs11_DataVerifyOperation;

static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11_DataVerifyOperation(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pkcs11_7_pkcs11_DataVerifyOperation *p;
  PyObject *o = __pyx_tp_new_6pkcs11_7_pkcs11_SignOrVerifyOperation(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6pkcs11_7_pkcs11_DataVerifyOperation *)o);
  p->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6pkcs11_7_pkcs11_OperationContext*)__pyx_vtabptr_6pkcs11_7_pkcs11_DataVerifyOperation;
  return o;
}

static PyMethodDef __pyx_methods_6pkcs11_7_pkcs11_DataVerifyOperation[] = {
  {"unclean_shutdown", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_19DataVerifyOperation_1unclean_shutdown, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_19DataVerifyOperation_3__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6pkcs11_7_pkcs11_19DataVerifyOperation_5__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6pkcs11_7_pkcs11_DataVerifyOperation_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6pkcs11_7_pkcs11_OperationWithBinaryOutput},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6pkcs11_7_pkcs11_OperationWithBinaryOutput},
  {Py_tp_clear, (void *)__pyx_tp_clear_6pkcs11_7_pkcs11_OperationWithBinaryOutput},
  {Py_tp_methods, (void *)__pyx_methods_6pkcs11_7_pkcs11_DataVerifyOperation},
  {Py_tp_new, (void *)__pyx_tp_new_6pkcs11_7_pkcs11_DataVerifyOperation},
  {0, 0},
};
static PyType_Spec __pyx_type_6pkcs11_7_pkcs11_DataVerifyOperation_spec = {
  "pkcs11._pkcs11.DataVerifyOperation",
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11_DataVerifyOperation),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6pkcs11_7_pkcs11_DataVerifyOperation_slots,
};
#else

static PyTypeObject __pyx_type_6pkcs11_7_pkcs11_DataVerifyOperation = {
  PyVarObject_HEAD_INIT(0, 0)
  "pkcs11._pkcs11.""DataVerifyOperation", /*tp_name*/
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11_DataVerifyOperation), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pkcs11_7_pkcs11_OperationWithBinaryOutput, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6pkcs11_7_pkcs11_OperationWithBinaryOutput, /*tp_traverse*/
  __pyx_tp_clear_6pkcs11_7_pkcs11_OperationWithBinaryOutput, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pkcs11_7_pkcs11_DataVerifyOperation, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_6pkcs11_7_pkcs11_16OperationContext_3__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_6pkcs11_7_pkcs11_DataVerifyOperation, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter, sizeof(struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter[--__pyx_mstate_global->__pyx_freecount_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter(PyObject *o) {
  struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter *p = (struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_count);
  Py_CLEAR(p->__pyx_v_ix);
  Py_CLEAR(p->__pyx_v_results);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_t_0);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter, sizeof(struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter))))
  {
    __pyx_mstate_global->__pyx_freelist_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter[__pyx_mstate_global->__pyx_freecount_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter++] = ((struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter *p = (struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_count) {
    e = (*v)(p->__pyx_v_count, a); if (e) return e;
  }
  if (p->__pyx_v_ix) {
    e = (*v)(p->__pyx_v_ix, a); if (e) return e;
  }
  if (p->__pyx_v_results) {
    e = (*v)(p->__pyx_v_results, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter},
  {Py_tp_new, (void *)__pyx_tp_new_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter},
  {0, 0},
};
static PyType_Spec __pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter_spec = {
  "pkcs11._pkcs11.__pyx_scope_struct___batch_iter",
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter_slots,
};
#else

static PyTypeObject __pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter = {
  PyVarObject_HEAD_INIT(0, 0)
  "pkcs11._pkcs11.""__pyx_scope_struct___batch_iter", /*tp_name*/
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects, sizeof(struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects[--__pyx_mstate_global->__pyx_freecount_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects(PyObject *o) {
  struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects *p = (struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_attrs);
  Py_CLEAR(p->__pyx_v_batch);
  Py_CLEAR(p->__pyx_v_batch_size);
  Py_CLEAR(p->__pyx_v_op);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_t_0);
  Py_CLEAR(p->__pyx_t_1);
  Py_CLEAR(p->__pyx_t_2);
  Py_CLEAR(p->__pyx_t_3);
  Py_CLEAR(p->__pyx_t_4);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects, sizeof(struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects))))
  {
    __pyx_mstate_global->__pyx_freelist_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects[__pyx_mstate_global->__pyx_freecount_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects++] = ((struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects *p = (struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_attrs) {
    e = (*v)(p->__pyx_v_attrs, a); if (e) return e;
  }
  if (p->__pyx_v_batch) {
    e = (*v)(p->__pyx_v_batch, a); if (e) return e;
  }
  if (p->__pyx_v_batch_size) {
    e = (*v)(p->__pyx_v_batch_size, a); if (e) return e;
  }
  if (p->__pyx_v_op) {
    e = (*v)(p->__pyx_v_op, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  if (p->__pyx_t_1) {
    e = (*v)(p->__pyx_t_1, a); if (e) return e;
  }
  if (p->__pyx_t_2) {
    e = (*v)(p->__pyx_t_2, a); if (e) return e;
  }
  if (p->__pyx_t_3) {
    e = (*v)(p->__pyx_t_3, a); if (e) return e;
  }
  if (p->__pyx_t_4) {
    e = (*v)(p->__pyx_t_4, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects},
  {Py_tp_new, (void *)__pyx_tp_new_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects},
  {0, 0},
};
static PyType_Spec __pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects_spec = {
  "pkcs11._pkcs11.__pyx_scope_struct_1_get_objects",
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects_slots,
};
#else

static PyTypeObject __pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects = {
  PyVarObject_HEAD_INIT(0, 0)
  "pkcs11._pkcs11.""__pyx_scope_struct_1_get_objects", /*tp_name*/
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks, sizeof(struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks[--__pyx_mstate_global->__pyx_freecount_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks(PyObject *o) {
  struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks *p = (struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_chunk);
  Py_CLEAR(p->__pyx_v_chunks);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_t_0);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks, sizeof(struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks))))
  {
    __pyx_mstate_global->__pyx_freelist_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks[__pyx_mstate_global->__pyx_freecount_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks++] = ((struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks *p = (struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_chunk) {
    e = (*v)(p->__pyx_v_chunk, a); if (e) return e;
  }
  if (p->__pyx_v_chunks) {
    e = (*v)(p->__pyx_v_chunks, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks},
  {Py_tp_new, (void *)__pyx_tp_new_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks},
  {0, 0},
};
static PyType_Spec __pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks_spec = {
  "pkcs11._pkcs11.__pyx_scope_struct_2_update_chunks",
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks_slots,
};
#else

static PyTypeObject __pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks = {
  PyVarObject_HEAD_INIT(0, 0)
  "pkcs11._pkcs11.""__pyx_scope_struct_2_update_chunks", /*tp_name*/
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator, sizeof(struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator[--__pyx_mstate_global->__pyx_freecount_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator(PyObject *o) {
  struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator *p = (struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_buffer_size);
  Py_CLEAR(p->__pyx_v_data);
  Py_CLEAR(p->__pyx_v_mechanism);
  Py_CLEAR(p->__pyx_v_mechanism_param);
  Py_CLEAR(p->__pyx_v_op);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_t_0);
  Py_CLEAR(p->__pyx_t_1);
  Py_CLEAR(p->__pyx_t_2);
  Py_CLEAR(p->__pyx_t_3);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator, sizeof(struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator))))
  {
    __pyx_mstate_global->__pyx_freelist_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator[__pyx_mstate_global->__pyx_freecount_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator++] = ((struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator *p = (struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_buffer_size) {
    e = (*v)(p->__pyx_v_buffer_size, a); if (e) return e;
  }
  if (p->__pyx_v_data) {
    e = (*v)(p->__pyx_v_data, a); if (e) return e;
  }
  if (p->__pyx_v_mechanism) {
    e = (*v)(p->__pyx_v_mechanism, a); if (e) return e;
  }
  if (p->__pyx_v_mechanism_param) {
    e = (*v)(p->__pyx_v_mechanism_param, a); if (e) return e;
  }
  if (p->__pyx_v_op) {
    e = (*v)(((PyObject *)p->__pyx_v_op), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(p->__pyx_v_self, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  if (p->__pyx_t_1) {
    e = (*v)(p->__pyx_t_1, a); if (e) return e;
  }
  if (p->__pyx_t_2) {
    e = (*v)(p->__pyx_t_2, a); if (e) return e;
  }
  if (p->__pyx_t_3) {
    e = (*v)(p->__pyx_t_3, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator},
  {Py_tp_new, (void *)__pyx_tp_new_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator},
  {0, 0},
};
static PyType_Spec __pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator_spec = {
  "pkcs11._pkcs11.__pyx_scope_struct_3__encrypt_generator",
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator_slots,
};
#else

static PyTypeObject __pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator = {
  PyVarObject_HEAD_INIT(0, 0)
  "pkcs11._pkcs11.""__pyx_scope_struct_3__encrypt_generator", /*tp_name*/
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator, sizeof(struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator[--__pyx_mstate_global->__pyx_freecount_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator(PyObject *o) {
  struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator *p = (struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_buffer_size);
  Py_CLEAR(p->__pyx_v_data);
  Py_CLEAR(p->__pyx_v_mechanism);
  Py_CLEAR(p->__pyx_v_mechanism_param);
  Py_CLEAR(p->__pyx_v_op);
  Py_CLEAR(p->__pyx_v_pin);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_session);
  Py_CLEAR(p->__pyx_t_0);
  Py_CLEAR(p->__pyx_t_1);
  Py_CLEAR(p->__pyx_t_2);
  Py_CLEAR(p->__pyx_t_3);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator, sizeof(struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator))))
  {
    __pyx_mstate_global->__pyx_freelist_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator[__pyx_mstate_global->__pyx_freecount_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator++] = ((struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator *p = (struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_buffer_size) {
    e = (*v)(p->__pyx_v_buffer_size, a); if (e) return e;
  }
  if (p->__pyx_v_data) {
    e = (*v)(p->__pyx_v_data, a); if (e) return e;
  }
  if (p->__pyx_v_mechanism) {
    e = (*v)(p->__pyx_v_mechanism, a); if (e) return e;
  }
  if (p->__pyx_v_mechanism_param) {
    e = (*v)(p->__pyx_v_mechanism_param, a); if (e) return e;
  }
  if (p->__pyx_v_op) {
    e = (*v)(((PyObject *)p->__pyx_v_op), a); if (e) return e;
  }
  if (p->__pyx_v_pin) {
    e = (*v)(p->__pyx_v_pin, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(p->__pyx_v_self, a); if (e) return e;
  }
  if (p->__pyx_v_session) {
    e = (*v)(((PyObject *)p->__pyx_v_session), a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  if (p->__pyx_t_1) {
    e = (*v)(p->__pyx_t_1, a); if (e) return e;
  }
  if (p->__pyx_t_2) {
    e = (*v)(p->__pyx_t_2, a); if (e) return e;
  }
  if (p->__pyx_t_3) {
    e = (*v)(p->__pyx_t_3, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator},
  {Py_tp_new, (void *)__pyx_tp_new_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator},
  {0, 0},
};
static PyType_Spec __pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator_spec = {
  "pkcs11._pkcs11.__pyx_scope_struct_4__decrypt_generator",
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator_slots,
};
#else

static PyTypeObject __pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator = {
  PyVarObject_HEAD_INIT(0, 0)
  "pkcs11._pkcs11.""__pyx_scope_struct_4__decrypt_generator", /*tp_name*/
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens, sizeof(struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens[--__pyx_mstate_global->__pyx_freecount_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens(PyObject *o) {
  struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens *p = (struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_mechanisms);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_slot);
  Py_CLEAR(p->__pyx_v_slot_flags);
  Py_CLEAR(p->__pyx_v_token);
  Py_CLEAR(p->__pyx_v_token_flags);
  Py_CLEAR(p->__pyx_v_token_label);
  Py_CLEAR(p->__pyx_v_token_mechanisms);
  Py_CLEAR(p->__pyx_v_token_serial);
  Py_CLEAR(p->__pyx_t_0);
  Py_CLEAR(p->__pyx_t_3);
  Py_CLEAR(p->__pyx_t_4);
  Py_CLEAR(p->__pyx_t_5);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens, sizeof(struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens))))
  {
    __pyx_mstate_global->__pyx_freelist_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens[__pyx_mstate_global->__pyx_freecount_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens++] = ((struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens *p = (struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_mechanisms) {
    e = (*v)(p->__pyx_v_mechanisms, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_v_slot) {
    e = (*v)(p->__pyx_v_slot, a); if (e) return e;
  }
  if (p->__pyx_v_slot_flags) {
    e = (*v)(p->__pyx_v_slot_flags, a); if (e) return e;
  }
  if (p->__pyx_v_token) {
    e = (*v)(p->__pyx_v_token, a); if (e) return e;
  }
  if (p->__pyx_v_token_flags) {
    e = (*v)(p->__pyx_v_token_flags, a); if (e) return e;
  }
  if (p->__pyx_v_token_label) {
    e = (*v)(p->__pyx_v_token_label, a); if (e) return e;
  }
  if (p->__pyx_v_token_mechanisms) {
    e = (*v)(p->__pyx_v_token_mechanisms, a); if (e) return e;
  }
  if (p->__pyx_v_token_serial) {
    e = (*v)(p->__pyx_v_token_serial, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  if (p->__pyx_t_3) {
    e = (*v)(p->__pyx_t_3, a); if (e) return e;
  }
  if (p->__pyx_t_4) {
    e = (*v)(p->__pyx_t_4, a); if (e) return e;
  }
  if (p->__pyx_t_5) {
    e = (*v)(p->__pyx_t_5, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens},
  {Py_tp_new, (void *)__pyx_tp_new_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens},
  {0, 0},
};
static PyType_Spec __pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens_spec = {
  "pkcs11._pkcs11.__pyx_scope_struct_5_get_tokens",
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens_slots,
};
#else

static PyTypeObject __pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens = {
  PyVarObject_HEAD_INIT(0, 0)
  "pkcs11._pkcs11.""__pyx_scope_struct_5_get_tokens", /*tp_name*/
  sizeof(struct __pyx_obj_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_array __pyx_vtable_array;

static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_array_obj *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_array_obj *)o);
  p->__pyx_vtab = __pyx_vtabptr_array;
  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_array(PyObject *o) {
  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_array) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_DeallocKeepAliveBegin(o);
    __pyx_array___dealloc__(o);
    __Pyx_DeallocKeepAliveEnd(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->mode);
  Py_CLEAR(p->_format);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0;
  #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000)
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  #else
  r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x);
  #endif
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_array___setitem__(o, i, v);
  }
  else {
    __Pyx_TypeName o_type_name;
    o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o));
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name);
    __Pyx_DECREF_TypeName(o_type_name);
    return -1;
  }
}

static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
  PyObject *v = PyObject_GenericGetAttr(o, n);
  if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
    PyErr_Clear();
    v = __pyx_array___getattr__(o, n);
  }
  return v;
}

static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
}

static PyMethodDef __pyx_methods_array[] = {
  {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_array[] = {
  {"memview", __pyx_getprop___pyx_array_memview, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
#if !CYTHON_COMPILING_IN_LIMITED_API

static PyBufferProcs __pyx_tp_as_buffer_array = {
  __pyx_array_getbuffer, /*bf_getbuffer*/
  0, /*bf_releasebuffer*/
};
#endif
static PyType_Slot __pyx_type___pyx_array_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_array},
  {Py_sq_length, (void *)__pyx_array___len__},
  {Py_sq_item, (void *)__pyx_sq_item_array},
  {Py_mp_length, (void *)__pyx_array___len__},
  {Py_mp_subscript, (void *)__pyx_array___getitem__},
  {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_array},
  {Py_tp_getattro, (void *)__pyx_tp_getattro_array},
  #if defined(Py_bf_getbuffer)
  {Py_bf_getbuffer, (void *)__pyx_array_getbuffer},
  #endif
  {Py_tp_methods, (void *)__pyx_methods_array},
  {Py_tp_getset, (void *)__pyx_getsets_array},
  {Py_tp_new, (void *)__pyx_tp_new_array},
  {0, 0},
};
static PyType_Spec __pyx_type___pyx_array_spec = {
  "pkcs11._pkcs11.array",
  sizeof(struct __pyx_array_obj),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE,
  __pyx_type___pyx_array_slots,
};
#else

static PySequenceMethods __pyx_tp_as_sequence_array = {
  __pyx_array___len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_array, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_array = {
  __pyx_array___len__, /*mp_length*/
  __pyx_array___getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_array = {
  __pyx_array_getbuffer, /*bf_getbuffer*/
  0, /*bf_releasebuffer*/
};

static PyTypeObject __pyx_type___pyx_array = {
  PyVarObject_HEAD_INIT(0, 0)
  "pkcs11._pkcs11.""array", /*tp_name*/
  sizeof(struct __pyx_array_obj), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_array, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  __pyx_tp_getattro_array, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_array, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_array, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_array, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_MemviewEnum_obj *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_MemviewEnum_obj *)o);
  p->name = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_Enum(PyObject *o) {
  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_Enum) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->name);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->name) {
    e = (*v)(p->name, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_Enum(PyObject *o) {
  PyObject* tmp;
  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
  tmp = ((PyObject*)p->name);
  p->name = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_Enum[] = {
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type___pyx_MemviewEnum_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_Enum},
  {Py_tp_repr, (void *)__pyx_MemviewEnum___repr__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_Enum},
  {Py_tp_clear, (void *)__pyx_tp_clear_Enum},
  {Py_tp_methods, (void *)__pyx_methods_Enum},
  {Py_tp_init, (void *)__pyx_MemviewEnum___init__},
  {Py_tp_new, (void *)__pyx_tp_new_Enum},
  {0, 0},
};
static PyType_Spec __pyx_type___pyx_MemviewEnum_spec = {
  "pkcs11._pkcs11.Enum",
  sizeof(struct __pyx_MemviewEnum_obj),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type___pyx_MemviewEnum_slots,
};
#else

static PyTypeObject __pyx_type___pyx_MemviewEnum = {
  PyVarObject_HEAD_INIT(0, 0)
  "pkcs11._pkcs11.""Enum", /*tp_name*/
  sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_Enum, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_MemviewEnum___repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_Enum, /*tp_traverse*/
  __pyx_tp_clear_Enum, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_Enum, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_MemviewEnum___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_Enum, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;

static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_memoryview_obj *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_memoryview_obj *)o);
  p->__pyx_vtab = __pyx_vtabptr_memoryview;
  p->obj = Py_None; Py_INCREF(Py_None);
  p->_size = Py_None; Py_INCREF(Py_None);
  p->view.obj = NULL;
  if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_memoryview(PyObject *o) {
  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_memoryview) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_DeallocKeepAliveBegin(o);
    __pyx_memoryview___dealloc__(o);
    __Pyx_DeallocKeepAliveEnd(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->obj);
  Py_CLEAR(p->_size);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->obj) {
    e = (*v)(p->obj, a); if (e) return e;
  }
  if (p->_size) {
    e = (*v)(p->_size, a); if (e) return e;
  }
  if (p->view.obj) {
    e = (*v)(p->view.obj, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_memoryview(PyObject *o) {
  PyObject* tmp;
  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
  tmp = ((PyObject*)p->obj);
  p->obj = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_size);
  p->_size = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  Py_CLEAR(p->view.obj);
  return 0;
}

static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0;
  #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000)
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  #else
  r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x);
  #endif
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_memoryview___setitem__(o, i, v);
  }
  else {
    __Pyx_TypeName o_type_name;
    o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o));
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name);
    __Pyx_DECREF_TypeName(o_type_name);
    return -1;
  }
}

static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
}

static PyMethodDef __pyx_methods_memoryview[] = {
  {"is_c_contig", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_c_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"is_f_contig", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_f_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"copy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"copy_fortran", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy_fortran, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_memoryview[] = {
  {"T", __pyx_getprop___pyx_memoryview_T, 0, 0, 0},
  {"base", __pyx_getprop___pyx_memoryview_base, 0, 0, 0},
  {"shape", __pyx_getprop___pyx_memoryview_shape, 0, 0, 0},
  {"strides", __pyx_getprop___pyx_memoryview_strides, 0, 0, 0},
  {"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, 0, 0},
  {"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, 0, 0},
  {"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, 0, 0},
  {"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, 0, 0},
  {"size", __pyx_getprop___pyx_memoryview_size, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
#if !CYTHON_COMPILING_IN_LIMITED_API

static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
  0, /*bf_releasebuffer*/
};
#endif
static PyType_Slot __pyx_type___pyx_memoryview_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_memoryview},
  {Py_tp_repr, (void *)__pyx_memoryview___repr__},
  {Py_sq_length, (void *)__pyx_memoryview___len__},
  {Py_sq_item, (void *)__pyx_sq_item_memoryview},
  {Py_mp_length, (void *)__pyx_memoryview___len__},
  {Py_mp_subscript, (void *)__pyx_memoryview___getitem__},
  {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_memoryview},
  {Py_tp_str, (void *)__pyx_memoryview___str__},
  #if defined(Py_bf_getbuffer)
  {Py_bf_getbuffer, (void *)__pyx_memoryview_getbuffer},
  #endif
  {Py_tp_traverse, (void *)__pyx_tp_traverse_memoryview},
  {Py_tp_clear, (void *)__pyx_tp_clear_memoryview},
  {Py_tp_methods, (void *)__pyx_methods_memoryview},
  {Py_tp_getset, (void *)__pyx_getsets_memoryview},
  {Py_tp_new, (void *)__pyx_tp_new_memoryview},
  {0, 0},
};
static PyType_Spec __pyx_type___pyx_memoryview_spec = {
  "pkcs11._pkcs11.memoryview",
  sizeof(struct __pyx_memoryview_obj),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type___pyx_memoryview_slots,
};
#else

static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
  __pyx_memoryview___len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_memoryview, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
  __pyx_memoryview___len__, /*mp_length*/
  __pyx_memoryview___getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
  0, /*bf_releasebuffer*/
};

static PyTypeObject __pyx_type___pyx_memoryview = {
  PyVarObject_HEAD_INIT(0, 0)
  "pkcs11._pkcs11.""memoryview", /*tp_name*/
  sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_memoryview___repr__, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_memoryview___str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_memoryview, /*tp_traverse*/
  __pyx_tp_clear_memoryview, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_memoryview, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_memoryview, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_memoryview, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;

static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_memoryviewslice_obj *p;
  PyObject *o = __pyx_tp_new_memoryview(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_memoryviewslice_obj *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
  p->from_object = Py_None; Py_INCREF(Py_None);
  p->from_slice.memview = NULL;
  return o;
}

static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc__memoryviewslice) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_DeallocKeepAliveBegin(o);
    __pyx_memoryviewslice___dealloc__(o);
    __Pyx_DeallocKeepAliveEnd(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->from_object);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_memoryview(o);
}

static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
  e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e;
  if (p->from_object) {
    e = (*v)(p->from_object, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
  PyObject* tmp;
  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
  __pyx_tp_clear_memoryview(o);
  tmp = ((PyObject*)p->from_object);
  p->from_object = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  __PYX_XCLEAR_MEMVIEW(&p->from_slice, 1);
  return 0;
}

static PyMethodDef __pyx_methods__memoryviewslice[] = {
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type___pyx_memoryviewslice_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc__memoryviewslice},
  {Py_tp_doc, (void *)PyDoc_STR("Internal class for passing memoryview slices to Python")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse__memoryviewslice},
  {Py_tp_clear, (void *)__pyx_tp_clear__memoryviewslice},
  {Py_tp_methods, (void *)__pyx_methods__memoryviewslice},
  {Py_tp_new, (void *)__pyx_tp_new__memoryviewslice},
  {0, 0},
};
static PyType_Spec __pyx_type___pyx_memoryviewslice_spec = {
  "pkcs11._pkcs11._memoryviewslice",
  sizeof(struct __pyx_memoryviewslice_obj),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_SEQUENCE,
  __pyx_type___pyx_memoryviewslice_slots,
};
#else

static PyTypeObject __pyx_type___pyx_memoryviewslice = {
  PyVarObject_HEAD_INIT(0, 0)
  "pkcs11._pkcs11.""_memoryviewslice", /*tp_name*/
  sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_memoryview___repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_memoryview___str__, /*tp_str*/
  #else
  0, /*tp_str*/
  #endif
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_SEQUENCE, /*tp_flags*/
  PyDoc_STR("Internal class for passing memoryview slices to Python"), /*tp_doc*/
  __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
  __pyx_tp_clear__memoryviewslice, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods__memoryviewslice, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new__memoryviewslice, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

static int __pyx_import_star_set(__pyx_mstatetype *__pyx_mstate,PyObject *o, PyObject* py_name, const char *name) {
  static const char* internal_type_names[] = {
    "AttributeList",
    "CK_AES_CBC_ENCRYPT_DATA_PARAMS",
    "CK_AES_CTR_PARAMS",
    "CK_ATTRIBUTE",
    "CK_ATTRIBUTE_TYPE",
    "CK_BBOOL",
    "CK_BYTE",
    "CK_CHAR",
    "CK_ECDH1_DERIVE_PARAMS",
    "CK_EC_KDF_TYPE",
    "CK_EDDSA_PARAMS",
    "CK_FLAGS",
    "CK_FUNCTION_LIST",
    "CK_GCM_PARAMS",
    "CK_INFO",
    "CK_KEY_DERIVATION_STRING_DATA",
    "CK_MECHANISM",
    "CK_MECHANISM_INFO",
    "CK_MECHANISM_TYPE",
    "CK_OBJECT_HANDLE",
    "CK_RSA_PKCS_MGF_TYPE",
    "CK_RSA_PKCS_OAEP_PARAMS",
    "CK_RSA_PKCS_OAEP_SOURCE_TYPE",
    "CK_RSA_PKCS_PSS_PARAMS",
    "CK_RV",
    "CK_SESSION_HANDLE",
    "CK_SESSION_INFO",
    "CK_SLOT_ID",
    "CK_SLOT_INFO",
    "CK_STATE",
    "CK_TOKEN_INFO",
    "CK_ULONG",
    "CK_USER_TYPE",
    "CK_UTF8CHAR",
    "CK_VERSION",
    "C_GetFunctionList_ptr",
    "DataCryptOperation",
    "DataSignOperation",
    "DataVerifyOperation",
    "DigestOperation",
    "Enum",
    "HasFuncList",
    "KeyOperation",
    "KeyOperationInit",
    "MechanismWithParam",
    "ObjectHandleWrapper",
    "OperationContext",
    "OperationUpdate",
    "OperationUpdateWithResult",
    "OperationWithBinaryOutput",
    "OperationWithResult",
    "P11_HANDLE",
    "PyObject",
    "PyThread_type_lock",
    "Py_intptr_t",
    "SearchIter",
    "Session",
    "SignOrVerifyOperation",
    "Slot",
    "Token",
    "__Pyx_TypeInfo",
    "__Pyx_memviewslice",
    "__pyx_atomic_int_type",
    "__pyx_buffer",
    "__pyx_ctuple_6pkcs11_7_pkcs11_CK_FLAGS",
    "__pyx_ctuple_6pkcs11_7_pkcs11_CK_FLAGS_struct",
    "__pyx_ctuple_6pkcs11_7_pkcs11_CK_ULONG",
    "__pyx_ctuple_6pkcs11_7_pkcs11_CK_ULONG_struct",
    "__pyx_ctuple_6pkcs11_7_pkcs11_CK_USER_TYPE",
    "__pyx_ctuple_6pkcs11_7_pkcs11_CK_USER_TYPE_struct",
    "__pyx_ctuple_6pkcs11_7_pkcs11_CK_VERSION",
    "__pyx_ctuple_6pkcs11_7_pkcs11_CK_VERSION_struct",
    "__pyx_ctuple_Py_ssize_t",
    "__pyx_ctuple_Py_ssize_t_struct",
    "__pyx_ctuple_char__ptr",
    "__pyx_ctuple_char__ptr_struct",
    "__pyx_ctuple_int",
    "__pyx_ctuple_int_struct",
    "__pyx_ctuple_long",
    "__pyx_ctuple_long__and_long__and_long",
    "__pyx_ctuple_long__and_long__and_long_struct",
    "__pyx_ctuple_long_struct",
    "__pyx_memoryview",
    "__pyx_scope_struct_1_get_objects",
    "__pyx_scope_struct_2_update_chunks",
    "__pyx_scope_struct_3__encrypt_generator",
    "__pyx_scope_struct_4__decrypt_generator",
    "__pyx_scope_struct_5_get_tokens",
    "__pyx_scope_struct___batch_iter",
    "_memoryviewslice",
    "array",
    "base_type",
    "lib",
    "memoryview",
    0
  };
  const char** type_name = internal_type_names;
  while (*type_name) {
    if (__Pyx_StrEq(name, *type_name)) {
      PyErr_Format(PyExc_TypeError, "Cannot overwrite C type %s", name);
      goto bad;
    }
    type_name++;
  }
  if (0);
  else if (__Pyx_StrEq(name, "PyExc_ValueError")) {
    PyErr_Format(PyExc_TypeError, "Cannot convert Python object PyExc_ValueError to PyObject *");
    __PYX_ERR(1, 17, __pyx_L2_error)
  }
  else if (__Pyx_StrEq(name, "Py_None")) {
    PyErr_Format(PyExc_TypeError, "Cannot convert Python object Py_None to PyObject *");
    __PYX_ERR(1, 62, __pyx_L2_error)
  }
  else if (__Pyx_StrEq(name, "__pyx_collections_abc_Sequence")) {
    Py_INCREF(o);
    Py_DECREF(__pyx_collections_abc_Sequence);
    __pyx_collections_abc_Sequence = o;
  }
  else if (__Pyx_StrEq(name, "__pyx_memoryview_thread_locks")) {
    PyErr_Format(PyExc_TypeError, "Cannot convert Python object __pyx_memoryview_thread_locks to PyThread_type_lock [8]");
    __PYX_ERR(1, 330, __pyx_L2_error)
  }
  else if (__Pyx_StrEq(name, "__pyx_memoryview_thread_locks_used")) {
    __pyx_memoryview_thread_locks_used = __Pyx_PyLong_As_int(o); if (unlikely((__pyx_memoryview_thread_locks_used == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 329, __pyx_L2_error)
  }
  else if (__Pyx_StrEq(name, "contiguous")) {
    Py_INCREF(o);
    Py_DECREF(contiguous);
    contiguous = o;
  }
  else if (__Pyx_StrEq(name, "generic")) {
    Py_INCREF(o);
    Py_DECREF(generic);
    generic = o;
  }
  else if (__Pyx_StrEq(name, "indirect")) {
    Py_INCREF(o);
    Py_DECREF(indirect);
    indirect = o;
  }
  else if (__Pyx_StrEq(name, "indirect_contiguous")) {
    Py_INCREF(o);
    Py_DECREF(indirect_contiguous);
    indirect_contiguous = o;
  }
  else if (__Pyx_StrEq(name, "strided")) {
    Py_INCREF(o);
    Py_DECREF(strided);
    strided = o;
  }
  else {
    if (PyObject_SetAttr(__pyx_m, py_name, o) < 0) goto bad;
  }
  return 0;
  __pyx_L2_error:;
  __Pyx_AddTraceback("pkcs11._pkcs11", __pyx_clineno, __pyx_lineno, __pyx_filename);
  bad:
  return -1;
}

/* ImportStar */
static int
__Pyx_import_all_from(PyObject *locals, PyObject *v)
{
    PyObject *all = PyObject_GetAttrString(v, "__all__");
    PyObject *dict, *name, *value;
    int skip_leading_underscores = 0;
    int pos, err;
    if (all == NULL) {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError))
            return -1;
        PyErr_Clear();
        dict = PyObject_GetAttrString(v, "__dict__");
        if (dict == NULL) {
            if (!PyErr_ExceptionMatches(PyExc_AttributeError))
                return -1;
            PyErr_SetString(PyExc_ImportError,
            "from-import-* object has no __dict__ and no __all__");
            return -1;
        }
        all = PyMapping_Keys(dict);
        Py_DECREF(dict);
        if (all == NULL)
            return -1;
        skip_leading_underscores = 1;
    }
    for (pos = 0, err = 0; ; pos++) {
        name = PySequence_GetItem(all, pos);
        if (name == NULL) {
            if (!PyErr_ExceptionMatches(PyExc_IndexError))
                err = -1;
            else
                PyErr_Clear();
            break;
        }
        if (skip_leading_underscores && likely(PyUnicode_Check(name))) {
            Py_ssize_t length = __Pyx_PyUnicode_GET_LENGTH(name);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely(length < 0)) {
                Py_DECREF(name);
                return -1;
            }
            #endif
            if (likely(length) && __Pyx_PyUnicode_READ_CHAR(name, 0) == '_') {
                Py_DECREF(name);
                continue;
            }
        }
        value = PyObject_GetAttr(v, name);
        if (value == NULL)
            err = -1;
        else if (PyDict_CheckExact(locals))
            err = PyDict_SetItem(locals, name, value);
        else
            err = PyObject_SetItem(locals, name, value);
        Py_DECREF(name);
        Py_XDECREF(value);
        if (err != 0)
            break;
    }
    Py_DECREF(all);
    return err;
}
static int __pyx_import_star(PyObject* m) {
    int i;
    int ret = -1;
    const char* s;
    PyObject *locals = 0;
    PyObject *list = 0;
    PyObject *utf8_name = 0;
    PyObject *name;
    PyObject *item;
    PyObject *import_obj;
    Py_ssize_t size;
    __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(m);
    locals = PyDict_New();              if (!locals) goto bad;
    if (__Pyx_import_all_from(locals, m) < 0) goto bad;
    list = PyDict_Items(locals);        if (!list) goto bad;
    size = __Pyx_PyList_GET_SIZE(list);
    #if !CYTHON_ASSUME_SAFE_SIZE
    if (size < 0) goto bad;
    #endif
    for(i=0; i<size; i++) {
        import_obj = __Pyx_PyList_GET_ITEM(list, i); if (!import_obj) goto bad;
        name = __Pyx_PyTuple_GET_ITEM(import_obj, 0); if (!name) goto bad;
        item = __Pyx_PyTuple_GET_ITEM(import_obj, 1); if (!item) goto bad;
        utf8_name = PyUnicode_AsUTF8String(name);
        if (!utf8_name) goto bad;
        s = __Pyx_PyBytes_AsString(utf8_name); if (!s) goto bad;
        if (__pyx_import_star_set(mstate, item, name, s) < 0) goto bad;
        Py_DECREF(utf8_name); utf8_name = 0;
    }
    ret = 0;
bad:
    Py_XDECREF(locals);
    Py_XDECREF(list);
    Py_XDECREF(utf8_name);
    return ret;
}

/* #### Code section: initfunc_declarations ### */
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __pyx_import_star_set(__pyx_mstatetype *__pyx_mstate,PyObject *o, PyObject* py_name, const char *name); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate); /*proto*/
/* #### Code section: init_module ### */

static int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  /*--- Global init code ---*/
  __pyx_collections_abc_Sequence = Py_None; Py_INCREF(Py_None);
  generic = Py_None; Py_INCREF(Py_None);
  strided = Py_None; Py_INCREF(Py_None);
  indirect = Py_None; Py_INCREF(Py_None);
  contiguous = Py_None; Py_INCREF(Py_None);
  indirect_contiguous = Py_None; Py_INCREF(Py_None);
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6pkcs11_7_pkcs11_HasFuncList_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList)) __PYX_ERR(0, 36, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6pkcs11_7_pkcs11_HasFuncList_spec, __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList) < (0)) __PYX_ERR(0, 36, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList = &__pyx_type_6pkcs11_7_pkcs11_HasFuncList;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList) < (0)) __PYX_ERR(0, 36, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList->tp_dictoffset && __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_HasFuncList, (PyObject *) __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList) < (0)) __PYX_ERR(0, 36, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList) < (0)) __PYX_ERR(0, 36, __pyx_L1_error)
  __pyx_vtabptr_6pkcs11_7_pkcs11_lib = &__pyx_vtable_6pkcs11_7_pkcs11_lib;
  __pyx_vtable_6pkcs11_7_pkcs11_lib._load_pkcs11_lib = (PyObject *(*)(struct __pyx_obj_6pkcs11_7_pkcs11_lib *, PyObject *))__pyx_f_6pkcs11_7_pkcs11_3lib__load_pkcs11_lib;
  __pyx_vtable_6pkcs11_7_pkcs11_lib.initialize = (PyObject *(*)(struct __pyx_obj_6pkcs11_7_pkcs11_lib *, int __pyx_skip_dispatch))__pyx_f_6pkcs11_7_pkcs11_3lib_initialize;
  __pyx_vtable_6pkcs11_7_pkcs11_lib._finalize = (CK_RV (*)(struct __pyx_obj_6pkcs11_7_pkcs11_lib *))__pyx_f_6pkcs11_7_pkcs11_3lib__finalize;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1969, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_lib = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6pkcs11_7_pkcs11_lib_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_lib)) __PYX_ERR(0, 1969, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6pkcs11_7_pkcs11_lib_spec, __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_lib) < (0)) __PYX_ERR(0, 1969, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_lib = &__pyx_type_6pkcs11_7_pkcs11_lib;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_lib->tp_base = __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_lib) < (0)) __PYX_ERR(0, 1969, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_lib);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_lib->tp_dictoffset && __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_lib->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_lib->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_lib, __pyx_vtabptr_6pkcs11_7_pkcs11_lib) < (0)) __PYX_ERR(0, 1969, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_lib) < (0)) __PYX_ERR(0, 1969, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_lib, (PyObject *) __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_lib) < (0)) __PYX_ERR(0, 1969, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_lib) < (0)) __PYX_ERR(0, 1969, __pyx_L1_error)
  __pyx_vtabptr_6pkcs11_7_pkcs11_AttributeList = &__pyx_vtable_6pkcs11_7_pkcs11_AttributeList;
  __pyx_vtable_6pkcs11_7_pkcs11_AttributeList.from_owned_pointer = (struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *(*)(CK_ATTRIBUTE *, CK_ULONG))__pyx_f_6pkcs11_7_pkcs11_13AttributeList_from_owned_pointer;
  __pyx_vtable_6pkcs11_7_pkcs11_AttributeList.from_template = (struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *(*)(PyObject *, PyObject *))__pyx_f_6pkcs11_7_pkcs11_13AttributeList_from_template;
  __pyx_vtable_6pkcs11_7_pkcs11_AttributeList.at_index = (PyObject *(*)(struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *, CK_ULONG, PyObject *))__pyx_f_6pkcs11_7_pkcs11_13AttributeList_at_index;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_AttributeList = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6pkcs11_7_pkcs11_AttributeList_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_AttributeList)) __PYX_ERR(0, 50, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6pkcs11_7_pkcs11_AttributeList_spec, __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_AttributeList) < (0)) __PYX_ERR(0, 50, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_AttributeList = &__pyx_type_6pkcs11_7_pkcs11_AttributeList;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_AttributeList) < (0)) __PYX_ERR(0, 50, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_AttributeList);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_AttributeList->tp_dictoffset && __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_AttributeList->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_AttributeList->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_AttributeList, __pyx_vtabptr_6pkcs11_7_pkcs11_AttributeList) < (0)) __PYX_ERR(0, 50, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_AttributeList) < (0)) __PYX_ERR(0, 50, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_AttributeList, (PyObject *) __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_AttributeList) < (0)) __PYX_ERR(0, 50, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_AttributeList) < (0)) __PYX_ERR(0, 50, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_MechanismWithParam = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6pkcs11_7_pkcs11_MechanismWithParam_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_MechanismWithParam)) __PYX_ERR(0, 136, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6pkcs11_7_pkcs11_MechanismWithParam_spec, __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_MechanismWithParam) < (0)) __PYX_ERR(0, 136, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_MechanismWithParam = &__pyx_type_6pkcs11_7_pkcs11_MechanismWithParam;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_MechanismWithParam) < (0)) __PYX_ERR(0, 136, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_MechanismWithParam);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_MechanismWithParam->tp_dictoffset && __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_MechanismWithParam->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_MechanismWithParam->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_MechanismWithParam, (PyObject *) __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_MechanismWithParam) < (0)) __PYX_ERR(0, 136, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_MechanismWithParam) < (0)) __PYX_ERR(0, 136, __pyx_L1_error)
  __pyx_vtabptr_6pkcs11_7_pkcs11_Slot = &__pyx_vtable_6pkcs11_7_pkcs11_Slot;
  __pyx_vtable_6pkcs11_7_pkcs11_Slot.make = (struct __pyx_obj_6pkcs11_7_pkcs11_Slot *(*)(struct CK_FUNCTION_LIST *, CK_SLOT_ID, CK_SLOT_INFO, CK_VERSION))__pyx_f_6pkcs11_7_pkcs11_4Slot_make;
  __pyx_vtabptr_6pkcs11_7_pkcs11_Token = &__pyx_vtable_6pkcs11_7_pkcs11_Token;
  __pyx_vtable_6pkcs11_7_pkcs11_Token.make = (struct __pyx_obj_6pkcs11_7_pkcs11_Token *(*)(struct __pyx_obj_6pkcs11_7_pkcs11_Slot *, CK_TOKEN_INFO))__pyx_f_6pkcs11_7_pkcs11_5Token_make;
  __pyx_vtabptr_6pkcs11_7_pkcs11_OperationContext = &__pyx_vtable_6pkcs11_7_pkcs11_OperationContext;
  __pyx_vtable_6pkcs11_7_pkcs11_OperationContext._handle_final_retval = (PyObject *(*)(struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *, CK_RV))__pyx_f_6pkcs11_7_pkcs11_16OperationContext__handle_final_retval;
  __pyx_vtable_6pkcs11_7_pkcs11_OperationContext._operation_aware_assert = (PyObject *(*)(struct __pyx_obj_6pkcs11_7_pkcs11_OperationContext *, CK_RV))__pyx_f_6pkcs11_7_pkcs11_16OperationContext__operation_aware_assert;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_OperationContext = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6pkcs11_7_pkcs11_OperationContext_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_OperationContext)) __PYX_ERR(0, 560, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6pkcs11_7_pkcs11_OperationContext_spec, __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_OperationContext) < (0)) __PYX_ERR(0, 560, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_OperationContext = &__pyx_type_6pkcs11_7_pkcs11_OperationContext;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_OperationContext) < (0)) __PYX_ERR(0, 560, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_OperationContext);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_OperationContext->tp_dictoffset && __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_OperationContext->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_OperationContext->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_OperationContext, __pyx_vtabptr_6pkcs11_7_pkcs11_OperationContext) < (0)) __PYX_ERR(0, 560, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_OperationContext) < (0)) __PYX_ERR(0, 560, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_OperationContext, (PyObject *) __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_OperationContext) < (0)) __PYX_ERR(0, 560, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_OperationContext) < (0)) __PYX_ERR(0, 560, __pyx_L1_error)
  __pyx_vtabptr_6pkcs11_7_pkcs11_OperationWithBinaryOutput = &__pyx_vtable_6pkcs11_7_pkcs11_OperationWithBinaryOutput;
  __pyx_vtable_6pkcs11_7_pkcs11_OperationWithBinaryOutput.__pyx_base = *__pyx_vtabptr_6pkcs11_7_pkcs11_OperationContext;
  __pyx_vtable_6pkcs11_7_pkcs11_OperationWithBinaryOutput._setup = (struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *(*)(PyTypeObject *, struct __pyx_obj_6pkcs11_7_pkcs11_Session *, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *, CK_ULONG))__pyx_f_6pkcs11_7_pkcs11_25OperationWithBinaryOutput__setup;
  __pyx_vtable_6pkcs11_7_pkcs11_OperationWithBinaryOutput.resize_buffer = (PyObject *(*)(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *, CK_ULONG))__pyx_f_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_resize_buffer;
  __pyx_vtable_6pkcs11_7_pkcs11_OperationWithBinaryOutput.current_output = (PyObject *(*)(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *))__pyx_f_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_current_output;
  __pyx_vtable_6pkcs11_7_pkcs11_OperationWithBinaryOutput.update_resizing_output = (CK_RV (*)(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *, __pyx_t_6pkcs11_7_pkcs11_OperationUpdateWithResult, CK_BYTE *, CK_ULONG))__pyx_f_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_update_resizing_output;
  __pyx_vtable_6pkcs11_7_pkcs11_OperationWithBinaryOutput.execute_resizing_output = (CK_RV (*)(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *, __pyx_t_6pkcs11_7_pkcs11_OperationWithResult))__pyx_f_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_execute_resizing_output;
  __pyx_vtable_6pkcs11_7_pkcs11_OperationWithBinaryOutput.process_fully = (PyObject *(*)(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *, __pyx_t_6pkcs11_7_pkcs11_OperationUpdateWithResult, CK_BYTE *, CK_ULONG))__pyx_f_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_process_fully;
  __pyx_vtable_6pkcs11_7_pkcs11_OperationWithBinaryOutput.update_with_result = (PyObject *(*)(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *, __pyx_t_6pkcs11_7_pkcs11_OperationUpdateWithResult, CK_BYTE *, CK_ULONG))__pyx_f_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_update_with_result;
  __pyx_vtable_6pkcs11_7_pkcs11_OperationWithBinaryOutput.update_no_output = (PyObject *(*)(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *, __pyx_t_6pkcs11_7_pkcs11_OperationUpdate, CK_BYTE *, CK_ULONG))__pyx_f_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_update_no_output;
  __pyx_vtable_6pkcs11_7_pkcs11_OperationWithBinaryOutput.finish_with_output = (PyObject *(*)(struct __pyx_obj_6pkcs11_7_pkcs11_OperationWithBinaryOutput *, __pyx_t_6pkcs11_7_pkcs11_OperationWithResult))__pyx_f_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_finish_with_output;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_OperationContext); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 605, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_OperationWithBinaryOutput = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6pkcs11_7_pkcs11_OperationWithBinaryOutput_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_OperationWithBinaryOutput)) __PYX_ERR(0, 605, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6pkcs11_7_pkcs11_OperationWithBinaryOutput_spec, __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_OperationWithBinaryOutput) < (0)) __PYX_ERR(0, 605, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_OperationWithBinaryOutput = &__pyx_type_6pkcs11_7_pkcs11_OperationWithBinaryOutput;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_OperationWithBinaryOutput->tp_base = __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_OperationContext;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_OperationWithBinaryOutput) < (0)) __PYX_ERR(0, 605, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_OperationWithBinaryOutput);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_OperationWithBinaryOutput->tp_dictoffset && __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_OperationWithBinaryOutput->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_OperationWithBinaryOutput->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_OperationWithBinaryOutput, __pyx_vtabptr_6pkcs11_7_pkcs11_OperationWithBinaryOutput) < (0)) __PYX_ERR(0, 605, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_OperationWithBinaryOutput) < (0)) __PYX_ERR(0, 605, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_OperationWithBinaryOutput, (PyObject *) __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_OperationWithBinaryOutput) < (0)) __PYX_ERR(0, 605, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_OperationWithBinaryOutput) < (0)) __PYX_ERR(0, 605, __pyx_L1_error)
  __pyx_vtabptr_6pkcs11_7_pkcs11_SearchIter = &__pyx_vtable_6pkcs11_7_pkcs11_SearchIter;
  __pyx_vtable_6pkcs11_7_pkcs11_SearchIter.__pyx_base = *__pyx_vtabptr_6pkcs11_7_pkcs11_OperationContext;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_OperationContext); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 717, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_SearchIter = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6pkcs11_7_pkcs11_SearchIter_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_SearchIter)) __PYX_ERR(0, 717, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6pkcs11_7_pkcs11_SearchIter_spec, __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_SearchIter) < (0)) __PYX_ERR(0, 717, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_SearchIter = &__pyx_type_6pkcs11_7_pkcs11_SearchIter;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_SearchIter->tp_base = __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_OperationContext;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_SearchIter) < (0)) __PYX_ERR(0, 717, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_SearchIter);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_SearchIter->tp_dictoffset && __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_SearchIter->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_SearchIter->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_SearchIter, "__next__"); if (unlikely(!wrapper)) __PYX_ERR(0, 717, __pyx_L1_error)
    if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) {
      __pyx_wrapperbase_6pkcs11_7_pkcs11_10SearchIter_7__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_6pkcs11_7_pkcs11_10SearchIter_7__next__.doc = __pyx_doc_6pkcs11_7_pkcs11_10SearchIter_7__next__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6pkcs11_7_pkcs11_10SearchIter_7__next__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_SearchIter, __pyx_vtabptr_6pkcs11_7_pkcs11_SearchIter) < (0)) __PYX_ERR(0, 717, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_SearchIter) < (0)) __PYX_ERR(0, 717, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_SearchIter, (PyObject *) __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_SearchIter) < (0)) __PYX_ERR(0, 717, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_SearchIter) < (0)) __PYX_ERR(0, 717, __pyx_L1_error)
  __pyx_vtabptr_6pkcs11_7_pkcs11_DigestOperation = &__pyx_vtable_6pkcs11_7_pkcs11_DigestOperation;
  __pyx_vtable_6pkcs11_7_pkcs11_DigestOperation.__pyx_base = *__pyx_vtabptr_6pkcs11_7_pkcs11_OperationWithBinaryOutput;
  __pyx_vtable_6pkcs11_7_pkcs11_DigestOperation.setup = (struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *(*)(struct __pyx_obj_6pkcs11_7_pkcs11_Session *, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *, CK_ULONG))__pyx_f_6pkcs11_7_pkcs11_15DigestOperation_setup;
  __pyx_vtable_6pkcs11_7_pkcs11_DigestOperation.digest_process_fully = (PyObject *(*)(struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *, CK_BYTE *, CK_ULONG))__pyx_f_6pkcs11_7_pkcs11_15DigestOperation_digest_process_fully;
  __pyx_vtable_6pkcs11_7_pkcs11_DigestOperation.update_digest = (void (*)(struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *, CK_BYTE *, CK_ULONG))__pyx_f_6pkcs11_7_pkcs11_15DigestOperation_update_digest;
  __pyx_vtable_6pkcs11_7_pkcs11_DigestOperation.update_digest_with_key = (void (*)(struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *, CK_OBJECT_HANDLE))__pyx_f_6pkcs11_7_pkcs11_15DigestOperation_update_digest_with_key;
  __pyx_vtable_6pkcs11_7_pkcs11_DigestOperation.finish = (PyObject *(*)(struct __pyx_obj_6pkcs11_7_pkcs11_DigestOperation *))__pyx_f_6pkcs11_7_pkcs11_15DigestOperation_finish;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_OperationWithBinaryOutput); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 778, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DigestOperation = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6pkcs11_7_pkcs11_DigestOperation_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DigestOperation)) __PYX_ERR(0, 778, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6pkcs11_7_pkcs11_DigestOperation_spec, __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DigestOperation) < (0)) __PYX_ERR(0, 778, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DigestOperation = &__pyx_type_6pkcs11_7_pkcs11_DigestOperation;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_DigestOperation->tp_base = __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_OperationWithBinaryOutput;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DigestOperation) < (0)) __PYX_ERR(0, 778, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DigestOperation);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DigestOperation->tp_dictoffset && __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DigestOperation->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DigestOperation->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DigestOperation, __pyx_vtabptr_6pkcs11_7_pkcs11_DigestOperation) < (0)) __PYX_ERR(0, 778, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DigestOperation) < (0)) __PYX_ERR(0, 778, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_DigestOperation, (PyObject *) __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DigestOperation) < (0)) __PYX_ERR(0, 778, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DigestOperation) < (0)) __PYX_ERR(0, 778, __pyx_L1_error)
  __pyx_vtabptr_6pkcs11_7_pkcs11_Session = &__pyx_vtable_6pkcs11_7_pkcs11_Session;
  __pyx_vtable_6pkcs11_7_pkcs11_Session.make = (struct __pyx_obj_6pkcs11_7_pkcs11_Session *(*)(struct __pyx_obj_6pkcs11_7_pkcs11_Token *, CK_SESSION_HANDLE, int, CK_USER_TYPE, PyObject *, unsigned int))__pyx_f_6pkcs11_7_pkcs11_7Session_make;
  __pyx_vtable_6pkcs11_7_pkcs11_Session.make_attribute_list = (struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *(*)(struct __pyx_obj_6pkcs11_7_pkcs11_Session *, PyObject *))__pyx_f_6pkcs11_7_pkcs11_7Session_make_attribute_list;
  __pyx_vtable_6pkcs11_7_pkcs11_Session.generate_key_from_attrs = (PyObject *(*)(struct __pyx_obj_6pkcs11_7_pkcs11_Session *, struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *))__pyx_f_6pkcs11_7_pkcs11_7Session_generate_key_from_attrs;
  __pyx_vtable_6pkcs11_7_pkcs11_Session.generate_keypair_from_attrs = (PyObject *(*)(struct __pyx_obj_6pkcs11_7_pkcs11_Session *, struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *, struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *))__pyx_f_6pkcs11_7_pkcs11_7Session_generate_keypair_from_attrs;
  __pyx_vtabptr_6pkcs11_7_pkcs11_ObjectHandleWrapper = &__pyx_vtable_6pkcs11_7_pkcs11_ObjectHandleWrapper;
  __pyx_vtable_6pkcs11_7_pkcs11_ObjectHandleWrapper.wrap = (struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *(*)(struct __pyx_obj_6pkcs11_7_pkcs11_Session *, CK_OBJECT_HANDLE))__pyx_f_6pkcs11_7_pkcs11_19ObjectHandleWrapper_wrap;
  __pyx_vtable_6pkcs11_7_pkcs11_ObjectHandleWrapper.get_attribute_list = (struct __pyx_obj_6pkcs11_7_pkcs11_AttributeList *(*)(struct __pyx_obj_6pkcs11_7_pkcs11_ObjectHandleWrapper *, CK_ATTRIBUTE_TYPE *, CK_ULONG))__pyx_f_6pkcs11_7_pkcs11_19ObjectHandleWrapper_get_attribute_list;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1197, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_ObjectHandleWrapper = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6pkcs11_7_pkcs11_ObjectHandleWrapper_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_ObjectHandleWrapper)) __PYX_ERR(0, 1197, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6pkcs11_7_pkcs11_ObjectHandleWrapper_spec, __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_ObjectHandleWrapper) < (0)) __PYX_ERR(0, 1197, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_ObjectHandleWrapper = &__pyx_type_6pkcs11_7_pkcs11_ObjectHandleWrapper;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_ObjectHandleWrapper->tp_base = __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_ObjectHandleWrapper) < (0)) __PYX_ERR(0, 1197, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_ObjectHandleWrapper);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_ObjectHandleWrapper->tp_dictoffset && __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_ObjectHandleWrapper->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_ObjectHandleWrapper->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_ObjectHandleWrapper, __pyx_vtabptr_6pkcs11_7_pkcs11_ObjectHandleWrapper) < (0)) __PYX_ERR(0, 1197, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_ObjectHandleWrapper) < (0)) __PYX_ERR(0, 1197, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_ObjectHandleWrapper, (PyObject *) __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_ObjectHandleWrapper) < (0)) __PYX_ERR(0, 1197, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_ObjectHandleWrapper) < (0)) __PYX_ERR(0, 1197, __pyx_L1_error)
  __pyx_vtabptr_6pkcs11_7_pkcs11_KeyOperation = &__pyx_vtable_6pkcs11_7_pkcs11_KeyOperation;
  __pyx_vtable_6pkcs11_7_pkcs11_KeyOperation.__pyx_base = *__pyx_vtabptr_6pkcs11_7_pkcs11_OperationWithBinaryOutput;
  __pyx_vtable_6pkcs11_7_pkcs11_KeyOperation._common_key_setup = (struct __pyx_obj_6pkcs11_7_pkcs11_KeyOperation *(*)(PyTypeObject *, struct __pyx_obj_6pkcs11_7_pkcs11_Session *, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *, CK_OBJECT_HANDLE, CK_ULONG))__pyx_f_6pkcs11_7_pkcs11_12KeyOperation__common_key_setup;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_OperationWithBinaryOutput); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_KeyOperation = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6pkcs11_7_pkcs11_KeyOperation_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_KeyOperation)) __PYX_ERR(0, 1490, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6pkcs11_7_pkcs11_KeyOperation_spec, __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_KeyOperation) < (0)) __PYX_ERR(0, 1490, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_KeyOperation = &__pyx_type_6pkcs11_7_pkcs11_KeyOperation;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_KeyOperation->tp_base = __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_OperationWithBinaryOutput;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_KeyOperation) < (0)) __PYX_ERR(0, 1490, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_KeyOperation);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_KeyOperation->tp_dictoffset && __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_KeyOperation->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_KeyOperation->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_KeyOperation, __pyx_vtabptr_6pkcs11_7_pkcs11_KeyOperation) < (0)) __PYX_ERR(0, 1490, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_KeyOperation) < (0)) __PYX_ERR(0, 1490, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_KeyOperation, (PyObject *) __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_KeyOperation) < (0)) __PYX_ERR(0, 1490, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_KeyOperation) < (0)) __PYX_ERR(0, 1490, __pyx_L1_error)
  __pyx_vtabptr_6pkcs11_7_pkcs11_DataCryptOperation = &__pyx_vtable_6pkcs11_7_pkcs11_DataCryptOperation;
  __pyx_vtable_6pkcs11_7_pkcs11_DataCryptOperation.__pyx_base = *__pyx_vtabptr_6pkcs11_7_pkcs11_KeyOperation;
  __pyx_vtable_6pkcs11_7_pkcs11_DataCryptOperation.setup_encrypt = (struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *(*)(struct __pyx_obj_6pkcs11_7_pkcs11_Session *, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *, CK_OBJECT_HANDLE, CK_ULONG))__pyx_f_6pkcs11_7_pkcs11_18DataCryptOperation_setup_encrypt;
  __pyx_vtable_6pkcs11_7_pkcs11_DataCryptOperation.setup_decrypt = (struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *(*)(struct __pyx_obj_6pkcs11_7_pkcs11_Session *, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *, CK_OBJECT_HANDLE, CK_ULONG))__pyx_f_6pkcs11_7_pkcs11_18DataCryptOperation_setup_decrypt;
  __pyx_vtable_6pkcs11_7_pkcs11_DataCryptOperation.crypt_process_fully = (PyObject *(*)(struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *, CK_BYTE *, CK_ULONG))__pyx_f_6pkcs11_7_pkcs11_18DataCryptOperation_crypt_process_fully;
  __pyx_vtable_6pkcs11_7_pkcs11_DataCryptOperation.finish = (PyObject *(*)(struct __pyx_obj_6pkcs11_7_pkcs11_DataCryptOperation *))__pyx_f_6pkcs11_7_pkcs11_18DataCryptOperation_finish;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_KeyOperation); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataCryptOperation = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6pkcs11_7_pkcs11_DataCryptOperation_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataCryptOperation)) __PYX_ERR(0, 1541, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6pkcs11_7_pkcs11_DataCryptOperation_spec, __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataCryptOperation) < (0)) __PYX_ERR(0, 1541, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataCryptOperation = &__pyx_type_6pkcs11_7_pkcs11_DataCryptOperation;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_DataCryptOperation->tp_base = __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_KeyOperation;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataCryptOperation) < (0)) __PYX_ERR(0, 1541, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataCryptOperation);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataCryptOperation->tp_dictoffset && __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataCryptOperation->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataCryptOperation->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataCryptOperation, __pyx_vtabptr_6pkcs11_7_pkcs11_DataCryptOperation) < (0)) __PYX_ERR(0, 1541, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataCryptOperation) < (0)) __PYX_ERR(0, 1541, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_DataCryptOperation, (PyObject *) __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataCryptOperation) < (0)) __PYX_ERR(0, 1541, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataCryptOperation) < (0)) __PYX_ERR(0, 1541, __pyx_L1_error)
  __pyx_vtabptr_6pkcs11_7_pkcs11_SignOrVerifyOperation = &__pyx_vtable_6pkcs11_7_pkcs11_SignOrVerifyOperation;
  __pyx_vtable_6pkcs11_7_pkcs11_SignOrVerifyOperation.__pyx_base = *__pyx_vtabptr_6pkcs11_7_pkcs11_KeyOperation;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_KeyOperation); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1671, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_SignOrVerifyOperation = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6pkcs11_7_pkcs11_SignOrVerifyOperation_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_SignOrVerifyOperation)) __PYX_ERR(0, 1671, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6pkcs11_7_pkcs11_SignOrVerifyOperation_spec, __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_SignOrVerifyOperation) < (0)) __PYX_ERR(0, 1671, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_SignOrVerifyOperation = &__pyx_type_6pkcs11_7_pkcs11_SignOrVerifyOperation;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_SignOrVerifyOperation->tp_base = __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_KeyOperation;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_SignOrVerifyOperation) < (0)) __PYX_ERR(0, 1671, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_SignOrVerifyOperation);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_SignOrVerifyOperation->tp_dictoffset && __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_SignOrVerifyOperation->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_SignOrVerifyOperation->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_SignOrVerifyOperation, __pyx_vtabptr_6pkcs11_7_pkcs11_SignOrVerifyOperation) < (0)) __PYX_ERR(0, 1671, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_SignOrVerifyOperation) < (0)) __PYX_ERR(0, 1671, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_SignOrVerifyOperation, (PyObject *) __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_SignOrVerifyOperation) < (0)) __PYX_ERR(0, 1671, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_SignOrVerifyOperation) < (0)) __PYX_ERR(0, 1671, __pyx_L1_error)
  __pyx_vtabptr_6pkcs11_7_pkcs11_DataSignOperation = &__pyx_vtable_6pkcs11_7_pkcs11_DataSignOperation;
  __pyx_vtable_6pkcs11_7_pkcs11_DataSignOperation.__pyx_base = *__pyx_vtabptr_6pkcs11_7_pkcs11_SignOrVerifyOperation;
  __pyx_vtable_6pkcs11_7_pkcs11_DataSignOperation.setup = (struct __pyx_obj_6pkcs11_7_pkcs11_DataSignOperation *(*)(struct __pyx_obj_6pkcs11_7_pkcs11_Session *, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *, CK_OBJECT_HANDLE, CK_ULONG))__pyx_f_6pkcs11_7_pkcs11_17DataSignOperation_setup;
  __pyx_vtable_6pkcs11_7_pkcs11_DataSignOperation.sign_process_fully = (PyObject *(*)(struct __pyx_obj_6pkcs11_7_pkcs11_DataSignOperation *, CK_BYTE *, CK_ULONG))__pyx_f_6pkcs11_7_pkcs11_17DataSignOperation_sign_process_fully;
  __pyx_vtable_6pkcs11_7_pkcs11_DataSignOperation.finish = (PyObject *(*)(struct __pyx_obj_6pkcs11_7_pkcs11_DataSignOperation *))__pyx_f_6pkcs11_7_pkcs11_17DataSignOperation_finish;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_SignOrVerifyOperation); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1687, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataSignOperation = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6pkcs11_7_pkcs11_DataSignOperation_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataSignOperation)) __PYX_ERR(0, 1687, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6pkcs11_7_pkcs11_DataSignOperation_spec, __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataSignOperation) < (0)) __PYX_ERR(0, 1687, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataSignOperation = &__pyx_type_6pkcs11_7_pkcs11_DataSignOperation;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_DataSignOperation->tp_base = __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_SignOrVerifyOperation;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataSignOperation) < (0)) __PYX_ERR(0, 1687, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataSignOperation);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataSignOperation->tp_dictoffset && __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataSignOperation->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataSignOperation->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataSignOperation, __pyx_vtabptr_6pkcs11_7_pkcs11_DataSignOperation) < (0)) __PYX_ERR(0, 1687, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataSignOperation) < (0)) __PYX_ERR(0, 1687, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_DataSignOperation, (PyObject *) __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataSignOperation) < (0)) __PYX_ERR(0, 1687, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataSignOperation) < (0)) __PYX_ERR(0, 1687, __pyx_L1_error)
  __pyx_vtabptr_6pkcs11_7_pkcs11_DataVerifyOperation = &__pyx_vtable_6pkcs11_7_pkcs11_DataVerifyOperation;
  __pyx_vtable_6pkcs11_7_pkcs11_DataVerifyOperation.__pyx_base = *__pyx_vtabptr_6pkcs11_7_pkcs11_SignOrVerifyOperation;
  __pyx_vtable_6pkcs11_7_pkcs11_DataVerifyOperation.setup = (struct __pyx_obj_6pkcs11_7_pkcs11_DataVerifyOperation *(*)(struct __pyx_obj_6pkcs11_7_pkcs11_Session *, struct __pyx_obj_6pkcs11_7_pkcs11_MechanismWithParam *, CK_OBJECT_HANDLE))__pyx_f_6pkcs11_7_pkcs11_19DataVerifyOperation_setup;
  __pyx_vtable_6pkcs11_7_pkcs11_DataVerifyOperation.verify_process_fully = (PyObject *(*)(struct __pyx_obj_6pkcs11_7_pkcs11_DataVerifyOperation *, CK_BYTE *, CK_ULONG, CK_BYTE *, CK_ULONG))__pyx_f_6pkcs11_7_pkcs11_19DataVerifyOperation_verify_process_fully;
  __pyx_vtable_6pkcs11_7_pkcs11_DataVerifyOperation.finish = (PyObject *(*)(struct __pyx_obj_6pkcs11_7_pkcs11_DataVerifyOperation *, CK_BYTE *, CK_ULONG))__pyx_f_6pkcs11_7_pkcs11_19DataVerifyOperation_finish;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_SignOrVerifyOperation); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1747, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataVerifyOperation = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6pkcs11_7_pkcs11_DataVerifyOperation_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataVerifyOperation)) __PYX_ERR(0, 1747, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6pkcs11_7_pkcs11_DataVerifyOperation_spec, __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataVerifyOperation) < (0)) __PYX_ERR(0, 1747, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataVerifyOperation = &__pyx_type_6pkcs11_7_pkcs11_DataVerifyOperation;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_DataVerifyOperation->tp_base = __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_SignOrVerifyOperation;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataVerifyOperation) < (0)) __PYX_ERR(0, 1747, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataVerifyOperation);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataVerifyOperation->tp_dictoffset && __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataVerifyOperation->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataVerifyOperation->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataVerifyOperation, __pyx_vtabptr_6pkcs11_7_pkcs11_DataVerifyOperation) < (0)) __PYX_ERR(0, 1747, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataVerifyOperation) < (0)) __PYX_ERR(0, 1747, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_DataVerifyOperation, (PyObject *) __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataVerifyOperation) < (0)) __PYX_ERR(0, 1747, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_DataVerifyOperation) < (0)) __PYX_ERR(0, 1747, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter)) __PYX_ERR(0, 733, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter_spec, __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter) < (0)) __PYX_ERR(0, 733, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter = &__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter) < (0)) __PYX_ERR(0, 733, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter->tp_dictoffset && __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct___batch_iter->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects)) __PYX_ERR(0, 915, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects_spec, __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects) < (0)) __PYX_ERR(0, 915, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects = &__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects) < (0)) __PYX_ERR(0, 915, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects->tp_dictoffset && __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_1_get_objects->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks)) __PYX_ERR(0, 1588, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks_spec, __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks) < (0)) __PYX_ERR(0, 1588, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks = &__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks) < (0)) __PYX_ERR(0, 1588, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks->tp_dictoffset && __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_2_update_chunks->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator)) __PYX_ERR(0, 1621, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator_spec, __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator) < (0)) __PYX_ERR(0, 1621, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator = &__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator) < (0)) __PYX_ERR(0, 1621, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator->tp_dictoffset && __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_3__encrypt_generator->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator)) __PYX_ERR(0, 1655, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator_spec, __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator) < (0)) __PYX_ERR(0, 1655, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator = &__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator) < (0)) __PYX_ERR(0, 1655, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator->tp_dictoffset && __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_4__decrypt_generator->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens)) __PYX_ERR(0, 2127, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens_spec, __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens) < (0)) __PYX_ERR(0, 2127, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens = &__pyx_type_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens) < (0)) __PYX_ERR(0, 2127, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens->tp_dictoffset && __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11___pyx_scope_struct_5_get_tokens->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  __pyx_vtabptr_array = &__pyx_vtable_array;
  __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_array_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_array_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_array_type)) __PYX_ERR(1, 118, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate->__pyx_array_type->tp_as_buffer = &__pyx_tp_as_buffer_array;
  if (!__pyx_mstate->__pyx_array_type->tp_as_buffer->bf_releasebuffer && __pyx_mstate->__pyx_array_type->tp_base->tp_as_buffer && __pyx_mstate->__pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer) {
    __pyx_mstate->__pyx_array_type->tp_as_buffer->bf_releasebuffer = __pyx_mstate->__pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer;
  }
  #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer)
  /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */
  #elif defined(_MSC_VER)
  #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.")
  #else
  #warning "The buffer protocol is not supported in the Limited C-API < 3.11."
  #endif
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_array_spec, __pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 118, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_array_type = &__pyx_type___pyx_array;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 118, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_array_type);
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_array_type, __pyx_vtabptr_array) < (0)) __PYX_ERR(1, 118, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 118, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 118, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_MemviewEnum_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_MemviewEnum_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_MemviewEnum_type)) __PYX_ERR(1, 307, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_MemviewEnum_spec, __pyx_mstate->__pyx_MemviewEnum_type) < (0)) __PYX_ERR(1, 307, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_MemviewEnum_type) < (0)) __PYX_ERR(1, 307, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_MemviewEnum_type);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_MemviewEnum_type->tp_dictoffset && __pyx_mstate->__pyx_MemviewEnum_type->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_MemviewEnum_type->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_MemviewEnum_type) < (0)) __PYX_ERR(1, 307, __pyx_L1_error)
  __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
  __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
  __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
  __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
  __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
  __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
  __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object;
  __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
  __pyx_vtable_memoryview._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryview__get_base;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_memoryview_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryview_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_memoryview_type)) __PYX_ERR(1, 342, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate->__pyx_memoryview_type->tp_as_buffer = &__pyx_tp_as_buffer_memoryview;
  if (!__pyx_mstate->__pyx_memoryview_type->tp_as_buffer->bf_releasebuffer && __pyx_mstate->__pyx_memoryview_type->tp_base->tp_as_buffer && __pyx_mstate->__pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer) {
    __pyx_mstate->__pyx_memoryview_type->tp_as_buffer->bf_releasebuffer = __pyx_mstate->__pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer;
  }
  #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer)
  /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */
  #elif defined(_MSC_VER)
  #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.")
  #else
  #warning "The buffer protocol is not supported in the Limited C-API < 3.11."
  #endif
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryview_spec, __pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 342, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_memoryview_type = &__pyx_type___pyx_memoryview;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 342, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_memoryview_type);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_memoryview_type->tp_dictoffset && __pyx_mstate->__pyx_memoryview_type->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_memoryview_type->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_memoryview_type, __pyx_vtabptr_memoryview) < (0)) __PYX_ERR(1, 342, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 342, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 342, __pyx_L1_error)
  __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
  __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
  __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
  __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
  __pyx_vtable__memoryviewslice.__pyx_base._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryviewslice__get_base;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_memoryview_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 856, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_memoryviewslice_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryviewslice_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_memoryviewslice_type)) __PYX_ERR(1, 856, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryviewslice_spec, __pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 856, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_memoryviewslice_type->tp_base = __pyx_mstate_global->__pyx_memoryview_type;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 856, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_memoryviewslice_type);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_memoryviewslice_type->tp_dictoffset && __pyx_mstate->__pyx_memoryviewslice_type->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_memoryviewslice_type->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_memoryviewslice_type, __pyx_vtabptr__memoryviewslice) < (0)) __PYX_ERR(1, 856, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 856, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 856, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  /*--- Type import code ---*/
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_2_8(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_8(PyTypeObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  0, 0,
  #else
  sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_8(PyHeapTypeObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_8); if (!__pyx_mstate->__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  /*--- Variable import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec__pkcs11(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec__pkcs11},
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  {Py_mod_gil, __Pyx_FREETHREADING_COMPATIBLE},
  #endif
  #if PY_VERSION_HEX >= 0x030C0000 && CYTHON_USE_MODULE_STATE
  {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},
  #endif
  {0, NULL}
};
#endif

#ifdef __cplusplus
namespace {
  struct PyModuleDef __pyx_moduledef =
  #else
  static struct PyModuleDef __pyx_moduledef =
  #endif
  {
      PyModuleDef_HEAD_INIT,
      "_pkcs11",
      __pyx_k_High_level_Python_PKCS_11_Wrapp, /* m_doc */
    #if CYTHON_USE_MODULE_STATE
      sizeof(__pyx_mstatetype), /* m_size */
    #else
      (CYTHON_PEP489_MULTI_PHASE_INIT) ? 0 : -1, /* m_size */
    #endif
      __pyx_methods /* m_methods */,
    #if CYTHON_PEP489_MULTI_PHASE_INIT
      __pyx_moduledef_slots, /* m_slots */
    #else
      NULL, /* m_reload */
    #endif
    #if CYTHON_USE_MODULE_STATE
      __pyx_m_traverse, /* m_traverse */
      __pyx_m_clear, /* m_clear */
      NULL /* m_free */
    #else
      NULL, /* m_traverse */
      NULL, /* m_clear */
      NULL /* m_free */
    #endif
  };
  #ifdef __cplusplus
} /* anonymous namespace */
#endif

/* PyModInitFuncType */
#ifndef CYTHON_NO_PYINIT_EXPORT
  #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#else
  #ifdef __cplusplus
  #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
  #else
  #define __Pyx_PyMODINIT_FUNC PyObject *
  #endif
#endif

__Pyx_PyMODINIT_FUNC PyInit__pkcs11(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit__pkcs11(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
  return PyModuleDef_Init(&__pyx_moduledef);
}
/* ModuleCreationPEP489 */
#if CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\
      || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000))
static PY_INT64_T __Pyx_GetCurrentInterpreterId(void) {
    {
        PyObject *module = PyImport_ImportModule("_interpreters"); // 3.13+ I think
        if (!module) {
            PyErr_Clear(); // just try the 3.8-3.12 version
            module = PyImport_ImportModule("_xxsubinterpreters");
            if (!module) goto bad;
        }
        PyObject *current = PyObject_CallMethod(module, "get_current", NULL);
        Py_DECREF(module);
        if (!current) goto bad;
        if (PyTuple_Check(current)) {
            PyObject *new_current = PySequence_GetItem(current, 0);
            Py_DECREF(current);
            current = new_current;
            if (!new_current) goto bad;
        }
        long long as_c_int = PyLong_AsLongLong(current);
        Py_DECREF(current);
        return as_c_int;
    }
  bad:
    PySys_WriteStderr("__Pyx_GetCurrentInterpreterId failed. Try setting the C define CYTHON_PEP489_MULTI_PHASE_INIT=0\n");
    return -1;
}
#endif
#if !CYTHON_USE_MODULE_STATE
static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
    static PY_INT64_T main_interpreter_id = -1;
#if CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000
    PY_INT64_T current_id = GraalPyInterpreterState_GetIDFromThreadState(PyThreadState_Get());
#elif CYTHON_COMPILING_IN_GRAAL
    PY_INT64_T current_id = PyInterpreterState_GetIDFromThreadState(PyThreadState_Get());
#elif CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\
      || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000))
    PY_INT64_T current_id = __Pyx_GetCurrentInterpreterId();
#elif CYTHON_COMPILING_IN_LIMITED_API
    PY_INT64_T current_id = PyInterpreterState_GetID(PyInterpreterState_Get());
#else
    PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
#endif
    if (unlikely(current_id == -1)) {
        return -1;
    }
    if (main_interpreter_id == -1) {
        main_interpreter_id = current_id;
        return 0;
    } else if (unlikely(main_interpreter_id != current_id)) {
        PyErr_SetString(
            PyExc_ImportError,
            "Interpreter change detected - this module can only be loaded into one interpreter per process.");
        return -1;
    }
    return 0;
}
#endif
static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none)
{
    PyObject *value = PyObject_GetAttrString(spec, from_name);
    int result = 0;
    if (likely(value)) {
        if (allow_none || value != Py_None) {
            result = PyDict_SetItemString(moddict, to_name, value);
        }
        Py_DECREF(value);
    } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Clear();
    } else {
        result = -1;
    }
    return result;
}
static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) {
    PyObject *module = NULL, *moddict, *modname;
    CYTHON_UNUSED_VAR(def);
    #if !CYTHON_USE_MODULE_STATE
    if (__Pyx_check_single_interpreter())
        return NULL;
    #endif
    if (__pyx_m)
        return __Pyx_NewRef(__pyx_m);
    modname = PyObject_GetAttrString(spec, "name");
    if (unlikely(!modname)) goto bad;
    module = PyModule_NewObject(modname);
    Py_DECREF(modname);
    if (unlikely(!module)) goto bad;
    moddict = PyModule_GetDict(module);
    if (unlikely(!moddict)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
    return module;
bad:
    Py_XDECREF(module);
    return NULL;
}


static CYTHON_SMALL_CODE int __pyx_pymod_exec__pkcs11(PyObject *__pyx_pyinit_module)
#endif
{
  int stringtab_initialized = 0;
  #if CYTHON_USE_MODULE_STATE
  int pystate_addmodule_run = 0;
  #endif
  __pyx_mstatetype *__pyx_mstate = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  static PyThread_type_lock __pyx_t_7[8];
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyTypeObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m) {
    if (__pyx_m == __pyx_pyinit_module) return 0;
    PyErr_SetString(PyExc_RuntimeError, "Module '_pkcs11' has already been imported. Re-initialisation is not supported.");
    return -1;
  }
  #else
  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  #endif
  /*--- Module creation code ---*/
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __pyx_t_1 = __pyx_pyinit_module;
  Py_INCREF(__pyx_t_1);
  #else
  __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #if CYTHON_USE_MODULE_STATE
  {
    int add_module_result = __Pyx_State_AddModule(__pyx_t_1, &__pyx_moduledef);
    __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "_pkcs11" pseudovariable */
    if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
    pystate_addmodule_run = 1;
  }
  #else
  __pyx_m = __pyx_t_1;
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  PyUnstable_Module_SetGIL(__pyx_m, Py_MOD_GIL_USED);
  #endif
  __pyx_mstate = __pyx_mstate_global;
  CYTHON_UNUSED_VAR(__pyx_t_1);
  __pyx_mstate->__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_mstate->__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_mstate->__pyx_d);
  __pyx_mstate->__pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_mstate->__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_cython_runtime = __Pyx_PyImport_AddModuleRef("cython_runtime"); if (unlikely(!__pyx_mstate->__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_mstate->__pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /* ImportRefnannyAPI */
  #if CYTHON_REFNANNY
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
    PyErr_Clear();
    __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
    if (!__Pyx_RefNanny)
        Py_FatalError("failed to import 'refnanny' module");
  }
  #endif
  
__Pyx_RefNannySetupContext("PyInit__pkcs11", 0);
  __Pyx_init_runtime_version();
  if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_mstate->__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Library function declarations ---*/
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  stringtab_initialized = 1;
  if (__Pyx_InitGlobals() < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__pyx_module_is_main_pkcs11___pkcs11) {
    if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_name_2, __pyx_mstate_global->__pyx_n_u_main) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  }
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "pkcs11._pkcs11")) {
      if (unlikely((PyDict_SetItemString(modules, "pkcs11._pkcs11", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_CreateCodeObjects(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Global type/function init code ---*/
  (void)__Pyx_modinit_global_init_code(__pyx_mstate);
  (void)__Pyx_modinit_variable_export_code(__pyx_mstate);
  (void)__Pyx_modinit_function_export_code(__pyx_mstate);
  if (unlikely((__Pyx_modinit_type_init_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  if (unlikely((__Pyx_modinit_type_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  (void)__Pyx_modinit_variable_import_code(__pyx_mstate);
  (void)__Pyx_modinit_function_import_code(__pyx_mstate);
  /*--- Execution code ---*/

  /* "View.MemoryView":108
 * 
 * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence"
 * try:             # <<<<<<<<<<<<<<
 *     __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence
 * except:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "View.MemoryView":109
 * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence"
 * try:
 *     __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence             # <<<<<<<<<<<<<<
 * except:
 * 
*/
      __pyx_t_5 = NULL;
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_collections_abc};
        __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin___import__, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 109, __pyx_L2_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_abc); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 109, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Sequence); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 109, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XGOTREF(__pyx_collections_abc_Sequence);
      __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;

      /* "View.MemoryView":108
 * 
 * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence"
 * try:             # <<<<<<<<<<<<<<
 *     __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence
 * except:
*/
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L7_try_end;
    __pyx_L2_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "View.MemoryView":110
 * try:
 *     __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence
 * except:             # <<<<<<<<<<<<<<
 * 
 *     __pyx_collections_abc_Sequence = None
*/
    /*except:*/ {
      __Pyx_ErrRestore(0,0,0);

      /* "View.MemoryView":112
 * except:
 * 
 *     __pyx_collections_abc_Sequence = None             # <<<<<<<<<<<<<<
 * 
 * 
*/
      __Pyx_INCREF(Py_None);
      __Pyx_XGOTREF(__pyx_collections_abc_Sequence);
      __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, Py_None);
      __Pyx_GIVEREF(Py_None);
      goto __pyx_L3_exception_handled;
    }
    __pyx_L3_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L7_try_end:;
  }

  /* "View.MemoryView":247
 * 
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         count = __pyx_collections_abc_Sequence.count
 *         index = __pyx_collections_abc_Sequence.index
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_1);
    /*try:*/ {

      /* "View.MemoryView":248
 * 
 *     try:
 *         count = __pyx_collections_abc_Sequence.count             # <<<<<<<<<<<<<<
 *         index = __pyx_collections_abc_Sequence.index
 *     except:
*/
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 248, __pyx_L10_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_array_type, __pyx_mstate_global->__pyx_n_u_count, __pyx_t_4) < (0)) __PYX_ERR(1, 248, __pyx_L10_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "View.MemoryView":249
 *     try:
 *         count = __pyx_collections_abc_Sequence.count
 *         index = __pyx_collections_abc_Sequence.index             # <<<<<<<<<<<<<<
 *     except:
 *         pass
*/
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 249, __pyx_L10_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_array_type, __pyx_mstate_global->__pyx_n_u_index, __pyx_t_4) < (0)) __PYX_ERR(1, 249, __pyx_L10_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "View.MemoryView":247
 * 
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         count = __pyx_collections_abc_Sequence.count
 *         index = __pyx_collections_abc_Sequence.index
*/
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L15_try_end;
    __pyx_L10_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "View.MemoryView":250
 *         count = __pyx_collections_abc_Sequence.count
 *         index = __pyx_collections_abc_Sequence.index
 *     except:             # <<<<<<<<<<<<<<
 *         pass
 * 
*/
    /*except:*/ {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L11_exception_handled;
    }
    __pyx_L11_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    __pyx_L15_try_end:;
  }

  /* "View.MemoryView":315
 *         return self.name
 * 
 * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
 * cdef strided = Enum("<strided and direct>") # default
 * cdef indirect = Enum("<strided and indirect>")
*/
  __pyx_t_5 = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_strided_and_direct_or_indirect};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 315, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_4);
  }
  __Pyx_XGOTREF(generic);
  __Pyx_DECREF_SET(generic, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "View.MemoryView":316
 * 
 * cdef generic = Enum("<strided and direct or indirect>")
 * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
 * cdef indirect = Enum("<strided and indirect>")
 * 
*/
  __pyx_t_5 = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_strided_and_direct};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 316, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_4);
  }
  __Pyx_XGOTREF(strided);
  __Pyx_DECREF_SET(strided, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "View.MemoryView":317
 * cdef generic = Enum("<strided and direct or indirect>")
 * cdef strided = Enum("<strided and direct>") # default
 * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_5 = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_strided_and_indirect};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 317, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_4);
  }
  __Pyx_XGOTREF(indirect);
  __Pyx_DECREF_SET(indirect, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "View.MemoryView":320
 * 
 * 
 * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
 * cdef indirect_contiguous = Enum("<contiguous and indirect>")
 * 
*/
  __pyx_t_5 = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_contiguous_and_direct};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 320, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_4);
  }
  __Pyx_XGOTREF(contiguous);
  __Pyx_DECREF_SET(contiguous, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "View.MemoryView":321
 * 
 * cdef contiguous = Enum("<contiguous and direct>")
 * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_5 = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_contiguous_and_indirect};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 321, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_4);
  }
  __Pyx_XGOTREF(indirect_contiguous);
  __Pyx_DECREF_SET(indirect_contiguous, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "View.MemoryView":329
 * 
 * 
 * cdef int __pyx_memoryview_thread_locks_used = 0             # <<<<<<<<<<<<<<
 * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [
 *     PyThread_allocate_lock(),
*/
  __pyx_memoryview_thread_locks_used = 0;

  /* "View.MemoryView":330
 * 
 * cdef int __pyx_memoryview_thread_locks_used = 0
 * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [             # <<<<<<<<<<<<<<
 *     PyThread_allocate_lock(),
 *     PyThread_allocate_lock(),
*/
  __pyx_t_7[0] = PyThread_allocate_lock();
  __pyx_t_7[1] = PyThread_allocate_lock();
  __pyx_t_7[2] = PyThread_allocate_lock();
  __pyx_t_7[3] = PyThread_allocate_lock();
  __pyx_t_7[4] = PyThread_allocate_lock();
  __pyx_t_7[5] = PyThread_allocate_lock();
  __pyx_t_7[6] = PyThread_allocate_lock();
  __pyx_t_7[7] = PyThread_allocate_lock();
  memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_7, sizeof(__pyx_memoryview_thread_locks[0]) * (8));

  /* "View.MemoryView":888
 * 
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         count = __pyx_collections_abc_Sequence.count
 *         index = __pyx_collections_abc_Sequence.index
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "View.MemoryView":889
 * 
 *     try:
 *         count = __pyx_collections_abc_Sequence.count             # <<<<<<<<<<<<<<
 *         index = __pyx_collections_abc_Sequence.index
 *     except:
*/
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 889, __pyx_L18_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_memoryviewslice_type, __pyx_mstate_global->__pyx_n_u_count, __pyx_t_4) < (0)) __PYX_ERR(1, 889, __pyx_L18_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "View.MemoryView":890
 *     try:
 *         count = __pyx_collections_abc_Sequence.count
 *         index = __pyx_collections_abc_Sequence.index             # <<<<<<<<<<<<<<
 *     except:
 *         pass
*/
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 890, __pyx_L18_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_memoryviewslice_type, __pyx_mstate_global->__pyx_n_u_index, __pyx_t_4) < (0)) __PYX_ERR(1, 890, __pyx_L18_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "View.MemoryView":888
 * 
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         count = __pyx_collections_abc_Sequence.count
 *         index = __pyx_collections_abc_Sequence.index
*/
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L23_try_end;
    __pyx_L18_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "View.MemoryView":891
 *         count = __pyx_collections_abc_Sequence.count
 *         index = __pyx_collections_abc_Sequence.index
 *     except:             # <<<<<<<<<<<<<<
 *         pass
 * 
*/
    /*except:*/ {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L19_exception_handled;
    }
    __pyx_L19_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L23_try_end:;
  }

  /* "View.MemoryView":894
 *         pass
 * 
 * try:             # <<<<<<<<<<<<<<
 *     if __pyx_collections_abc_Sequence:
 * 
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_1);
    /*try:*/ {

      /* "View.MemoryView":895
 * 
 * try:
 *     if __pyx_collections_abc_Sequence:             # <<<<<<<<<<<<<<
 * 
 * 
*/
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_collections_abc_Sequence); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(1, 895, __pyx_L26_error)
      if (__pyx_t_8) {

        /* "View.MemoryView":899
 * 
 * 
 *         __pyx_collections_abc_Sequence.register(_memoryviewslice)             # <<<<<<<<<<<<<<
 *         __pyx_collections_abc_Sequence.register(array)
 * except:
*/
        __pyx_t_5 = __pyx_collections_abc_Sequence;
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_6 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_mstate_global->__pyx_memoryviewslice_type)};
          __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_register, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 899, __pyx_L26_error)
          __Pyx_GOTREF(__pyx_t_4);
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "View.MemoryView":900
 * 
 *         __pyx_collections_abc_Sequence.register(_memoryviewslice)
 *         __pyx_collections_abc_Sequence.register(array)             # <<<<<<<<<<<<<<
 * except:
 *     pass  # ignore failure, it's a minor issue
*/
        __pyx_t_5 = __pyx_collections_abc_Sequence;
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_6 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_mstate_global->__pyx_array_type)};
          __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_register, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 900, __pyx_L26_error)
          __Pyx_GOTREF(__pyx_t_4);
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "View.MemoryView":895
 * 
 * try:
 *     if __pyx_collections_abc_Sequence:             # <<<<<<<<<<<<<<
 * 
 * 
*/
      }

      /* "View.MemoryView":894
 *         pass
 * 
 * try:             # <<<<<<<<<<<<<<
 *     if __pyx_collections_abc_Sequence:
 * 
*/
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L31_try_end;
    __pyx_L26_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "View.MemoryView":901
 *         __pyx_collections_abc_Sequence.register(_memoryviewslice)
 *         __pyx_collections_abc_Sequence.register(array)
 * except:             # <<<<<<<<<<<<<<
 *     pass  # ignore failure, it's a minor issue
 * 
*/
    /*except:*/ {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L27_exception_handled;
    }
    __pyx_L27_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    __pyx_L31_try_end:;
  }

  /* "(tree fragment)":4
 *     int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1
 *     int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1
 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name')
*/
  __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_mstate_global->__pyx_n_u_View_MemoryView); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Enum, __pyx_t_4) < (0)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":14
 *                         print_function, division)
 * 
 * from threading import RLock             # <<<<<<<<<<<<<<
 * 
 * from cpython.mem cimport PyMem_Malloc, PyMem_Free
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_RLock};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_threading, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error)
  }
  __pyx_t_4 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_4);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_RLock};
    __pyx_t_9 = 0; {
      __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 14, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 14, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":20
 * from libc.string cimport memcpy
 * 
 * from pkcs11 import types             # <<<<<<<<<<<<<<
 * from pkcs11.attributes import AttributeMapper
 * from pkcs11.defaults import *
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_types};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pkcs11, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error)
  }
  __pyx_t_4 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_4);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_types};
    __pyx_t_9 = 0; {
      __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 20, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 20, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":21
 * 
 * from pkcs11 import types
 * from pkcs11.attributes import AttributeMapper             # <<<<<<<<<<<<<<
 * from pkcs11.defaults import *
 * from pkcs11.exceptions import *
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_AttributeMapper};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pkcs11_attributes, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error)
  }
  __pyx_t_4 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_4);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_AttributeMapper};
    __pyx_t_9 = 0; {
      __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 21, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 21, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":22
 * from pkcs11 import types
 * from pkcs11.attributes import AttributeMapper
 * from pkcs11.defaults import *             # <<<<<<<<<<<<<<
 * from pkcs11.exceptions import *
 * from pkcs11.constants import *
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u__11};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pkcs11_defaults, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
  }
  __pyx_t_4 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_4);
  if (__pyx_import_star(__pyx_t_4) < 0) __PYX_ERR(0, 22, __pyx_L1_error);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":23
 * from pkcs11.attributes import AttributeMapper
 * from pkcs11.defaults import *
 * from pkcs11.exceptions import *             # <<<<<<<<<<<<<<
 * from pkcs11.constants import *
 * from pkcs11.mechanisms import *
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u__11};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pkcs11_exceptions, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
  }
  __pyx_t_4 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_4);
  if (__pyx_import_star(__pyx_t_4) < 0) __PYX_ERR(0, 23, __pyx_L1_error);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":24
 * from pkcs11.defaults import *
 * from pkcs11.exceptions import *
 * from pkcs11.constants import *             # <<<<<<<<<<<<<<
 * from pkcs11.mechanisms import *
 * from pkcs11.types import (
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u__11};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pkcs11_constants, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error)
  }
  __pyx_t_4 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_4);
  if (__pyx_import_star(__pyx_t_4) < 0) __PYX_ERR(0, 24, __pyx_L1_error);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":25
 * from pkcs11.exceptions import *
 * from pkcs11.constants import *
 * from pkcs11.mechanisms import *             # <<<<<<<<<<<<<<
 * from pkcs11.types import (
 *     _CK_UTF8CHAR_to_str,
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u__11};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pkcs11_mechanisms, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error)
  }
  __pyx_t_4 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_4);
  if (__pyx_import_star(__pyx_t_4) < 0) __PYX_ERR(0, 25, __pyx_L1_error);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":26
 * from pkcs11.constants import *
 * from pkcs11.mechanisms import *
 * from pkcs11.types import (             # <<<<<<<<<<<<<<
 *     _CK_UTF8CHAR_to_str,
 *     _CK_VERSION_to_tuple,
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_CK_UTF8CHAR_to_str,__pyx_mstate_global->__pyx_n_u_CK_VERSION_to_tuple,__pyx_mstate_global->__pyx_n_u_CK_MECHANISM_TYPE_to_enum,__pyx_mstate_global->__pyx_n_u_PROTECTED_AUTH};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pkcs11_types, __pyx_imported_names, 4, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error)
  }
  __pyx_t_4 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_4);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_CK_UTF8CHAR_to_str,__pyx_mstate_global->__pyx_n_u_CK_VERSION_to_tuple,__pyx_mstate_global->__pyx_n_u_CK_MECHANISM_TYPE_to_enum,__pyx_mstate_global->__pyx_n_u_PROTECTED_AUTH};
    for (__pyx_t_9=0; __pyx_t_9 < 4; __pyx_t_9++) {
      __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 26, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 26, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_11HasFuncList_3__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_HasFuncList___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_4) < (0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_11HasFuncList_5__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_HasFuncList___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < (0)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":112
 *             raise IndexError()
 * 
 *     def as_dict(self, attribute_mapper):             # <<<<<<<<<<<<<<
 *         cdef CK_ATTRIBUTE * attr
 *         result = {}
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_13AttributeList_5as_dict, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AttributeList_as_dict, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_AttributeList, __pyx_mstate_global->__pyx_n_u_as_dict, __pyx_t_4) < (0)) __PYX_ERR(0, 112, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":120
 *         return result
 * 
 *     def get(self, item, attribute_mapper):             # <<<<<<<<<<<<<<
 *         cdef CK_ULONG index = 0
 *         cdef CK_ATTRIBUTE_TYPE key = item
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_13AttributeList_7get, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AttributeList_get, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_AttributeList, __pyx_mstate_global->__pyx_n_u_get, __pyx_t_4) < (0)) __PYX_ERR(0, 120, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_13AttributeList_11__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AttributeList___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_4) < (0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_13AttributeList_13__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AttributeList___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < (0)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_18MechanismWithParam_7__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_MechanismWithParam___reduce_cyth, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[12])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_4) < (0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_18MechanismWithParam_9__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_MechanismWithParam___setstate_cy, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[13])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < (0)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":319
 * 
 * 
 * cdef class Slot(HasFuncList, types.Slot):             # <<<<<<<<<<<<<<
 *     """Extend Slot with implementation."""
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_types); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Slot); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_Pack(2, ((PyObject *)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList), __pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = PyTuple_Pack(3, __pyx_mstate_global->__pyx_n_u_Slot, __pyx_t_5, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_4 = __Pyx_PyTuple_GET_ITEM(__pyx_t_11, 1);
  if (unlikely(!CYTHON_ASSUME_SAFE_MACROS && !__pyx_t_4)) __PYX_ERR(0, 319, __pyx_L1_error)
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_12 = ((PyTypeObject*)__Pyx_PyTuple_GET_ITEM(__pyx_t_4, 0));
  if (unlikely(!CYTHON_ASSUME_SAFE_MACROS && !__pyx_t_12)) __PYX_ERR(0, 319, __pyx_L1_error)
  #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  if (__Pyx_get_runtime_version() < 0x030A0000) {
    __pyx_t_5 = PyObject_GetAttrString((PyObject*)&PyType_Type, "__new__");
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 319, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_13 = PyTuple_Pack(1, (PyObject*)&PyType_Type);
    if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 319, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_14 = PyNumber_Add(__pyx_t_13, __pyx_t_11);
    if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 319, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_10 = PyObject_Call(__pyx_t_5, __pyx_t_14, NULL);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  } else
  #endif
  __pyx_t_10 = __Pyx_PyType_GetSlot(&PyType_Type, tp_new, newfunc)(&PyType_Type, __pyx_t_11, NULL);
  if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (__Pyx_PyType_GetSlot((PyTypeObject*) __pyx_t_10, tp_base, PyTypeObject*) != __pyx_t_12) {
    __Pyx_TypeName base_name = __Pyx_PyType_GetFullyQualifiedName(__Pyx_PyType_GetSlot((PyTypeObject*) __pyx_t_10, tp_base, PyTypeObject*));
    __Pyx_TypeName type_name = __Pyx_PyType_GetFullyQualifiedName(__pyx_t_12);
    PyErr_Format(PyExc_TypeError, "best base '" __Pyx_FMT_TYPENAME "' must be equal to first base '" __Pyx_FMT_TYPENAME "'",
                 base_name, type_name);
    __Pyx_DECREF_TypeName(base_name);
    __Pyx_DECREF_TypeName(type_name);
    __PYX_ERR(0, 319, __pyx_L1_error)
  }
  __pyx_t_12 = NULL;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  #if CYTHON_USE_TYPE_SPECS
  if (__Pyx_validate_bases_tuple(__pyx_type_6pkcs11_7_pkcs11_Slot_spec.name, 0, __pyx_t_4) < (0)) __PYX_ERR(0, 319, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Slot = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6pkcs11_7_pkcs11_Slot_spec, __pyx_t_4);
  if (unlikely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Slot)) __PYX_ERR(0, 319, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6pkcs11_7_pkcs11_Slot_spec, __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Slot) < (0)) __PYX_ERR(0, 319, __pyx_L1_error)
  #else
  __Pyx_INCREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_type_6pkcs11_7_pkcs11_Slot.tp_bases = __pyx_t_4;
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Slot = &__pyx_type_6pkcs11_7_pkcs11_Slot;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Slot->tp_base = __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Slot) < (0)) __PYX_ERR(0, 319, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Slot);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Slot->tp_dictoffset && __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Slot->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Slot->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Slot, __pyx_vtabptr_6pkcs11_7_pkcs11_Slot) < (0)) __PYX_ERR(0, 319, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Slot) < (0)) __PYX_ERR(0, 319, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Slot, (PyObject *) __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Slot) < (0)) __PYX_ERR(0, 319, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Slot) < (0)) __PYX_ERR(0, 319, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":370
 *         return _CK_VERSION_to_tuple(self._cryptoki_version)
 * 
 *     def get_token(self):             # <<<<<<<<<<<<<<
 *         cdef CK_SLOT_ID slot_id = self.slot_id
 *         cdef CK_TOKEN_INFO info
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_4Slot_3get_token, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Slot_get_token, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[14])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 370, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Slot, __pyx_mstate_global->__pyx_n_u_get_token, __pyx_t_4) < (0)) __PYX_ERR(0, 370, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":381
 *         return Token.make(self, info)
 * 
 *     def get_mechanisms(self):             # <<<<<<<<<<<<<<
 *         cdef CK_SLOT_ID slot_id = self.slot_id
 *         cdef CK_ULONG count
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_4Slot_5get_mechanisms, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Slot_get_mechanisms, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[15])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Slot, __pyx_mstate_global->__pyx_n_u_get_mechanisms, __pyx_t_4) < (0)) __PYX_ERR(0, 381, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":401
 *         return set(map(_CK_MECHANISM_TYPE_to_enum, mechanisms))
 * 
 *     def get_mechanism_info(self, mechanism):             # <<<<<<<<<<<<<<
 *         cdef CK_SLOT_ID slot_id = self.slot_id
 *         cdef CK_MECHANISM_TYPE mech_type = mechanism
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_4Slot_7get_mechanism_info, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Slot_get_mechanism_info, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[16])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 401, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Slot, __pyx_mstate_global->__pyx_n_u_get_mechanism_info, __pyx_t_4) < (0)) __PYX_ERR(0, 401, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":413
 *         return types.MechanismInfo(self, mechanism, **info)
 * 
 *     def _identity(self):             # <<<<<<<<<<<<<<
 *         return Slot.__name__, self.slot_id
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_4Slot_9_identity, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Slot__identity, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[17])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 413, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Slot, __pyx_mstate_global->__pyx_n_u_identity_2, __pyx_t_4) < (0)) __PYX_ERR(0, 413, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_4Slot_15__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Slot___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[18])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_4) < (0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_4Slot_17__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Slot___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[19])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < (0)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":433
 * 
 * 
 * cdef class Token(HasFuncList, types.Token):             # <<<<<<<<<<<<<<
 *     """Extend Token with implementation."""
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_types); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_Token); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = PyTuple_Pack(2, ((PyObject *)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList), __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_14 = PyTuple_Pack(3, __pyx_mstate_global->__pyx_n_u_Token, __pyx_t_11, __pyx_t_10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_4 = __Pyx_PyTuple_GET_ITEM(__pyx_t_14, 1);
  if (unlikely(!CYTHON_ASSUME_SAFE_MACROS && !__pyx_t_4)) __PYX_ERR(0, 433, __pyx_L1_error)
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_12 = ((PyTypeObject*)__Pyx_PyTuple_GET_ITEM(__pyx_t_4, 0));
  if (unlikely(!CYTHON_ASSUME_SAFE_MACROS && !__pyx_t_12)) __PYX_ERR(0, 433, __pyx_L1_error)
  #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  if (__Pyx_get_runtime_version() < 0x030A0000) {
    __pyx_t_11 = PyObject_GetAttrString((PyObject*)&PyType_Type, "__new__");
    if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 433, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_13 = PyTuple_Pack(1, (PyObject*)&PyType_Type);
    if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 433, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_5 = PyNumber_Add(__pyx_t_13, __pyx_t_14);
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 433, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_10 = PyObject_Call(__pyx_t_11, __pyx_t_5, NULL);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  __pyx_t_10 = __Pyx_PyType_GetSlot(&PyType_Type, tp_new, newfunc)(&PyType_Type, __pyx_t_14, NULL);
  if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (__Pyx_PyType_GetSlot((PyTypeObject*) __pyx_t_10, tp_base, PyTypeObject*) != __pyx_t_12) {
    __Pyx_TypeName base_name = __Pyx_PyType_GetFullyQualifiedName(__Pyx_PyType_GetSlot((PyTypeObject*) __pyx_t_10, tp_base, PyTypeObject*));
    __Pyx_TypeName type_name = __Pyx_PyType_GetFullyQualifiedName(__pyx_t_12);
    PyErr_Format(PyExc_TypeError, "best base '" __Pyx_FMT_TYPENAME "' must be equal to first base '" __Pyx_FMT_TYPENAME "'",
                 base_name, type_name);
    __Pyx_DECREF_TypeName(base_name);
    __Pyx_DECREF_TypeName(type_name);
    __PYX_ERR(0, 433, __pyx_L1_error)
  }
  __pyx_t_12 = NULL;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  #if CYTHON_USE_TYPE_SPECS
  if (__Pyx_validate_bases_tuple(__pyx_type_6pkcs11_7_pkcs11_Token_spec.name, 0, __pyx_t_4) < (0)) __PYX_ERR(0, 433, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Token = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6pkcs11_7_pkcs11_Token_spec, __pyx_t_4);
  if (unlikely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Token)) __PYX_ERR(0, 433, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6pkcs11_7_pkcs11_Token_spec, __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Token) < (0)) __PYX_ERR(0, 433, __pyx_L1_error)
  #else
  __Pyx_INCREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_type_6pkcs11_7_pkcs11_Token.tp_bases = __pyx_t_4;
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Token = &__pyx_type_6pkcs11_7_pkcs11_Token;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Token->tp_base = __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Token) < (0)) __PYX_ERR(0, 433, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Token);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Token->tp_dictoffset && __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Token->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Token->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Token, __pyx_vtabptr_6pkcs11_7_pkcs11_Token) < (0)) __PYX_ERR(0, 433, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Token) < (0)) __PYX_ERR(0, 433, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Token, (PyObject *) __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Token) < (0)) __PYX_ERR(0, 433, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Token) < (0)) __PYX_ERR(0, 433, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":489
 *             user_type=None,
 *             attribute_mapper=None,
 *             cancel_strategy=CancelStrategy.DEFAULT             # <<<<<<<<<<<<<<
 *     ):
 *         cdef CK_SLOT_ID slot_id = self.slot.slot_id
*/
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_CancelStrategy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_DEFAULT); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_mstate_global->__pyx_k__9 = __pyx_t_14;
  __Pyx_GIVEREF(__pyx_t_14);
  __pyx_t_14 = 0;

  /* "pkcs11/_pkcs11.pyx":488
 *             so_pin=None,
 *             user_type=None,
 *             attribute_mapper=None,             # <<<<<<<<<<<<<<
 *             cancel_strategy=CancelStrategy.DEFAULT
 *     ):
*/
  __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_CancelStrategy); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);

  /* "pkcs11/_pkcs11.pyx":489
 *             user_type=None,
 *             attribute_mapper=None,
 *             cancel_strategy=CancelStrategy.DEFAULT             # <<<<<<<<<<<<<<
 *     ):
 *         cdef CK_SLOT_ID slot_id = self.slot.slot_id
*/
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_DEFAULT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "pkcs11/_pkcs11.pyx":482
 *         return _CK_VERSION_to_tuple(self._fw_version)
 * 
 *     def open(             # <<<<<<<<<<<<<<
 *             self,
 *             rw=False,
*/
  __pyx_t_14 = PyTuple_Pack(6, Py_False, Py_None, Py_None, Py_None, Py_None, __pyx_t_4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_5Token_3open, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Token_open, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[20])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_t_14);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Token, __pyx_mstate_global->__pyx_n_u_open, __pyx_t_4) < (0)) __PYX_ERR(0, 482, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":551
 *         return self.label
 * 
 *     def _identity(self):             # <<<<<<<<<<<<<<
 *         return Token.__name__, self.slot
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_5Token_7_identity, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Token__identity, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[21])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Token, __pyx_mstate_global->__pyx_n_u_identity_2, __pyx_t_4) < (0)) __PYX_ERR(0, 551, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_5Token_11__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Token___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[22])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_4) < (0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_5Token_13__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Token___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[23])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < (0)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":571
 *         pass
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         self.session.operation_lock.acquire()
 *         self.active = True
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_16OperationContext_5__enter__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_OperationContext___enter, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[24])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_OperationContext, __pyx_mstate_global->__pyx_n_u_enter, __pyx_t_4) < (0)) __PYX_ERR(0, 571, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":577
 *         return self
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         self._finalize(silent=False)
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_16OperationContext_7__exit__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_OperationContext___exit, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[25])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 577, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_OperationContext, __pyx_mstate_global->__pyx_n_u_exit, __pyx_t_4) < (0)) __PYX_ERR(0, 577, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":593
 *             self._handle_final_retval(retval)
 * 
 *     def _initiate(self):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_16OperationContext_9_initiate, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_OperationContext__initiate, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[26])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 593, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_OperationContext, __pyx_mstate_global->__pyx_n_u_initiate, __pyx_t_4) < (0)) __PYX_ERR(0, 593, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":596
 *         raise NotImplementedError
 * 
 *     def _finalize(self, silent=False):             # <<<<<<<<<<<<<<
 *         if self.active:
 *             self.active = False
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_16OperationContext_11_finalize, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_OperationContext__finalize, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[27])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 596, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[3]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_OperationContext, __pyx_mstate_global->__pyx_n_u_finalize, __pyx_t_4) < (0)) __PYX_ERR(0, 596, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_16OperationContext_15__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_OperationContext___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[28])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_4) < (0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_16OperationContext_17__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_OperationContext___setstate_cyth, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[29])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < (0)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_1__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_OperationWithBinaryOutput___redu, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[30])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_4) < (0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_25OperationWithBinaryOutput_3__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_OperationWithBinaryOutput___sets, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[31])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < (0)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":733
 *         return self
 * 
 *     def _batch_iter(self, results, count):             # <<<<<<<<<<<<<<
 *         for ix in range(count):
 *             yield make_object(self.session, results[ix])
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_10SearchIter_5_batch_iter, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_SearchIter__batch_iter, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 733, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_SearchIter, __pyx_mstate_global->__pyx_n_u_batch_iter, __pyx_t_4) < (0)) __PYX_ERR(0, 733, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":756
 *             return self._batch_iter(results, count)
 * 
 *     def _initiate(self):             # <<<<<<<<<<<<<<
 *         cdef CK_SESSION_HANDLE handle = self.session.handle
 *         cdef CK_ATTRIBUTE *attr_data = self.template.data
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_10SearchIter_10_initiate, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_SearchIter__initiate, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[32])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 756, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_SearchIter, __pyx_mstate_global->__pyx_n_u_initiate, __pyx_t_4) < (0)) __PYX_ERR(0, 756, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":766
 *         assertRV(retval)
 * 
 *     def _finalize(self, silent=False):             # <<<<<<<<<<<<<<
 *         """Finish the operation."""
 *         cdef CK_SESSION_HANDLE handle = self.session.handle
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_10SearchIter_12_finalize, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_SearchIter__finalize, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[33])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 766, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[3]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_SearchIter, __pyx_mstate_global->__pyx_n_u_finalize, __pyx_t_4) < (0)) __PYX_ERR(0, 766, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_10SearchIter_14__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_SearchIter___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[34])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_4) < (0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_10SearchIter_16__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_SearchIter___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[35])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < (0)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":791
 *         return op
 * 
 *     def _initiate(self):             # <<<<<<<<<<<<<<
 *         cdef CK_RV retval
 *         with nogil:
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_15DigestOperation_1_initiate, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DigestOperation__initiate, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[36])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 791, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_DigestOperation, __pyx_mstate_global->__pyx_n_u_initiate, __pyx_t_4) < (0)) __PYX_ERR(0, 791, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":810
 *         self._operation_aware_assert(retval)
 * 
 *     def ingest_chunks(self, chunks):             # <<<<<<<<<<<<<<
 *         cdef CK_BYTE *data_ptr
 *         cdef CK_ULONG data_len
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_15DigestOperation_3ingest_chunks, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DigestOperation_ingest_chunks, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[37])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 810, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_DigestOperation, __pyx_mstate_global->__pyx_n_u_ingest_chunks, __pyx_t_4) < (0)) __PYX_ERR(0, 810, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":829
 *         return self.finish_with_output(self.session.funclist.C_DigestFinal)
 * 
 *     def _finalize(self, silent=False):             # <<<<<<<<<<<<<<
 *         cdef Session session = self.session
 *         if self.active:
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_15DigestOperation_5_finalize, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DigestOperation__finalize, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[38])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 829, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[3]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_DigestOperation, __pyx_mstate_global->__pyx_n_u_finalize, __pyx_t_4) < (0)) __PYX_ERR(0, 829, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_15DigestOperation_7__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DigestOperation___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[39])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_4) < (0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_15DigestOperation_9__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DigestOperation___setstate_cytho, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[40])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < (0)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":836
 * 
 * 
 * def merge_templates(default_template, *user_templates):             # <<<<<<<<<<<<<<
 *     template = default_template.copy()
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_1merge_templates, 0, __pyx_mstate_global->__pyx_n_u_merge_templates, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[41])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 836, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_merge_templates, __pyx_t_4) < (0)) __PYX_ERR(0, 836, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":850
 * 
 * 
 * cdef class Session(HasFuncList, types.Session):             # <<<<<<<<<<<<<<
 *     """Extend Session with implementation."""
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_types); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 850, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_Session); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 850, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_14 = PyTuple_Pack(2, ((PyObject *)__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList), __pyx_t_10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 850, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 850, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_5 = PyTuple_Pack(3, __pyx_mstate_global->__pyx_n_u_Session, __pyx_t_14, __pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 850, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_4 = __Pyx_PyTuple_GET_ITEM(__pyx_t_5, 1);
  if (unlikely(!CYTHON_ASSUME_SAFE_MACROS && !__pyx_t_4)) __PYX_ERR(0, 850, __pyx_L1_error)
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_12 = ((PyTypeObject*)__Pyx_PyTuple_GET_ITEM(__pyx_t_4, 0));
  if (unlikely(!CYTHON_ASSUME_SAFE_MACROS && !__pyx_t_12)) __PYX_ERR(0, 850, __pyx_L1_error)
  #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  if (__Pyx_get_runtime_version() < 0x030A0000) {
    __pyx_t_14 = PyObject_GetAttrString((PyObject*)&PyType_Type, "__new__");
    if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 850, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_13 = PyTuple_Pack(1, (PyObject*)&PyType_Type);
    if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 850, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_11 = PyNumber_Add(__pyx_t_13, __pyx_t_5);
    if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 850, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_10 = PyObject_Call(__pyx_t_14, __pyx_t_11, NULL);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  } else
  #endif
  __pyx_t_10 = __Pyx_PyType_GetSlot(&PyType_Type, tp_new, newfunc)(&PyType_Type, __pyx_t_5, NULL);
  if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 850, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (__Pyx_PyType_GetSlot((PyTypeObject*) __pyx_t_10, tp_base, PyTypeObject*) != __pyx_t_12) {
    __Pyx_TypeName base_name = __Pyx_PyType_GetFullyQualifiedName(__Pyx_PyType_GetSlot((PyTypeObject*) __pyx_t_10, tp_base, PyTypeObject*));
    __Pyx_TypeName type_name = __Pyx_PyType_GetFullyQualifiedName(__pyx_t_12);
    PyErr_Format(PyExc_TypeError, "best base '" __Pyx_FMT_TYPENAME "' must be equal to first base '" __Pyx_FMT_TYPENAME "'",
                 base_name, type_name);
    __Pyx_DECREF_TypeName(base_name);
    __Pyx_DECREF_TypeName(type_name);
    __PYX_ERR(0, 850, __pyx_L1_error)
  }
  __pyx_t_12 = NULL;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  #if CYTHON_USE_TYPE_SPECS
  if (__Pyx_validate_bases_tuple(__pyx_type_6pkcs11_7_pkcs11_Session_spec.name, 0, __pyx_t_4) < (0)) __PYX_ERR(0, 850, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Session = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6pkcs11_7_pkcs11_Session_spec, __pyx_t_4);
  if (unlikely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Session)) __PYX_ERR(0, 850, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6pkcs11_7_pkcs11_Session_spec, __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Session) < (0)) __PYX_ERR(0, 850, __pyx_L1_error)
  #else
  __Pyx_INCREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_type_6pkcs11_7_pkcs11_Session.tp_bases = __pyx_t_4;
  __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Session = &__pyx_type_6pkcs11_7_pkcs11_Session;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Session->tp_base = __pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_HasFuncList;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Session) < (0)) __PYX_ERR(0, 850, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Session);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Session->tp_dictoffset && __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Session->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Session->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Session, __pyx_vtabptr_6pkcs11_7_pkcs11_Session) < (0)) __PYX_ERR(0, 850, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Session) < (0)) __PYX_ERR(0, 850, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Session, (PyObject *) __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Session) < (0)) __PYX_ERR(0, 850, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6pkcs11_7_pkcs11_Session) < (0)) __PYX_ERR(0, 850, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":890
 *         raise TypeError
 * 
 *     def _identity(self):             # <<<<<<<<<<<<<<
 *         return Session.__name__, self.token, self.handle
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_7Session_3_identity, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Session__identity, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[42])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Session, __pyx_mstate_global->__pyx_n_u_identity_2, __pyx_t_4) < (0)) __PYX_ERR(0, 890, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":902
 *             return self._user_type
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         cdef CK_SESSION_HANDLE handle = self.handle
 *         cdef CK_RV retval
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_7Session_5close, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Session_close, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[43])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 902, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Session, __pyx_mstate_global->__pyx_n_u_close, __pyx_t_4) < (0)) __PYX_ERR(0, 902, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":915
 *         assertRV(retval)
 * 
 *     def get_objects(self, attrs=None, batch_size=10):             # <<<<<<<<<<<<<<
 *         with SearchIter(self, attrs or {}, batch_size) as op:
 *             for batch in op:
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_7Session_7get_objects, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Session_get_objects, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 915, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[4]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Session, __pyx_mstate_global->__pyx_n_u_get_objects, __pyx_t_4) < (0)) __PYX_ERR(0, 915, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":920
 *                 yield from batch
 * 
 *     def reaffirm_credentials(self, pin):             # <<<<<<<<<<<<<<
 *         cdef CK_UTF8CHAR *pin_data
 *         cdef CK_ULONG pin_length
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_7Session_10reaffirm_credentials, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Session_reaffirm_credentials, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[44])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 920, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Session, __pyx_mstate_global->__pyx_n_u_reaffirm_credentials, __pyx_t_4) < (0)) __PYX_ERR(0, 920, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":933
 *         assertRV(retval)
 * 
 *     def create_object(self, attrs):             # <<<<<<<<<<<<<<
 *         template = self.make_attribute_list(attrs)
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_7Session_12create_object, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Session_create_object, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[45])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 933, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Session, __pyx_mstate_global->__pyx_n_u_create_object, __pyx_t_4) < (0)) __PYX_ERR(0, 933, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":948
 *         return make_object(self, new)
 * 
 *     def create_domain_parameters(self, key_type, attrs,             # <<<<<<<<<<<<<<
 *                                  local=False, store=False):
 *         if local and store:
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_7Session_14create_domain_parameters, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Session_create_domain_parameters, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[46])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 948, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[5]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Session, __pyx_mstate_global->__pyx_n_u_create_domain_parameters, __pyx_t_4) < (0)) __PYX_ERR(0, 948, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":963
 *             return self.create_object(attrs)
 * 
 *     def generate_domain_parameters(self, key_type, param_length, store=False,             # <<<<<<<<<<<<<<
 *                                    mechanism=None, mechanism_param=None,
 *                                    template=None):
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_7Session_16generate_domain_parameters, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Session_generate_domain_paramete, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[47])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 963, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[6]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Session, __pyx_mstate_global->__pyx_n_u_generate_domain_parameters, __pyx_t_4) < (0)) __PYX_ERR(0, 963, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":988
 *         return AttributeList.from_template(dict(template), self.attribute_mapper)
 * 
 *     def generate_key(self, key_type, key_length=None,             # <<<<<<<<<<<<<<
 *                      id=None, label=None,
 *                      store=False, capabilities=None,
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_7Session_18generate_key, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Session_generate_key, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[48])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 988, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[7]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Session, __pyx_mstate_global->__pyx_n_u_generate_key, __pyx_t_4) < (0)) __PYX_ERR(0, 988, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":1041
 * 
 * 
 *     def _generate_keypair(self, key_type, key_length=None,             # <<<<<<<<<<<<<<
 *                           id=None, label=None,
 *                           store=False, capabilities=None,
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_7Session_20_generate_keypair, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Session__generate_keypair, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[49])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[8]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Session, __pyx_mstate_global->__pyx_n_u_generate_keypair, __pyx_t_4) < (0)) __PYX_ERR(0, 1041, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":1118
 *                 make_object(self, private_key))
 * 
 *     def seed_random(self, seed):             # <<<<<<<<<<<<<<
 *         cdef CK_SESSION_HANDLE handle = self.handle
 *         cdef CK_BYTE *seed_data = seed
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_7Session_22seed_random, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Session_seed_random, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[50])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Session, __pyx_mstate_global->__pyx_n_u_seed_random, __pyx_t_4) < (0)) __PYX_ERR(0, 1118, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":1128
 *         assertRV(retval)
 * 
 *     def generate_random(self, nbits):             # <<<<<<<<<<<<<<
 *         cdef CK_SESSION_HANDLE handle = self.handle
 *         cdef CK_ULONG length = nbits // 8
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_7Session_24generate_random, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Session_generate_random, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[51])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1128, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Session, __pyx_mstate_global->__pyx_n_u_generate_random, __pyx_t_4) < (0)) __PYX_ERR(0, 1128, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":1140
 *         return bytes(random)
 * 
 *     def __digest_operation(self, mechanism, mechanism_param):             # <<<<<<<<<<<<<<
 *         mech = MechanismWithParam(
 *             None, {},
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_7Session_26_Session__digest_operation, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Session___digest_operation, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[52])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Session, __pyx_mstate_global->__pyx_n_u_Session__digest_operation, __pyx_t_4) < (0)) __PYX_ERR(0, 1140, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":1146
 *         return DigestOperation.setup(self, mech, 1024)
 * 
 *     def _digest(self, data, mechanism=None, mechanism_param=None):             # <<<<<<<<<<<<<<
 *         cdef CK_BYTE *data_ptr = data
 *         cdef CK_ULONG data_len = <CK_ULONG> len(data)
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_7Session_28_digest, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Session__digest, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[53])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1146, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[9]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Session, __pyx_mstate_global->__pyx_n_u_digest, __pyx_t_4) < (0)) __PYX_ERR(0, 1146, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":1155
 *             return op.digest_process_fully(data_ptr, data_len)
 * 
 *     def _digest_generator(self, data, mechanism=None, mechanism_param=None):             # <<<<<<<<<<<<<<
 * 
 *         cdef DigestOperation op = self.__digest_operation(mechanism, mechanism_param)
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_7Session_30_digest_generator, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Session__digest_generator, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[54])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[9]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Session, __pyx_mstate_global->__pyx_n_u_digest_generator, __pyx_t_4) < (0)) __PYX_ERR(0, 1155, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":1162
 *             return op.finish()
 * 
 *     def set_pin(self, old_pin, new_pin):             # <<<<<<<<<<<<<<
 *         cdef CK_ULONG old_pin_length
 *         cdef CK_ULONG new_pin_length
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_7Session_32set_pin, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Session_set_pin, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[55])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Session, __pyx_mstate_global->__pyx_n_u_set_pin, __pyx_t_4) < (0)) __PYX_ERR(0, 1162, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":1182
 *         assertRV(retval)
 * 
 *     def init_pin(self, pin):             # <<<<<<<<<<<<<<
 *         cdef CK_OBJECT_HANDLE handle = self.handle
 *         cdef CK_UTF8CHAR *pin_data
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_7Session_34init_pin, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Session_init_pin, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[56])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_Session, __pyx_mstate_global->__pyx_n_u_init_pin, __pyx_t_4) < (0)) __PYX_ERR(0, 1182, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_7Session_36__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Session___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[57])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_4) < (0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_7Session_38__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Session___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[58])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < (0)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":1282
 *         assertRV(retval)
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         cdef CK_SESSION_HANDLE handle = self.session.handle
 *         cdef CK_OBJECT_HANDLE obj = self.handle
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_19ObjectHandleWrapper_7destroy, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ObjectHandleWrapper_destroy, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[59])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_ObjectHandleWrapper, __pyx_mstate_global->__pyx_n_u_destroy, __pyx_t_4) < (0)) __PYX_ERR(0, 1282, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":1291
 *         assertRV(retval)
 * 
 *     def copy(self, attrs):             # <<<<<<<<<<<<<<
 *         template = self.session.make_attribute_list(attrs)
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_19ObjectHandleWrapper_9copy, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ObjectHandleWrapper_copy, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[60])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_ObjectHandleWrapper, __pyx_mstate_global->__pyx_n_u_copy, __pyx_t_4) < (0)) __PYX_ERR(0, 1291, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":1306
 *         return new_obj
 * 
 *     def identity(self):             # <<<<<<<<<<<<<<
 *         return ObjectHandleWrapper.__name__, self.session, self.handle
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_19ObjectHandleWrapper_11identity, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ObjectHandleWrapper_identity, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[61])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_ObjectHandleWrapper, __pyx_mstate_global->__pyx_n_u_identity, __pyx_t_4) < (0)) __PYX_ERR(0, 1306, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_19ObjectHandleWrapper_13__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ObjectHandleWrapper___reduce_cyt, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[62])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_4) < (0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_19ObjectHandleWrapper_15__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ObjectHandleWrapper___setstate_c, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[63])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < (0)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":1310
 * 
 * 
 * class Object(types.Object):             # <<<<<<<<<<<<<<
 *     """Expand Object with an implementation."""
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_types); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Object); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_Pack(1, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PEP560_update_bases(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_10 = __Pyx_CalculateMetaclass(NULL, __pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = __Pyx_Py3MetaclassPrepare(__pyx_t_10, __pyx_t_5, __pyx_mstate_global->__pyx_n_u_Object, __pyx_mstate_global->__pyx_n_u_Object, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_kp_u_Expand_Object_with_an_implementa); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  if (__pyx_t_5 != __pyx_t_4) {
    if (unlikely((PyDict_SetItemString(__pyx_t_11, "__orig_bases__", __pyx_t_4) < 0))) __PYX_ERR(0, 1310, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pkcs11/_pkcs11.pyx":1313
 *     """Expand Object with an implementation."""
 * 
 *     def __init__(self, wrapper: ObjectHandleWrapper):             # <<<<<<<<<<<<<<
 *         self.wrapper = wrapper
 * 
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_wrapper, __pyx_mstate_global->__pyx_n_u_ObjectHandleWrapper) < (0)) __PYX_ERR(0, 1313, __pyx_L1_error)
  __pyx_t_13 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_6Object_1__init__, 0, __pyx_mstate_global->__pyx_n_u_Object___init, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[64])); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_13);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_13, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_init, __pyx_t_13) < (0)) __PYX_ERR(0, 1313, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "pkcs11/_pkcs11.pyx":1316
 *         self.wrapper = wrapper
 * 
 *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
 *         return self.wrapper[item]
 * 
*/
  __pyx_t_13 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_6Object_3__getitem__, 0, __pyx_mstate_global->__pyx_n_u_Object___getitem, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[65])); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1316, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_13);
  #endif
  if (__Pyx_SetNameInClass(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_getitem, __pyx_t_13) < (0)) __PYX_ERR(0, 1316, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "pkcs11/_pkcs11.pyx":1319
 *         return self.wrapper[item]
 * 
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         self.wrapper[key] = value
 * 
*/
  __pyx_t_13 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_6Object_5__setitem__, 0, __pyx_mstate_global->__pyx_n_u_Object___setitem, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[66])); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_13);
  #endif
  if (__Pyx_SetNameInClass(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_setitem, __pyx_t_13) < (0)) __PYX_ERR(0, 1319, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "pkcs11/_pkcs11.pyx":1322
 *         self.wrapper[key] = value
 * 
 *     def get_attributes(self, keys):             # <<<<<<<<<<<<<<
 *         cdef ObjectHandleWrapper wrapper = self.wrapper
 *         cdef CK_ULONG total = len(keys)
*/
  __pyx_t_13 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_6Object_7get_attributes, 0, __pyx_mstate_global->__pyx_n_u_Object_get_attributes, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[67])); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1322, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_13);
  #endif
  if (__Pyx_SetNameInClass(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_get_attributes, __pyx_t_13) < (0)) __PYX_ERR(0, 1322, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "pkcs11/_pkcs11.pyx":1340
 *         return result
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def session(self):
 *         return self.wrapper.session
*/
  __pyx_t_4 = NULL;
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_6Object_9session, 0, __pyx_mstate_global->__pyx_n_u_Object_session, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[68])); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1340, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_14);
  #endif
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_14};
    __pyx_t_13 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_property, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1340, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
  }
  if (__Pyx_SetNameInClass(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_session, __pyx_t_13) < (0)) __PYX_ERR(0, 1340, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "pkcs11/_pkcs11.pyx":1344
 *         return self.wrapper.session
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def handle(self):
 *         return self.wrapper.handle
*/
  __pyx_t_14 = NULL;
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_6Object_11handle, 0, __pyx_mstate_global->__pyx_n_u_Object_handle, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[69])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
  #endif
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_t_4};
    __pyx_t_13 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_property, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1344, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
  }
  if (__Pyx_SetNameInClass(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_handle, __pyx_t_13) < (0)) __PYX_ERR(0, 1344, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "pkcs11/_pkcs11.pyx":1348
 *         return self.wrapper.handle
 * 
 *     def copy(self, attrs):             # <<<<<<<<<<<<<<
 *         new_obj = self.wrapper.copy(attrs)
 *         return make_object(self.wrapper.session, new_obj)
*/
  __pyx_t_13 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_6Object_13copy, 0, __pyx_mstate_global->__pyx_n_u_Object_copy, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[70])); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_13);
  #endif
  if (__Pyx_SetNameInClass(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_copy, __pyx_t_13) < (0)) __PYX_ERR(0, 1348, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "pkcs11/_pkcs11.pyx":1352
 *         return make_object(self.wrapper.session, new_obj)
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         self.wrapper.destroy()
 * 
*/
  __pyx_t_13 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_6Object_15destroy, 0, __pyx_mstate_global->__pyx_n_u_Object_destroy, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[71])); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_13);
  #endif
  if (__Pyx_SetNameInClass(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_destroy, __pyx_t_13) < (0)) __PYX_ERR(0, 1352, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "pkcs11/_pkcs11.pyx":1355
 *         self.wrapper.destroy()
 * 
 *     def _identity(self):             # <<<<<<<<<<<<<<
 *         return Object.__name__, self.wrapper.identity()
 * 
*/
  __pyx_t_13 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_6Object_17_identity, 0, __pyx_mstate_global->__pyx_n_u_Object__identity, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[72])); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_13);
  #endif
  if (__Pyx_SetNameInClass(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_identity_2, __pyx_t_13) < (0)) __PYX_ERR(0, 1355, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "pkcs11/_pkcs11.pyx":1310
 * 
 * 
 * class Object(types.Object):             # <<<<<<<<<<<<<<
 *     """Expand Object with an implementation."""
 * 
*/
  __pyx_t_13 = __Pyx_Py3ClassCreate(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_Object, __pyx_t_5, __pyx_t_11, NULL, 0, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_13);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Object, __pyx_t_13) < (0)) __PYX_ERR(0, 1310, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":1420
 * 
 * 
 * class SecretKey(types.SecretKey):             # <<<<<<<<<<<<<<
 *     pass
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_types); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_SecretKey); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_Pack(1, __pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PEP560_update_bases(__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = __Pyx_CalculateMetaclass(NULL, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_13 = __Pyx_Py3MetaclassPrepare(__pyx_t_11, __pyx_t_10, __pyx_mstate_global->__pyx_n_u_SecretKey, __pyx_mstate_global->__pyx_n_u_SecretKey, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, (PyObject *) NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  if (__pyx_t_10 != __pyx_t_5) {
    if (unlikely((PyDict_SetItemString(__pyx_t_13, "__orig_bases__", __pyx_t_5) < 0))) __PYX_ERR(0, 1420, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_SecretKey, __pyx_t_10, __pyx_t_13, NULL, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_SecretKey, __pyx_t_5) < (0)) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "pkcs11/_pkcs11.pyx":1424
 * 
 * 
 * class PublicKey(types.PublicKey):             # <<<<<<<<<<<<<<
 *     pass
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_types); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_PublicKey); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyTuple_Pack(1, __pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = __Pyx_PEP560_update_bases(__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_13 = __Pyx_CalculateMetaclass(NULL, __pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_5 = __Pyx_Py3MetaclassPrepare(__pyx_t_13, __pyx_t_11, __pyx_mstate_global->__pyx_n_u_PublicKey, __pyx_mstate_global->__pyx_n_u_PublicKey, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, (PyObject *) NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_11 != __pyx_t_10) {
    if (unlikely((PyDict_SetItemString(__pyx_t_5, "__orig_bases__", __pyx_t_10) < 0))) __PYX_ERR(0, 1424, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_Py3ClassCreate(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_PublicKey, __pyx_t_11, __pyx_t_5, NULL, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_10);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_PublicKey, __pyx_t_10) < (0)) __PYX_ERR(0, 1424, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "pkcs11/_pkcs11.pyx":1428
 * 
 * 
 * class PrivateKey(types.PrivateKey):             # <<<<<<<<<<<<<<
 *     pass
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_types); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1428, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_PrivateKey); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1428, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = PyTuple_Pack(1, __pyx_t_13); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1428, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = __Pyx_PEP560_update_bases(__pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1428, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_5 = __Pyx_CalculateMetaclass(NULL, __pyx_t_13); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1428, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_10 = __Pyx_Py3MetaclassPrepare(__pyx_t_5, __pyx_t_13, __pyx_mstate_global->__pyx_n_u_PrivateKey, __pyx_mstate_global->__pyx_n_u_PrivateKey, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, (PyObject *) NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1428, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (__pyx_t_13 != __pyx_t_11) {
    if (unlikely((PyDict_SetItemString(__pyx_t_10, "__orig_bases__", __pyx_t_11) < 0))) __PYX_ERR(0, 1428, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = __Pyx_Py3ClassCreate(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_PrivateKey, __pyx_t_13, __pyx_t_10, NULL, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1428, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_PrivateKey, __pyx_t_11) < (0)) __PYX_ERR(0, 1428, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "pkcs11/_pkcs11.pyx":1432
 * 
 * 
 * class GenerateWithParametersMixin(types.DomainParameters):             # <<<<<<<<<<<<<<
 *     def generate_keypair(self,
 *                          id=None, label=None,
*/
  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_types); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1432, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_DomainParameters); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1432, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = PyTuple_Pack(1, __pyx_t_5); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1432, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PEP560_update_bases(__pyx_t_13); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1432, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_10 = __Pyx_CalculateMetaclass(NULL, __pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1432, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = __Pyx_Py3MetaclassPrepare(__pyx_t_10, __pyx_t_5, __pyx_mstate_global->__pyx_n_u_GenerateWithParametersMixin, __pyx_mstate_global->__pyx_n_u_GenerateWithParametersMixin, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, (PyObject *) NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1432, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  if (__pyx_t_5 != __pyx_t_13) {
    if (unlikely((PyDict_SetItemString(__pyx_t_11, "__orig_bases__", __pyx_t_13) < 0))) __PYX_ERR(0, 1432, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "pkcs11/_pkcs11.pyx":1433
 * 
 * class GenerateWithParametersMixin(types.DomainParameters):
 *     def generate_keypair(self,             # <<<<<<<<<<<<<<
 *                          id=None, label=None,
 *                          store=False, capabilities=None,
*/
  __pyx_t_13 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_27GenerateWithParametersMixin_1generate_keypair, 0, __pyx_mstate_global->__pyx_n_u_GenerateWithParametersMixin_gene, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[73])); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_13);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_13, __pyx_mstate_global->__pyx_tuple[10]);
  if (__Pyx_SetNameInClass(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_generate_keypair_2, __pyx_t_13) < (0)) __PYX_ERR(0, 1433, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "pkcs11/_pkcs11.pyx":1432
 * 
 * 
 * class GenerateWithParametersMixin(types.DomainParameters):             # <<<<<<<<<<<<<<
 *     def generate_keypair(self,
 *                          id=None, label=None,
*/
  __pyx_t_13 = __Pyx_Py3ClassCreate(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_GenerateWithParametersMixin, __pyx_t_5, __pyx_t_11, NULL, 0, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1432, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_13);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_GenerateWithParametersMixin, __pyx_t_13) < (0)) __PYX_ERR(0, 1432, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":1480
 * 
 * 
 * class LocalDomainParameters(GenerateWithParametersMixin, types.LocalDomainParameters):             # <<<<<<<<<<<<<<
 *     pass
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_GenerateWithParametersMixin); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_types); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_LocalDomainParameters); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyTuple_Pack(2, __pyx_t_5, __pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = __Pyx_PEP560_update_bases(__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_5 = __Pyx_CalculateMetaclass(NULL, __pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_13 = __Pyx_Py3MetaclassPrepare(__pyx_t_5, __pyx_t_11, __pyx_mstate_global->__pyx_n_u_LocalDomainParameters, __pyx_mstate_global->__pyx_n_u_LocalDomainParameters, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, (PyObject *) NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  if (__pyx_t_11 != __pyx_t_10) {
    if (unlikely((PyDict_SetItemString(__pyx_t_13, "__orig_bases__", __pyx_t_10) < 0))) __PYX_ERR(0, 1480, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_Py3ClassCreate(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_LocalDomainParameters, __pyx_t_11, __pyx_t_13, NULL, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_10);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_LocalDomainParameters, __pyx_t_10) < (0)) __PYX_ERR(0, 1480, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "pkcs11/_pkcs11.pyx":1483
 *     pass
 * 
 * class StoredDomainParameters(GenerateWithParametersMixin):             # <<<<<<<<<<<<<<
 *     pass
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_GenerateWithParametersMixin); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1483, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_5 = PyTuple_Pack(1, __pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1483, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = __Pyx_PEP560_update_bases(__pyx_t_5); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1483, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_13 = __Pyx_CalculateMetaclass(NULL, __pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1483, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_10 = __Pyx_Py3MetaclassPrepare(__pyx_t_13, __pyx_t_11, __pyx_mstate_global->__pyx_n_u_StoredDomainParameters, __pyx_mstate_global->__pyx_n_u_StoredDomainParameters, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, (PyObject *) NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1483, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (__pyx_t_11 != __pyx_t_5) {
    if (unlikely((PyDict_SetItemString(__pyx_t_10, "__orig_bases__", __pyx_t_5) < 0))) __PYX_ERR(0, 1483, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_StoredDomainParameters, __pyx_t_11, __pyx_t_10, NULL, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1483, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_StoredDomainParameters, __pyx_t_5) < (0)) __PYX_ERR(0, 1483, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "pkcs11/_pkcs11.pyx":1486
 *     pass
 * 
 * class Certificate(types.Certificate):             # <<<<<<<<<<<<<<
 *     pass
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_types); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_Certificate); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = PyTuple_Pack(1, __pyx_t_13); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = __Pyx_PEP560_update_bases(__pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_10 = __Pyx_CalculateMetaclass(NULL, __pyx_t_13); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_5 = __Pyx_Py3MetaclassPrepare(__pyx_t_10, __pyx_t_13, __pyx_mstate_global->__pyx_n_u_Certificate, __pyx_mstate_global->__pyx_n_u_Certificate, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, (PyObject *) NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_13 != __pyx_t_11) {
    if (unlikely((PyDict_SetItemString(__pyx_t_5, "__orig_bases__", __pyx_t_11) < 0))) __PYX_ERR(0, 1486, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = __Pyx_Py3ClassCreate(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_Certificate, __pyx_t_13, __pyx_t_5, NULL, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Certificate, __pyx_t_11) < (0)) __PYX_ERR(0, 1486, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "pkcs11/_pkcs11.pyx":1509
 *         return op
 * 
 *     def unclean_shutdown(self):             # <<<<<<<<<<<<<<
 *         """
 *         Shutdown implementation for 2.x PKCS#11 modules that don't support shutdown signalling
*/
  __pyx_t_13 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_12KeyOperation_1unclean_shutdown, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_KeyOperation_unclean_shutdown, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[74])); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_13);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_KeyOperation, __pyx_mstate_global->__pyx_n_u_unclean_shutdown, __pyx_t_13) < (0)) __PYX_ERR(0, 1509, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "pkcs11/_pkcs11.pyx":1515
 *         raise NotImplementedError
 * 
 *     def _initiate(self):             # <<<<<<<<<<<<<<
 *         cdef CK_RV retval
 *         with nogil:
*/
  __pyx_t_13 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_12KeyOperation_3_initiate, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_KeyOperation__initiate, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[75])); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_13);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_KeyOperation, __pyx_mstate_global->__pyx_n_u_initiate, __pyx_t_13) < (0)) __PYX_ERR(0, 1515, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "pkcs11/_pkcs11.pyx":1521
 *         self._operation_aware_assert(retval)
 * 
 *     def _cancel_operation(self, silent):             # <<<<<<<<<<<<<<
 *         cdef CK_RV retval
 *         if self.session.cancel_strategy == CancelStrategy.CANCEL_WITH_INIT:
*/
  __pyx_t_13 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_12KeyOperation_5_cancel_operation, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_KeyOperation__cancel_operation, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[76])); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1521, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_13);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_KeyOperation, __pyx_mstate_global->__pyx_n_u_cancel_operation, __pyx_t_13) < (0)) __PYX_ERR(0, 1521, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "pkcs11/_pkcs11.pyx":1535
 *             self.unclean_shutdown()
 * 
 *     def _finalize(self, silent=False):             # <<<<<<<<<<<<<<
 *         if self.active:
 *             self._cancel_operation(silent)
*/
  __pyx_t_13 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_12KeyOperation_7_finalize, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_KeyOperation__finalize, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[77])); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_13);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_13, __pyx_mstate_global->__pyx_tuple[3]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_KeyOperation, __pyx_mstate_global->__pyx_n_u_finalize, __pyx_t_13) < (0)) __PYX_ERR(0, 1535, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_13 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_12KeyOperation_9__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_KeyOperation___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[78])); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_13);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_13) < (0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __pyx_t_13 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_12KeyOperation_11__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_KeyOperation___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[79])); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_13);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_13) < (0)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "pkcs11/_pkcs11.pyx":1585
 *         return self.finish_with_output(self.op_final)
 * 
 *     def unclean_shutdown(self):             # <<<<<<<<<<<<<<
 *         self.execute_resizing_output(self.op_final)
 * 
*/
  __pyx_t_13 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_18DataCryptOperation_1unclean_shutdown, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataCryptOperation_unclean_shutd, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[80])); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_13);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_DataCryptOperation, __pyx_mstate_global->__pyx_n_u_unclean_shutdown, __pyx_t_13) < (0)) __PYX_ERR(0, 1585, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "pkcs11/_pkcs11.pyx":1588
 *         self.execute_resizing_output(self.op_final)
 * 
 *     def update_chunks(self, chunks):             # <<<<<<<<<<<<<<
 *         cdef CK_BYTE *data_ptr
 *         cdef CK_ULONG data_len
*/
  __pyx_t_13 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_18DataCryptOperation_3update_chunks, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataCryptOperation_update_chunks, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1588, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_13);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_DataCryptOperation, __pyx_mstate_global->__pyx_n_u_update_chunks, __pyx_t_13) < (0)) __PYX_ERR(0, 1588, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_13 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_18DataCryptOperation_6__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataCryptOperation___reduce_cyth, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[81])); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_13);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_13) < (0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __pyx_t_13 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_18DataCryptOperation_8__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataCryptOperation___setstate_cy, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[82])); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_13);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_13) < (0)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "pkcs11/_pkcs11.pyx":1600
 * 
 * 
 * class EncryptMixin(types.EncryptMixin):             # <<<<<<<<<<<<<<
 *     """Expand EncryptMixin with an implementation."""
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_types); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_EncryptMixin); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = PyTuple_Pack(1, __pyx_t_10); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PEP560_update_bases(__pyx_t_13); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_5 = __Pyx_CalculateMetaclass(NULL, __pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_11 = __Pyx_Py3MetaclassPrepare(__pyx_t_5, __pyx_t_10, __pyx_mstate_global->__pyx_n_u_EncryptMixin, __pyx_mstate_global->__pyx_n_u_EncryptMixin, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_kp_u_Expand_EncryptMixin_with_an_impl); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  if (__pyx_t_10 != __pyx_t_13) {
    if (unlikely((PyDict_SetItemString(__pyx_t_11, "__orig_bases__", __pyx_t_13) < 0))) __PYX_ERR(0, 1600, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "pkcs11/_pkcs11.pyx":1603
 *     """Expand EncryptMixin with an implementation."""
 * 
 *     def __encrypt_operation(self, mechanism, mechanism_param, buffer_size):             # <<<<<<<<<<<<<<
 * 
 *         mech = MechanismWithParam(self.key_type, DEFAULT_ENCRYPT_MECHANISMS, mechanism, mechanism_param)
*/
  __pyx_t_13 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_12EncryptMixin_1__encrypt_operation, 0, __pyx_mstate_global->__pyx_n_u_EncryptMixin___encrypt_operation, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[83])); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1603, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_13);
  #endif
  if (__Pyx_SetNameInClass(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_EncryptMixin__encrypt_operation, __pyx_t_13) < (0)) __PYX_ERR(0, 1603, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "pkcs11/_pkcs11.pyx":1609
 *         return DataCryptOperation.setup_encrypt(self.session, mech, self.handle, buffer_size)
 * 
 *     def _encrypt(self, data, mechanism=None, mechanism_param=None, buffer_size=8192):             # <<<<<<<<<<<<<<
 *         """
 *         Non chunking encrypt. Needed for some mechanisms.
*/
  __pyx_t_13 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_12EncryptMixin_3_encrypt, 0, __pyx_mstate_global->__pyx_n_u_EncryptMixin__encrypt, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[84])); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1609, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_13);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_13, __pyx_mstate_global->__pyx_tuple[11]);
  if (__Pyx_SetNameInClass(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_encrypt, __pyx_t_13) < (0)) __PYX_ERR(0, 1609, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "pkcs11/_pkcs11.pyx":1621
 * 
 * 
 *     def _encrypt_generator(self, data,             # <<<<<<<<<<<<<<
 *                            mechanism=None, mechanism_param=None,
 *                            buffer_size=8192):
*/
  __pyx_t_13 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_12EncryptMixin_5_encrypt_generator, 0, __pyx_mstate_global->__pyx_n_u_EncryptMixin__encrypt_generator, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1621, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_13);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_13, __pyx_mstate_global->__pyx_tuple[11]);
  if (__Pyx_SetNameInClass(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_encrypt_generator, __pyx_t_13) < (0)) __PYX_ERR(0, 1621, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "pkcs11/_pkcs11.pyx":1600
 * 
 * 
 * class EncryptMixin(types.EncryptMixin):             # <<<<<<<<<<<<<<
 *     """Expand EncryptMixin with an implementation."""
 * 
*/
  __pyx_t_13 = __Pyx_Py3ClassCreate(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_EncryptMixin, __pyx_t_10, __pyx_t_11, NULL, 0, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_13);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EncryptMixin, __pyx_t_13) < (0)) __PYX_ERR(0, 1600, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "pkcs11/_pkcs11.pyx":1633
 * 
 * 
 * class DecryptMixin(types.DecryptMixin):             # <<<<<<<<<<<<<<
 *     """Expand DecryptMixin with an implementation."""
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_types); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_DecryptMixin); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyTuple_Pack(1, __pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PEP560_update_bases(__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_11 = __Pyx_CalculateMetaclass(NULL, __pyx_t_5); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_13 = __Pyx_Py3MetaclassPrepare(__pyx_t_11, __pyx_t_5, __pyx_mstate_global->__pyx_n_u_DecryptMixin, __pyx_mstate_global->__pyx_n_u_DecryptMixin, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_kp_u_Expand_DecryptMixin_with_an_impl); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  if (__pyx_t_5 != __pyx_t_10) {
    if (unlikely((PyDict_SetItemString(__pyx_t_13, "__orig_bases__", __pyx_t_10) < 0))) __PYX_ERR(0, 1633, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "pkcs11/_pkcs11.pyx":1636
 *     """Expand DecryptMixin with an implementation."""
 * 
 *     def __decrypt_operation(self, mechanism, mechanism_param, buffer_size):             # <<<<<<<<<<<<<<
 * 
 *         mech = MechanismWithParam(self.key_type, DEFAULT_ENCRYPT_MECHANISMS, mechanism, mechanism_param)
*/
  __pyx_t_10 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_12DecryptMixin_1__decrypt_operation, 0, __pyx_mstate_global->__pyx_n_u_DecryptMixin___decrypt_operation, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[85])); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1636, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_10);
  #endif
  if (__Pyx_SetNameInClass(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_DecryptMixin__decrypt_operation, __pyx_t_10) < (0)) __PYX_ERR(0, 1636, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "pkcs11/_pkcs11.pyx":1642
 *         return DataCryptOperation.setup_decrypt(self.session, mech, self.handle, buffer_size)
 * 
 *     def _decrypt(self, data, mechanism=None, mechanism_param=None, pin=None, buffer_size=8192):             # <<<<<<<<<<<<<<
 *         """Non chunking decrypt."""
 *         cdef Session session = self.session
*/
  __pyx_t_10 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_12DecryptMixin_3_decrypt, 0, __pyx_mstate_global->__pyx_n_u_DecryptMixin__decrypt, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[86])); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_10);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_10, __pyx_mstate_global->__pyx_tuple[12]);
  if (__Pyx_SetNameInClass(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_decrypt, __pyx_t_10) < (0)) __PYX_ERR(0, 1642, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "pkcs11/_pkcs11.pyx":1655
 * 
 * 
 *     def _decrypt_generator(self, data,             # <<<<<<<<<<<<<<
 *                            mechanism=None, mechanism_param=None, pin=None,
 *                            buffer_size=8192):
*/
  __pyx_t_10 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_12DecryptMixin_5_decrypt_generator, 0, __pyx_mstate_global->__pyx_n_u_DecryptMixin__decrypt_generator, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1655, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_10);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_10, __pyx_mstate_global->__pyx_tuple[12]);
  if (__Pyx_SetNameInClass(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_decrypt_generator, __pyx_t_10) < (0)) __PYX_ERR(0, 1655, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "pkcs11/_pkcs11.pyx":1633
 * 
 * 
 * class DecryptMixin(types.DecryptMixin):             # <<<<<<<<<<<<<<
 *     """Expand DecryptMixin with an implementation."""
 * 
*/
  __pyx_t_10 = __Pyx_Py3ClassCreate(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_DecryptMixin, __pyx_t_5, __pyx_t_13, NULL, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_10);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_DecryptMixin, __pyx_t_10) < (0)) __PYX_ERR(0, 1633, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":1674
 *     cdef OperationUpdate op_update
 * 
 *     def ingest_chunks(self, chunks):             # <<<<<<<<<<<<<<
 *         cdef Session session = self.session
 *         cdef CK_BYTE *data_ptr
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_21SignOrVerifyOperation_1ingest_chunks, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_SignOrVerifyOperation_ingest_chu, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[87])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1674, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_SignOrVerifyOperation, __pyx_mstate_global->__pyx_n_u_ingest_chunks, __pyx_t_5) < (0)) __PYX_ERR(0, 1674, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_21SignOrVerifyOperation_3__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_SignOrVerifyOperation___reduce_c, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[88])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_5) < (0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_21SignOrVerifyOperation_5__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_SignOrVerifyOperation___setstate, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[89])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_5) < (0)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":1711
 *         return self.finish_with_output(session.funclist.C_SignFinal)
 * 
 *     def unclean_shutdown(self):             # <<<<<<<<<<<<<<
 *         cdef Session session = self.session
 *         self.execute_resizing_output(session.funclist.C_SignFinal)
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_17DataSignOperation_1unclean_shutdown, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataSignOperation_unclean_shutdo, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[90])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_DataSignOperation, __pyx_mstate_global->__pyx_n_u_unclean_shutdown, __pyx_t_5) < (0)) __PYX_ERR(0, 1711, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_17DataSignOperation_3__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataSignOperation___reduce_cytho, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[91])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_5) < (0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_17DataSignOperation_5__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataSignOperation___setstate_cyt, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[92])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_5) < (0)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":1716
 * 
 * 
 * class SignMixin(types.SignMixin):             # <<<<<<<<<<<<<<
 *     """Expand SignMixin with an implementation."""
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_types); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1716, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_SignMixin); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1716, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_Pack(1, __pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1716, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = __Pyx_PEP560_update_bases(__pyx_t_5); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1716, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_13 = __Pyx_CalculateMetaclass(NULL, __pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1716, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_10 = __Pyx_Py3MetaclassPrepare(__pyx_t_13, __pyx_t_11, __pyx_mstate_global->__pyx_n_u_SignMixin, __pyx_mstate_global->__pyx_n_u_SignMixin, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_kp_u_Expand_SignMixin_with_an_impleme); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1716, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (__pyx_t_11 != __pyx_t_5) {
    if (unlikely((PyDict_SetItemString(__pyx_t_10, "__orig_bases__", __pyx_t_5) < 0))) __PYX_ERR(0, 1716, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":1719
 *     """Expand SignMixin with an implementation."""
 * 
 *     def __sign_operation(self, mechanism, mechanism_param, buffer_size):             # <<<<<<<<<<<<<<
 *         mech = MechanismWithParam(self.key_type, DEFAULT_SIGN_MECHANISMS, mechanism, mechanism_param)
 *         return DataSignOperation.setup(self.session, mech, self.handle, buffer_size)
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_9SignMixin_1__sign_operation, 0, __pyx_mstate_global->__pyx_n_u_SignMixin___sign_operation, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[93])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1719, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_SignMixin__sign_operation, __pyx_t_5) < (0)) __PYX_ERR(0, 1719, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":1723
 *         return DataSignOperation.setup(self.session, mech, self.handle, buffer_size)
 * 
 *     def _sign(self, data,             # <<<<<<<<<<<<<<
 *               mechanism=None, mechanism_param=None, pin=None, buffer_size=8192):
 *         cdef Session session = self.session
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_9SignMixin_3_sign, 0, __pyx_mstate_global->__pyx_n_u_SignMixin__sign, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[94])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1723, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_mstate_global->__pyx_tuple[12]);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_sign, __pyx_t_5) < (0)) __PYX_ERR(0, 1723, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":1735
 *             return op.sign_process_fully(data, data_len)
 * 
 *     def _sign_generator(self, data,             # <<<<<<<<<<<<<<
 *                         mechanism=None, mechanism_param=None, pin=None, buffer_size=8192):
 * 
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_9SignMixin_5_sign_generator, 0, __pyx_mstate_global->__pyx_n_u_SignMixin__sign_generator, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[95])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1735, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_mstate_global->__pyx_tuple[12]);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_sign_generator, __pyx_t_5) < (0)) __PYX_ERR(0, 1735, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":1716
 * 
 * 
 * class SignMixin(types.SignMixin):             # <<<<<<<<<<<<<<
 *     """Expand SignMixin with an implementation."""
 * 
*/
  __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_SignMixin, __pyx_t_11, __pyx_t_10, NULL, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1716, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_SignMixin, __pyx_t_5) < (0)) __PYX_ERR(0, 1716, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "pkcs11/_pkcs11.pyx":1782
 *         self._handle_final_retval(retval)
 * 
 *     def unclean_shutdown(self):             # <<<<<<<<<<<<<<
 *         cdef Session session = self.session
 *         cdef CK_BYTE dummy = 0
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_19DataVerifyOperation_1unclean_shutdown, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataVerifyOperation_unclean_shut, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[96])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_DataVerifyOperation, __pyx_mstate_global->__pyx_n_u_unclean_shutdown, __pyx_t_11) < (0)) __PYX_ERR(0, 1782, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_19DataVerifyOperation_3__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataVerifyOperation___reduce_cyt, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[97])); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_11) < (0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_19DataVerifyOperation_5__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataVerifyOperation___setstate_c, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[98])); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_11) < (0)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "pkcs11/_pkcs11.pyx":1789
 * 
 * 
 * class VerifyMixin(types.VerifyMixin):             # <<<<<<<<<<<<<<
 *     """Expand VerifyMixin with an implementation."""
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_types); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1789, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_VerifyMixin); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1789, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = PyTuple_Pack(1, __pyx_t_13); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1789, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = __Pyx_PEP560_update_bases(__pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1789, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_10 = __Pyx_CalculateMetaclass(NULL, __pyx_t_13); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1789, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_5 = __Pyx_Py3MetaclassPrepare(__pyx_t_10, __pyx_t_13, __pyx_mstate_global->__pyx_n_u_VerifyMixin, __pyx_mstate_global->__pyx_n_u_VerifyMixin, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_kp_u_Expand_VerifyMixin_with_an_imple); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1789, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_13 != __pyx_t_11) {
    if (unlikely((PyDict_SetItemString(__pyx_t_5, "__orig_bases__", __pyx_t_11) < 0))) __PYX_ERR(0, 1789, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "pkcs11/_pkcs11.pyx":1792
 *     """Expand VerifyMixin with an implementation."""
 * 
 *     def __verify_operation(self, mechanism, mechanism_param):             # <<<<<<<<<<<<<<
 *         mech = MechanismWithParam(self.key_type, DEFAULT_SIGN_MECHANISMS, mechanism, mechanism_param)
 *         return DataVerifyOperation.setup(self.session, mech, self.handle)
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_11VerifyMixin_1__verify_operation, 0, __pyx_mstate_global->__pyx_n_u_VerifyMixin___verify_operation, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[99])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1792, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_VerifyMixin__verify_operation, __pyx_t_11) < (0)) __PYX_ERR(0, 1792, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "pkcs11/_pkcs11.pyx":1796
 *         return DataVerifyOperation.setup(self.session, mech, self.handle)
 * 
 *     def _verify(self, data, signature,             # <<<<<<<<<<<<<<
 *                 mechanism=None, mechanism_param=None):
 * 
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_11VerifyMixin_3_verify, 0, __pyx_mstate_global->__pyx_n_u_VerifyMixin__verify, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[100])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1796, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_11, __pyx_mstate_global->__pyx_tuple[9]);
  if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_verify, __pyx_t_11) < (0)) __PYX_ERR(0, 1796, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "pkcs11/_pkcs11.pyx":1808
 *             op.verify_process_fully(data_ptr, data_len, sig_ptr, sig_len)
 * 
 *     def _verify_generator(self, data, signature,             # <<<<<<<<<<<<<<
 *                           mechanism=None, mechanism_param=None):
 * 
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_11VerifyMixin_5_verify_generator, 0, __pyx_mstate_global->__pyx_n_u_VerifyMixin__verify_generator, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[101])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1808, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_11, __pyx_mstate_global->__pyx_tuple[9]);
  if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_verify_generator, __pyx_t_11) < (0)) __PYX_ERR(0, 1808, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "pkcs11/_pkcs11.pyx":1789
 * 
 * 
 * class VerifyMixin(types.VerifyMixin):             # <<<<<<<<<<<<<<
 *     """Expand VerifyMixin with an implementation."""
 * 
*/
  __pyx_t_11 = __Pyx_Py3ClassCreate(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_VerifyMixin, __pyx_t_13, __pyx_t_5, NULL, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1789, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_VerifyMixin, __pyx_t_11) < (0)) __PYX_ERR(0, 1789, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "pkcs11/_pkcs11.pyx":1820
 * 
 * 
 * class WrapMixin(types.WrapMixin):             # <<<<<<<<<<<<<<
 *     """Expand WrapMixin with an implementation."""
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_types); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_WrapMixin); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = PyTuple_Pack(1, __pyx_t_10); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PEP560_update_bases(__pyx_t_13); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_5 = __Pyx_CalculateMetaclass(NULL, __pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_11 = __Pyx_Py3MetaclassPrepare(__pyx_t_5, __pyx_t_10, __pyx_mstate_global->__pyx_n_u_WrapMixin, __pyx_mstate_global->__pyx_n_u_WrapMixin, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_kp_u_Expand_WrapMixin_with_an_impleme); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  if (__pyx_t_10 != __pyx_t_13) {
    if (unlikely((PyDict_SetItemString(__pyx_t_11, "__orig_bases__", __pyx_t_13) < 0))) __PYX_ERR(0, 1820, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "pkcs11/_pkcs11.pyx":1823
 *     """Expand WrapMixin with an implementation."""
 * 
 *     def wrap_key(self, key,             # <<<<<<<<<<<<<<
 *                  mechanism=None, mechanism_param=None):
 * 
*/
  __pyx_t_13 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_9WrapMixin_1wrap_key, 0, __pyx_mstate_global->__pyx_n_u_WrapMixin_wrap_key, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[102])); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1823, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_13);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_13, __pyx_mstate_global->__pyx_tuple[9]);
  if (__Pyx_SetNameInClass(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_wrap_key, __pyx_t_13) < (0)) __PYX_ERR(0, 1823, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "pkcs11/_pkcs11.pyx":1820
 * 
 * 
 * class WrapMixin(types.WrapMixin):             # <<<<<<<<<<<<<<
 *     """Expand WrapMixin with an implementation."""
 * 
*/
  __pyx_t_13 = __Pyx_Py3ClassCreate(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_WrapMixin, __pyx_t_10, __pyx_t_11, NULL, 0, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_13);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_WrapMixin, __pyx_t_13) < (0)) __PYX_ERR(0, 1820, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "pkcs11/_pkcs11.pyx":1852
 * 
 * 
 * class UnwrapMixin(types.UnwrapMixin):             # <<<<<<<<<<<<<<
 *     """Expand UnwrapMixin with an implementation."""
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_types); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1852, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_UnwrapMixin); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1852, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyTuple_Pack(1, __pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1852, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PEP560_update_bases(__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1852, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_11 = __Pyx_CalculateMetaclass(NULL, __pyx_t_5); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1852, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_13 = __Pyx_Py3MetaclassPrepare(__pyx_t_11, __pyx_t_5, __pyx_mstate_global->__pyx_n_u_UnwrapMixin, __pyx_mstate_global->__pyx_n_u_UnwrapMixin, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_kp_u_Expand_UnwrapMixin_with_an_imple); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1852, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  if (__pyx_t_5 != __pyx_t_10) {
    if (unlikely((PyDict_SetItemString(__pyx_t_13, "__orig_bases__", __pyx_t_10) < 0))) __PYX_ERR(0, 1852, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "pkcs11/_pkcs11.pyx":1855
 *     """Expand UnwrapMixin with an implementation."""
 * 
 *     def unwrap_key(self, object_class, key_type, key_data,             # <<<<<<<<<<<<<<
 *                    id=None, label=None,
 *                    mechanism=None, mechanism_param=None,
*/
  __pyx_t_10 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_11UnwrapMixin_1unwrap_key, 0, __pyx_mstate_global->__pyx_n_u_UnwrapMixin_unwrap_key, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[103])); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1855, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_10);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_10, __pyx_mstate_global->__pyx_tuple[13]);
  if (__Pyx_SetNameInClass(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_unwrap_key, __pyx_t_10) < (0)) __PYX_ERR(0, 1855, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "pkcs11/_pkcs11.pyx":1852
 * 
 * 
 * class UnwrapMixin(types.UnwrapMixin):             # <<<<<<<<<<<<<<
 *     """Expand UnwrapMixin with an implementation."""
 * 
*/
  __pyx_t_10 = __Pyx_Py3ClassCreate(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_UnwrapMixin, __pyx_t_5, __pyx_t_13, NULL, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1852, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_10);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_UnwrapMixin, __pyx_t_10) < (0)) __PYX_ERR(0, 1852, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":1906
 * 
 * 
 * class DeriveMixin(types.DeriveMixin):             # <<<<<<<<<<<<<<
 *     """Expand DeriveMixin with an implementation."""
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_types); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1906, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_DeriveMixin); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1906, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_Pack(1, __pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1906, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = __Pyx_PEP560_update_bases(__pyx_t_5); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1906, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_13 = __Pyx_CalculateMetaclass(NULL, __pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1906, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_10 = __Pyx_Py3MetaclassPrepare(__pyx_t_13, __pyx_t_11, __pyx_mstate_global->__pyx_n_u_DeriveMixin, __pyx_mstate_global->__pyx_n_u_DeriveMixin, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_kp_u_Expand_DeriveMixin_with_an_imple); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1906, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (__pyx_t_11 != __pyx_t_5) {
    if (unlikely((PyDict_SetItemString(__pyx_t_10, "__orig_bases__", __pyx_t_5) < 0))) __PYX_ERR(0, 1906, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":1909
 *     """Expand DeriveMixin with an implementation."""
 * 
 *     def derive_key(self, key_type, key_length,             # <<<<<<<<<<<<<<
 *                    id=None, label=None,
 *                    store=False, capabilities=None,
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_11DeriveMixin_1derive_key, 0, __pyx_mstate_global->__pyx_n_u_DeriveMixin_derive_key, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[104])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_mstate_global->__pyx_tuple[14]);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_derive_key, __pyx_t_5) < (0)) __PYX_ERR(0, 1909, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pkcs11/_pkcs11.pyx":1906
 * 
 * 
 * class DeriveMixin(types.DeriveMixin):             # <<<<<<<<<<<<<<
 *     """Expand DeriveMixin with an implementation."""
 * 
*/
  __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_DeriveMixin, __pyx_t_11, __pyx_t_10, NULL, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1906, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_DeriveMixin, __pyx_t_5) < (0)) __PYX_ERR(0, 1906, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "pkcs11/_pkcs11.pyx":1953
 * 
 * _CLASS_MAP = {
 *     ObjectClass.SECRET_KEY: SecretKey,             # <<<<<<<<<<<<<<
 *     ObjectClass.PUBLIC_KEY: PublicKey,
 *     ObjectClass.PRIVATE_KEY: PrivateKey,
*/
  __pyx_t_11 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1953, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_ObjectClass); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1953, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_SECRET_KEY); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1953, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_SecretKey); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1953, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  if (PyDict_SetItem(__pyx_t_11, __pyx_t_10, __pyx_t_13) < (0)) __PYX_ERR(0, 1953, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "pkcs11/_pkcs11.pyx":1954
 * _CLASS_MAP = {
 *     ObjectClass.SECRET_KEY: SecretKey,
 *     ObjectClass.PUBLIC_KEY: PublicKey,             # <<<<<<<<<<<<<<
 *     ObjectClass.PRIVATE_KEY: PrivateKey,
 *     ObjectClass.DOMAIN_PARAMETERS: StoredDomainParameters,
*/
  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_ObjectClass); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_PUBLIC_KEY); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_PublicKey); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  if (PyDict_SetItem(__pyx_t_11, __pyx_t_10, __pyx_t_13) < (0)) __PYX_ERR(0, 1953, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "pkcs11/_pkcs11.pyx":1955
 *     ObjectClass.SECRET_KEY: SecretKey,
 *     ObjectClass.PUBLIC_KEY: PublicKey,
 *     ObjectClass.PRIVATE_KEY: PrivateKey,             # <<<<<<<<<<<<<<
 *     ObjectClass.DOMAIN_PARAMETERS: StoredDomainParameters,
 *     ObjectClass.CERTIFICATE: Certificate,
*/
  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_ObjectClass); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1955, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_PRIVATE_KEY); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1955, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_PrivateKey); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1955, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  if (PyDict_SetItem(__pyx_t_11, __pyx_t_10, __pyx_t_13) < (0)) __PYX_ERR(0, 1953, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "pkcs11/_pkcs11.pyx":1956
 *     ObjectClass.PUBLIC_KEY: PublicKey,
 *     ObjectClass.PRIVATE_KEY: PrivateKey,
 *     ObjectClass.DOMAIN_PARAMETERS: StoredDomainParameters,             # <<<<<<<<<<<<<<
 *     ObjectClass.CERTIFICATE: Certificate,
 * }
*/
  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_ObjectClass); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1956, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_DOMAIN_PARAMETERS); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1956, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_StoredDomainParameters); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1956, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  if (PyDict_SetItem(__pyx_t_11, __pyx_t_10, __pyx_t_13) < (0)) __PYX_ERR(0, 1953, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "pkcs11/_pkcs11.pyx":1957
 *     ObjectClass.PRIVATE_KEY: PrivateKey,
 *     ObjectClass.DOMAIN_PARAMETERS: StoredDomainParameters,
 *     ObjectClass.CERTIFICATE: Certificate,             # <<<<<<<<<<<<<<
 * }
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_ObjectClass); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1957, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_CERTIFICATE); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1957, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_Certificate); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1957, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  if (PyDict_SetItem(__pyx_t_11, __pyx_t_10, __pyx_t_13) < (0)) __PYX_ERR(0, 1953, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_CLASS_MAP, __pyx_t_11) < (0)) __PYX_ERR(0, 1952, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "pkcs11/_pkcs11.pyx":2024
 *         # at this point, _funclist contains all function pointers to the library
 * 
 *     cpdef initialize(self):             # <<<<<<<<<<<<<<
 *         cdef CK_RV retval
 *         if self.funclist != NULL and not self.initialized:
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_3lib_3initialize, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_lib_initialize, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[105])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2024, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_lib, __pyx_mstate_global->__pyx_n_u_initialize, __pyx_t_11) < (0)) __PYX_ERR(0, 2024, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "pkcs11/_pkcs11.pyx":2039
 *         return retval
 * 
 *     def finalize(self):             # <<<<<<<<<<<<<<
 *         assertRV(self._finalize())
 * 
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_3lib_5finalize, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_lib_finalize, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[106])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2039, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_lib, __pyx_mstate_global->__pyx_n_u_finalize_2, __pyx_t_11) < (0)) __PYX_ERR(0, 2039, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "pkcs11/_pkcs11.pyx":2042
 *         assertRV(self._finalize())
 * 
 *     def reinitialize(self):             # <<<<<<<<<<<<<<
 *         if self.funclist != NULL:
 *             self.finalize()
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_3lib_7reinitialize, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_lib_reinitialize, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[107])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_lib, __pyx_mstate_global->__pyx_n_u_reinitialize, __pyx_t_11) < (0)) __PYX_ERR(0, 2042, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "pkcs11/_pkcs11.pyx":2090
 * 
 * 
 *     def get_slots(self, token_present=False):             # <<<<<<<<<<<<<<
 *         """Get all slots."""
 * 
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_3lib_15get_slots, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_lib_get_slots, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[108])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2090, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_11, __pyx_mstate_global->__pyx_tuple[3]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_lib, __pyx_mstate_global->__pyx_n_u_get_slots, __pyx_t_11) < (0)) __PYX_ERR(0, 2090, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "pkcs11/_pkcs11.pyx":2127
 * 
 * 
 *     def get_tokens(self,             # <<<<<<<<<<<<<<
 *                    token_label=None,
 *                    token_serial=None,
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_3lib_17get_tokens, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_lib_get_tokens, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_11, __pyx_mstate_global->__pyx_tuple[15]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_lib, __pyx_mstate_global->__pyx_n_u_get_tokens, __pyx_t_11) < (0)) __PYX_ERR(0, 2127, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "pkcs11/_pkcs11.pyx":2164
 *                 continue
 * 
 *     def get_token(self, **kwargs):             # <<<<<<<<<<<<<<
 *         """Get a single token."""
 *         iterator = self.get_tokens(**kwargs)
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_3lib_20get_token, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_lib_get_token, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[109])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_lib, __pyx_mstate_global->__pyx_n_u_get_token, __pyx_t_11) < (0)) __PYX_ERR(0, 2164, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "pkcs11/_pkcs11.pyx":2180
 *             return token
 * 
 *     def wait_for_slot_event(self, blocking=True):             # <<<<<<<<<<<<<<
 *         cdef CK_SLOT_ID slot_id
 *         cdef CK_FLAGS flag = 0
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_3lib_22wait_for_slot_event, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_lib_wait_for_slot_event, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[110])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_11, __pyx_mstate_global->__pyx_tuple[16]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_lib, __pyx_mstate_global->__pyx_n_u_wait_for_slot_event, __pyx_t_11) < (0)) __PYX_ERR(0, 2180, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "pkcs11/_pkcs11.pyx":2204
 *                  info.hardwareVersion, info.firmwareVersion, info.flags)
 * 
 *     def unload(self):             # <<<<<<<<<<<<<<
 *         self._finalize()
 *         self.funclist = NULL
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_3lib_24unload, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_lib_unload, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[111])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6pkcs11_7_pkcs11_lib, __pyx_mstate_global->__pyx_n_u_unload, __pyx_t_11) < (0)) __PYX_ERR(0, 2204, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_3lib_28__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_lib___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[112])); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_11) < (0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_6pkcs11_7_pkcs11_3lib_30__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_lib___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_pkcs11__pkcs11, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[113])); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_11);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_11) < (0)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "pkcs11/_pkcs11.pyx":1
 * #cython: language_level=3             # <<<<<<<<<<<<<<
 * #coverage#cython: linetrace=True
 * """
*/
  __pyx_t_11 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_11) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  if (__pyx_m) {
    if (__pyx_mstate->__pyx_d && stringtab_initialized) {
      __Pyx_AddTraceback("init pkcs11._pkcs11", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    #if !CYTHON_USE_MODULE_STATE
    Py_CLEAR(__pyx_m);
    #else
    Py_DECREF(__pyx_m);
    if (pystate_addmodule_run) {
      PyObject *tp, *value, *tb;
      PyErr_Fetch(&tp, &value, &tb);
      PyState_RemoveModule(&__pyx_moduledef);
      PyErr_Restore(tp, value, tb);
    }
    #endif
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init pkcs11._pkcs11");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  return (__pyx_m != NULL) ? 0 : -1;
  #else
  return __pyx_m;
  #endif
}
/* #### Code section: pystring_table ### */
/* #### Code section: cached_builtins ### */

static int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate) {
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_property); if (!__pyx_builtin_property) __PYX_ERR(0, 1340, __pyx_L1_error)
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 84, __pyx_L1_error)
  __pyx_builtin_map = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_map); if (!__pyx_builtin_map) __PYX_ERR(0, 399, __pyx_L1_error)
  __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_super); if (!__pyx_builtin_super) __PYX_ERR(0, 728, __pyx_L1_error)
  __pyx_builtin___import__ = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_import); if (!__pyx_builtin___import__) __PYX_ERR(1, 109, __pyx_L1_error)
  __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(1, 418, __pyx_L1_error)
  __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_id); if (!__pyx_builtin_id) __PYX_ERR(1, 628, __pyx_L1_error)

  /* Cached unbound methods */
  __pyx_mstate->__pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type;
  __pyx_mstate->__pyx_umethod_PyDict_Type_items.method_name = &__pyx_mstate->__pyx_n_u_items;
  __pyx_mstate->__pyx_umethod_PyDict_Type_pop.type = (PyObject*)&PyDict_Type;
  __pyx_mstate->__pyx_umethod_PyDict_Type_pop.method_name = &__pyx_mstate->__pyx_n_u_pop;
  __pyx_mstate->__pyx_umethod_PyDict_Type_values.type = (PyObject*)&PyDict_Type;
  __pyx_mstate->__pyx_umethod_PyDict_Type_values.method_name = &__pyx_mstate->__pyx_n_u_values;
  __pyx_mstate->__pyx_umethod_PyBytes_Type__rstrip.type = (PyObject*)(&PyBytes_Type);
  __pyx_mstate->__pyx_umethod_PyBytes_Type__rstrip.method_name = &__pyx_mstate->__pyx_n_u_rstrip;
  return 0;
  __pyx_L1_error:;
  return -1;
}
/* #### Code section: cached_constants ### */

static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "View.MemoryView":592
 *     def suboffsets(self):
 *         if self.view.suboffsets == NULL:
 *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
 * 
 *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
*/
  __pyx_mstate_global->__pyx_tuple[0] = PyTuple_New(1); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(1, 592, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]);
  __Pyx_INCREF(__pyx_mstate_global->__pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_neg_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_mstate_global->__pyx_tuple[0], 0, __pyx_mstate_global->__pyx_int_neg_1) != (0)) __PYX_ERR(1, 592, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]);

  /* "View.MemoryView":689
 *     tup = <tuple>index if isinstance(index, tuple) else (index,)
 * 
 *     result = [slice(None)] * ndim             # <<<<<<<<<<<<<<
 *     have_slices = False
 *     seen_ellipsis = False
*/
  __pyx_mstate_global->__pyx_slice[0] = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[0])) __PYX_ERR(1, 689, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[0]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]);

  /* "pkcs11/_pkcs11.pyx":66
 *     @staticmethod
 *     cdef AttributeList from_owned_pointer(CK_ATTRIBUTE * data, CK_ULONG count):
 *         cdef AttributeList lst = AttributeList.__new__(AttributeList, ())             # <<<<<<<<<<<<<<
 *         lst.data = data
 *         lst.count = count
*/
  __pyx_mstate_global->__pyx_tuple[1] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_empty_tuple); if (unlikely(!__pyx_mstate_global->__pyx_tuple[1])) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[1]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[1]);

  /* "pkcs11/_pkcs11.pyx":272
 *                     <CK_AES_CBC_ENCRYPT_DATA_PARAMS *> PyMem_Malloc(paramlen)
 *             (iv, data) = param
 *             aes_cbc_params.iv = iv[:16]             # <<<<<<<<<<<<<<
 *             aes_cbc_params.pData = <CK_BYTE *> data
 *             aes_cbc_params.length = <CK_ULONG> len(data)
*/
  __pyx_mstate_global->__pyx_slice[1] = PySlice_New(Py_None, __pyx_mstate_global->__pyx_int_16, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[1])) __PYX_ERR(0, 272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[1]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[1]);

  /* "pkcs11/_pkcs11.pyx":916
 * 
 *     def get_objects(self, attrs=None, batch_size=10):
 *         with SearchIter(self, attrs or {}, batch_size) as op:             # <<<<<<<<<<<<<<
 *             for batch in op:
 *                 yield from batch
*/
  __pyx_mstate_global->__pyx_tuple[2] = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[2])) __PYX_ERR(0, 916, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[2]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[2]);

  /* "pkcs11/_pkcs11.pyx":596
 *         raise NotImplementedError
 * 
 *     def _finalize(self, silent=False):             # <<<<<<<<<<<<<<
 *         if self.active:
 *             self.active = False
*/
  __pyx_mstate_global->__pyx_tuple[3] = PyTuple_Pack(1, Py_False); if (unlikely(!__pyx_mstate_global->__pyx_tuple[3])) __PYX_ERR(0, 596, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[3]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[3]);

  /* "pkcs11/_pkcs11.pyx":915
 *         assertRV(retval)
 * 
 *     def get_objects(self, attrs=None, batch_size=10):             # <<<<<<<<<<<<<<
 *         with SearchIter(self, attrs or {}, batch_size) as op:
 *             for batch in op:
*/
  __pyx_mstate_global->__pyx_tuple[4] = PyTuple_Pack(2, Py_None, __pyx_mstate_global->__pyx_int_10); if (unlikely(!__pyx_mstate_global->__pyx_tuple[4])) __PYX_ERR(0, 915, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[4]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[4]);

  /* "pkcs11/_pkcs11.pyx":948
 *         return make_object(self, new)
 * 
 *     def create_domain_parameters(self, key_type, attrs,             # <<<<<<<<<<<<<<
 *                                  local=False, store=False):
 *         if local and store:
*/
  __pyx_mstate_global->__pyx_tuple[5] = PyTuple_Pack(2, Py_False, Py_False); if (unlikely(!__pyx_mstate_global->__pyx_tuple[5])) __PYX_ERR(0, 948, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[5]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[5]);

  /* "pkcs11/_pkcs11.pyx":963
 *             return self.create_object(attrs)
 * 
 *     def generate_domain_parameters(self, key_type, param_length, store=False,             # <<<<<<<<<<<<<<
 *                                    mechanism=None, mechanism_param=None,
 *                                    template=None):
*/
  __pyx_mstate_global->__pyx_tuple[6] = PyTuple_Pack(4, Py_False, Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[6])) __PYX_ERR(0, 963, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[6]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[6]);

  /* "pkcs11/_pkcs11.pyx":988
 *         return AttributeList.from_template(dict(template), self.attribute_mapper)
 * 
 *     def generate_key(self, key_type, key_length=None,             # <<<<<<<<<<<<<<
 *                      id=None, label=None,
 *                      store=False, capabilities=None,
*/
  __pyx_mstate_global->__pyx_tuple[7] = PyTuple_Pack(8, Py_None, Py_None, Py_None, Py_False, Py_None, Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[7])) __PYX_ERR(0, 988, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[7]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[7]);

  /* "pkcs11/_pkcs11.pyx":1041
 * 
 * 
 *     def _generate_keypair(self, key_type, key_length=None,             # <<<<<<<<<<<<<<
 *                           id=None, label=None,
 *                           store=False, capabilities=None,
*/
  __pyx_mstate_global->__pyx_tuple[8] = PyTuple_Pack(9, Py_None, Py_None, Py_None, Py_False, Py_None, Py_None, Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[8])) __PYX_ERR(0, 1041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[8]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[8]);

  /* "pkcs11/_pkcs11.pyx":1146
 *         return DigestOperation.setup(self, mech, 1024)
 * 
 *     def _digest(self, data, mechanism=None, mechanism_param=None):             # <<<<<<<<<<<<<<
 *         cdef CK_BYTE *data_ptr = data
 *         cdef CK_ULONG data_len = <CK_ULONG> len(data)
*/
  __pyx_mstate_global->__pyx_tuple[9] = PyTuple_Pack(2, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[9])) __PYX_ERR(0, 1146, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[9]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[9]);

  /* "pkcs11/_pkcs11.pyx":1433
 * 
 * class GenerateWithParametersMixin(types.DomainParameters):
 *     def generate_keypair(self,             # <<<<<<<<<<<<<<
 *                          id=None, label=None,
 *                          store=False, capabilities=None,
*/
  __pyx_mstate_global->__pyx_tuple[10] = PyTuple_Pack(8, Py_None, Py_None, ((PyObject*)Py_False), Py_None, Py_None, Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[10])) __PYX_ERR(0, 1433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[10]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[10]);

  /* "pkcs11/_pkcs11.pyx":1609
 *         return DataCryptOperation.setup_encrypt(self.session, mech, self.handle, buffer_size)
 * 
 *     def _encrypt(self, data, mechanism=None, mechanism_param=None, buffer_size=8192):             # <<<<<<<<<<<<<<
 *         """
 *         Non chunking encrypt. Needed for some mechanisms.
*/
  __pyx_mstate_global->__pyx_tuple[11] = PyTuple_Pack(3, Py_None, Py_None, ((PyObject*)__pyx_mstate_global->__pyx_int_8192)); if (unlikely(!__pyx_mstate_global->__pyx_tuple[11])) __PYX_ERR(0, 1609, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[11]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[11]);

  /* "pkcs11/_pkcs11.pyx":1642
 *         return DataCryptOperation.setup_decrypt(self.session, mech, self.handle, buffer_size)
 * 
 *     def _decrypt(self, data, mechanism=None, mechanism_param=None, pin=None, buffer_size=8192):             # <<<<<<<<<<<<<<
 *         """Non chunking decrypt."""
 *         cdef Session session = self.session
*/
  __pyx_mstate_global->__pyx_tuple[12] = PyTuple_Pack(4, Py_None, Py_None, Py_None, ((PyObject*)__pyx_mstate_global->__pyx_int_8192)); if (unlikely(!__pyx_mstate_global->__pyx_tuple[12])) __PYX_ERR(0, 1642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[12]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[12]);

  /* "pkcs11/_pkcs11.pyx":1855
 *     """Expand UnwrapMixin with an implementation."""
 * 
 *     def unwrap_key(self, object_class, key_type, key_data,             # <<<<<<<<<<<<<<
 *                    id=None, label=None,
 *                    mechanism=None, mechanism_param=None,
*/
  __pyx_mstate_global->__pyx_tuple[13] = PyTuple_Pack(7, Py_None, Py_None, Py_None, Py_None, ((PyObject*)Py_False), Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[13])) __PYX_ERR(0, 1855, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[13]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[13]);

  /* "pkcs11/_pkcs11.pyx":1909
 *     """Expand DeriveMixin with an implementation."""
 * 
 *     def derive_key(self, key_type, key_length,             # <<<<<<<<<<<<<<
 *                    id=None, label=None,
 *                    store=False, capabilities=None,
*/
  __pyx_mstate_global->__pyx_tuple[14] = PyTuple_Pack(7, Py_None, Py_None, ((PyObject*)Py_False), Py_None, Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[14])) __PYX_ERR(0, 1909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[14]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[14]);

  /* "pkcs11/_pkcs11.pyx":2127
 * 
 * 
 *     def get_tokens(self,             # <<<<<<<<<<<<<<
 *                    token_label=None,
 *                    token_serial=None,
*/
  __pyx_mstate_global->__pyx_tuple[15] = PyTuple_Pack(5, Py_None, Py_None, Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[15])) __PYX_ERR(0, 2127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[15]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[15]);

  /* "pkcs11/_pkcs11.pyx":2180
 *             return token
 * 
 *     def wait_for_slot_event(self, blocking=True):             # <<<<<<<<<<<<<<
 *         cdef CK_SLOT_ID slot_id
 *         cdef CK_FLAGS flag = 0
*/
  __pyx_mstate_global->__pyx_tuple[16] = PyTuple_Pack(1, Py_True); if (unlikely(!__pyx_mstate_global->__pyx_tuple[16])) __PYX_ERR(0, 2180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[16]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[16]);
  #if CYTHON_IMMORTAL_CONSTANTS
  {
    PyObject **table = __pyx_mstate->__pyx_tuple;
    for (Py_ssize_t i=0; i<17; ++i) {
      #if PY_VERSION_HEX >= 0x030F0000
      PyUnstable_SetImmortal(table[i]);
      #elif CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
      if ((PY_SSIZE_T_MAX <= _Py_IMMORTAL_REFCNT_LOCAL)) break;
      #if PY_VERSION_HEX < 0x030E0000
      if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1)
      #else
      if (PyUnstable_Object_IsUniquelyReferenced(table[i]))
      #endif
      {
        Py_SET_REFCNT(table[i], ((Py_ssize_t)_Py_IMMORTAL_REFCNT_LOCAL + 1));
      }
      #else
      if ((PY_SSIZE_T_MAX < _Py_IMMORTAL_INITIAL_REFCNT)) break;
      Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
      #endif
    }
  }
  #endif
  #if CYTHON_IMMORTAL_CONSTANTS
  {
    PyObject **table = __pyx_mstate->__pyx_slice;
    for (Py_ssize_t i=0; i<2; ++i) {
      #if PY_VERSION_HEX >= 0x030F0000
      PyUnstable_SetImmortal(table[i]);
      #elif CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
      if ((PY_SSIZE_T_MAX <= _Py_IMMORTAL_REFCNT_LOCAL)) break;
      #if PY_VERSION_HEX < 0x030E0000
      if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1)
      #else
      if (PyUnstable_Object_IsUniquelyReferenced(table[i]))
      #endif
      {
        Py_SET_REFCNT(table[i], ((Py_ssize_t)_Py_IMMORTAL_REFCNT_LOCAL + 1));
      }
      #else
      if ((PY_SSIZE_T_MAX < _Py_IMMORTAL_INITIAL_REFCNT)) break;
      Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
      #endif
    }
  }
  #endif
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}
/* #### Code section: init_constants ### */

static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) {
  CYTHON_UNUSED_VAR(__pyx_mstate);
  {
    const struct { const unsigned int length: 9; } index[] = {{2},{35},{44},{54},{37},{60},{24},{35},{52},{23},{26},{34},{43},{42},{43},{37},{40},{42},{42},{40},{26},{23},{9},{23},{33},{66},{62},{45},{22},{23},{22},{11},{113},{19},{15},{28},{25},{73},{67},{20},{4},{179},{27},{37},{46},{58},{33},{20},{32},{38},{32},{22},{41},{1},{1},{1},{1},{1},{1},{8},{5},{6},{15},{23},{25},{7},{6},{2},{6},{35},{9},{30},{35},{20},{27},{57},{42},{32},{50},{8},{35},{37},{18},{19},{20},{32},{22},{15},{30},{37},{5},{20},{7},{20},{7},{5},{26},{12},{9},{13},{31},{33},{21},{17},{15},{17},{18},{20},{21},{1},{4},{16},{11},{26},{19},{20},{5},{10},{9},{14},{11},{7},{7},{25},{26},{27},{24},{24},{33},{23},{23},{6},{4},{4},{17},{18},{36},{38},{35},{32},{11},{12},{17},{35},{37},{34},{19},{37},{39},{36},{12},{32},{21},{31},{32},{11},{22},{11},{12},{13},{15},{33},{35},{25},{25},{29},{16},{19},{21},{12},{9},{5},{7},{8},{12},{32},{21},{31},{32},{20},{21},{21},{17},{14},{20},{16},{9},{9},{12},{27},{44},{11},{29},{31},{10},{8},{3},{16},{15},{9},{12},{15},{12},{30},{32},{30},{22},{22},{29},{12},{7},{19},{16},{1},{21},{6},{12},{9},{13},{16},{21},{18},{36},{38},{22},{7},{11},{6},{11},{19},{19},{37},{39},{24},{27},{28},{18},{15},{18},{16},{11},{14},{21},{13},{14},{15},{16},{26},{25},{34},{36},{26},{26},{23},{25},{43},{45},{13},{11},{5},{10},{11},{14},{29},{15},{10},{10},{12},{10},{11},{9},{10},{10},{9},{16},{20},{5},{3},{13},{12},{11},{22},{10},{4},{17},{19},{19},{19},{19},{4},{8},{10},{28},{30},{22},{20},{20},{9},{8},{7},{13},{12},{13},{20},{15},{21},{24},{26},{25},{27},{15},{25},{26},{25},{17},{13},{32},{21},{34},{20},{23},{19},{16},{28},{19},{15},{9},{26},{15},{25},{26},{21},{39},{41},{35},{16},{17},{4},{8},{13},{22},{24},{14},{23},{19},{14},{22},{5},{18},{20},{5},{9},{15},{18},{19},{23},{25},{15},{10},{6},{11},{22},{26},{22},{29},{19},{15},{21},{16},{8},{9},{6},{11},{30},{19},{29},{30},{15},{4},{9},{18},{17},{18},{24},{20},{27},{1},{3},{3},{7},{15},{12},{7},{18},{4},{10},{9},{16},{5},{4},{5},{11},{10},{8},{11},{1},{11},{17},{15},{12},{5},{6},{9},{17},{18},{5},{4},{5},{24},{13},{16},{4},{8},{8},{8},{18},{19},{16},{10},{7},{8},{7},{17},{18},{7},{15},{5},{6},{8},{18},{19},{9},{9},{5},{6},{8},{7},{8},{15},{9},{8},{16},{4},{5},{6},{7},{8},{26},{12},{17},{16},{15},{20},{3},{14},{18},{14},{11},{9},{9},{10},{11},{12},{6},{16},{2},{3},{8},{9},{10},{5},{4},{13},{8},{8},{10},{9},{13},{4},{5},{8},{8},{2},{3},{8},{10},{7},{11},{8},{4},{5},{6},{5},{6},{3},{21},{23},{12},{13},{13},{14},{14},{16},{10},{23},{15},{5},{8},{5},{14},{3},{7},{4},{9},{9},{9},{15},{10},{7},{15},{13},{5},{4},{10},{15},{4},{8},{5},{4},{7},{3},{7},{7},{12},{14},{4},{5},{3},{12},{7},{12},{14},{2},{4},{4},{14},{5},{12},{3},{8},{10},{7},{7},{6},{14},{17},{16},{15},{17},{17},{12},{3},{11},{7},{13},{20},{16},{17},{8},{12},{19},{15},{16},{14},{11},{10},{19},{14},{12},{6},{20},{10},{17},{13},{8},{12},{7},{6},{7},{6},{6},{2},{19},{4},{9},{8},{11},{4},{4},{6},{7},{12},{7},{10},{11},{12},{19},{5},{7},{7},{5},{15},{16},{9},{6},{4},{4},{15},{10},{7},{9},{5},{2},{6},{7},{5},{4},{4},{5},{6},{5},{8},{8},{9},{8},{9},{5},{5},{11},{11},{16},{13},{12},{5},{5},{12},{12},{16},{6},{6},{17},{10},{14},{6},{13},{8},{13},{14},{9},{5},{6},{7},{17},{18},{19},{8},{15},{15},{7},{12},{1},{3},{1},{1},{43},{250},{8},{145},{345},{2},{10},{17},{62},{97},{89},{81},{75},{118},{91},{79},{27},{51},{194},{13},{14},{284},{316},{68},{54},{72},{72},{57},{13},{48},{62},{11},{32},{78},{57},{43},{13},{18},{40},{42},{13},{7},{61},{9},{64},{49},{117},{254},{67},{365},{30},{77},{39},{41},{42},{33},{23},{60},{36},{63},{97},{11},{13},{13},{13},{17},{17},{64},{90},{133},{12},{9},{173},{35},{30},{59},{46},{70},{1}};
    #if (CYTHON_COMPRESS_STRINGS) == 3 && __PYX_LIMITED_VERSION_HEX >= 0x030e0000 /* compression: zstd (6816 bytes) */
const char* const cstring = "(\265/\375`(@\265\324\000j\325\374,I\360\316\272\001\314\300\304\210\233\032\344\235\"\251\200\025RH*`\205\024\222\n[\272\205\014j\231Q\263l\327\216\332\347\344\023\331Qx\302\363}\037\246\234\t\323^\335B`\020_R`\345F\202\350S\221\201\201\342\021E\024\221\004\006\207\002\240\002\326\002\023L\246.\322l\247p\007F\364,%/\317\021\207\241\026\317Q\233aX\226T\343\016Q\251\016\223\262\"E\007\031^\221\242\003\036\255H1\352@\352X&Ix\005-\005\007\230\316\351\232X\r\357\224\272\337\261\035\n\270\003\007\334G\217\323$,\316t\337c\271a8\210\261\\\352\"\027q\024p\031\216c>\2202\202)y\330\342\250m\266\\+}xI+ol\34193sy\303\271/o<'A\3369\336\tM\335\317\035\rj\362\324\271\030\336\342\366g\366\334l\221\232$IZ\0243\356cyr\177\262\306\314I\314\243E\220U\322\235\3142\243p\204K\335\263M\227\370\3449,K\341R/\267'\367\031\353\272\367L\212\261\256\315\026\014-,\255\257e\346H\035\333\244\036O\332\363\225.\371jV\356Z\337\242\256\225vvp\326d\013\227\272\336~\223;\226m\236<\263L\217\230\257F<~Vj2\334\301z\334=\334\264a\337\317\256yD\23756\231\\\205e\034G\305\001\2252O/f\331YfU)\305\345B\030\332\250J^\203\246\366\272\226\315\334\262Q\341\322\254\244IxG\373P\334d\354\264\355\354\300>0|}\260O\345\275\274VI\3733\266M\357\275\035\334\265\271\317[\251g8\247i\330\003Q,6*o\333\246\330sf6c\333\006\367\215\3133,a4\302#q$A\217\274\206\307\236\224Q\243\3308Gf\222ij\3347\231\267\337ej\324\336\3446\333\331S\243\231i\372,\2232\332\314>5s\313\230\332\3061\251\3052\213\243&w\226\311\311\311\266-\233>\345\rx\"\306*?\335\263\315\355\263\257\355r\343\266J\324(\033\356\313e\323\314\245\222\363\370\234\210M.\263\235>\363t\234\363\266\332\267\361\030\001\243z\204R\217\2005\230\032\007o\032\367\266\234y\352%\337\275\324\265=b/js\3672\233~G\233\334\367\035<\226\031\357\220Y\344\344\016\217a\257\373\010k[\316c\036\277}0N\217\345\256qS\246\311X\366\333\364a\031q9\333\275\347\234\311k\272\206\313\215\373\311\317\331\366%\027q\337\330\347\030\316X\373\254M\021\347\310\222\3432\237J}\363x\254u\357\321%\036\311\223\363\200\270D""\222\271\3261\347\036\367\354\323\365\270M\337\261\356\334\206\323\330\363\022w\315G\354\243w\0176\265Lv\306`\r\001\272V\323\265^C\245N\220:\314>\345\251\315>\243\365\220\343v\337\265\035\216{\334\243\231yz\357]\334\345\351s\315\344\262\036\363\241.u\256V;\307\276Enz\233H\023\303\260\367P\024i1\335s\254\207b\330u\271\375\311K|\213e\256g\035\206\241\230\305X\036sV\031K\245\036\035\031\234\325g\023~76\036N/\263j\267\316\322\352\246\034\365\214\213\372\325\265\331\252a\301\270\007\373F\245\314\323g\2235j\335\311\034\326\314-\223m\2337m\341\250M\221\265\315\234\356\313\223\217\272s\362$\226\332kS\334a\214G4\263\006cn\300\n&\027\014\026.\270\264T\250\020\232<\032\020\365}\340\007\216Z\2033\253\027_\325\370\010\202\255\326\347\261\302\320\003_/\231~\255B/n\024.\327j\321\262\316\341\034F\023\271\271m\270\025\253\025\"e\023s\003[}4\260\033/D}\260\323\007c\275Z8\237*\365j\231L\340\251\246\345O\233?Y93&\3457.\014}\311O^\327\235\247\347\260\373qs\323w=\346l\\45\217x\202|\325\363\361\325\250K\363\364\372\325a\232\264mO\236*.+S ,\025\023\202767(\226\312\306\306\213%\027\313\024\230m\236\25769\226\231\306wN\223i\314\235m%\036\277s\264'g^ZL\030*\300@\326\314\013\224\351>\205\313\252Q\217\372\033u\251\373\356\266M\222\037\352{\261`'O\206u\nM4\250\323\327\313\235k\274\334\276\334\262\256g\0335\352\236\327\247\305\335\243Q\341X\nM\036\362p\324\2632\277Jm\323i\345\3113\332F\177\362\364\260\314\232\024\313\223\225}F\201\341*\345\251X(\013\025\300\017\325\362^9\253\231\024\370\245`)\233T\214\327\362N\241\316W\363\372V\337\014\370\341\244^\237\315\215'\363\241>\324\226mo\352Sn\346\301Soy\252\020\004=\233\323\212\225\002_\037\316\013\203\014\354\246v\226:\344>\374Z:\260P\005\246V\036\315\351S\2055\247\360\203y\247\224L\n\366\372N\260\324*\025\322\300R9\241\315wZy\247\017\364bbN2\343\200\254\227\251\3223q\217a\317>\373\356u\017\303\222\357\333f\3141\335\233\315\270\215\307K/\225:\201\236\3524\023s\372^0\017\346\241BXK\347uZ}\341)\346\024\202\237\207\201E\346\317R)\373<b2\237)\263l\312\260""\326\246'\225{\344=\005\ts\300\345l\2450!\037g\242\304/A\342\223h\375\021\356\0007\203e\035QE<\226f\305XI\254\211\265`\362q\350\r\335\205\310\3718]\001\335\315\305\265 \255\001\222\237\223\327\022\203\357\001Rsh\001\024\365\243\361\302\276L\347\322\221\270\336\312_\271\211\324\220*\246%-\353\212\2115\327\t\035\257\202\177c_\254K\311w\245+\035\034o(\005\245(\003\031;\227\nAM\341\"\244^HE\256O\202\304\206\330\t\246\025\203\n\001\027\3623\026\374\325[%\204\374\220\216W\224\276\344\340|\234\357\223>J=9\251>5iA\260-%\277d\303\245\262@[v\267\025\304\343\233Vxk\003\025\005\272\177\\?\t2<\027\372\201^\030eU'\335\205t\264V\345\217*JF^-\254\010\360\252\302@\204_lB\322\300\205\347\302\245\343\355\306{\003\3730\357\203\\\023\226\344c\244\"\246\217JI2v\257\017\377\326r\260\337\243\"\006\026|\274!\335\310\365\300\246\254]\215\240\366\324\204\343\203\324\220TDC6@\253I:\362G:^\223\203\0049\365AO\246\266\266\372\250 \352\310E\231\374\226\264A\310\365T^Q\253\341\004\277\2415\305\201\013k;\254|\257\216\026\374\005\241\327c[ \374\224T\0065\241\242\366\206\235\2551k\230~\244#\031\257\327\236l\0016\266\226J\376I\312 cgjE\355\010\013bK*\307\006\200\214\027!\024\364fW\247\365Z\031\373\340\217\244\260\235\207~h\2747W\352`]\301\370!\326\204?\306\370&vf5\255+\036\337\377pd\354<\267A\013jMV\320J\372\370\030hG\306\316\324\nhG\254,\322\215\272\320\005\032;W\n!M\361\303\241\361\202\257\377\242S\321\026hC\330\321\372\242\316\2444h\206\037\r\221+\323\346\260=k\313\352\325\222t\244\355\220\362SD>\n\375@C4\336\214\202\250\"\216\337a\000\000\201\027&U\244\222(H\307\373\341\361\202\332\033\373b\362M:\336\004\032\257)\025\220v\010\271$X\217UYG\365D\275Ig\350\206[\232S\t\250\002\r\2254\224\242\370i\371A\220\2613)y]\254\213\311{['4x=\365D\344\005\261^\232\203V@=4^W\352\245\345\317\206\306\273\221\340u\271+m\250\315\200\362O\324\007\031\273\354\312P\370\0240>\000\020\316\354g?\317r\223\247\367\341<>\234\345\263{\3614\271\357\335\233&\357}\223\343\366\275\3542R\367\356c\332L\257\315\336{\326\2446\315\031N""\223\371\274\305\262\357)?\232x\326\316N\023u\267i\323\026\206\335\207%\233\215\217$\347\245\217\256\355\261,\267\311\315\260\3349,P\032BJG\320/\205\311\370\031\030\273P\210\250\364u8\322\214\003h\350\365\300\004\343\337~P\330\221\225\226\236\214|h\344V\247DC\272\220\016\346zn\006\216\220\013rQ@\252\310\205\256\374\034\300xA5 U\244\226p\215HCp\274,\022^\021\210EYE\244~\312\207\355\036\270'\226\317\342\340;\200\255!h4#\320\236\032\221:\246\0330\344\235\277\023\363W,M\212G:\242`\204z\220n\255\0106\204\n\270sg^Vi\006\257UaI\325\305\246.\25482\0032\214\022\235\020\177\204N\245\313\341x5\253\004T\334\303\212\000\255(/Hw\242\205!}\222\010N\247<\350\t\252\200\344\315l\213\023\217\014\020\356\n\026\307\263\003\255\267\006\241\004\357N\244\203\200\256C\213\201\004K\035|\270\036\230X\001'5D!\240/=.\210;\332\201\324[Z E1\215R\222+\235\211n\037\t^\221{\000\205\312\2222\010\201$xE\354\313:\343\222\316\2306^h\222\267\304\301\033\002\002\262`\247\323\220\023\255$\325\244\nPG\240\013BP\321\304\205\001\3719\250orY\005B\272T\313\2779}\221\210\255P\362}P\221\254\216B\",\022\215\367\300\315\235\261\360_R\022\021:\237\246[y##(##!?\243\026\372M\327r`\203\\\n\036\352\221]\227\333\003RQ>\2575\361\2549\252GA\\\\j\004\016\326\301zA\244K\321\356\374\340gC\004\372\341\3720]\312\245i1\\&\235w\013\270.\255g\367\312#\322\266\264\014V\324\007\242t<\245+@\251\215\313\265\246T\0145\227SW: m\271Y5\254P\321\032ZEuC\307\307\377HuV\027\250\243P\352'\201\201\214\202`\321\270B\264lNma3`P\371\036J\303jX7\264\243\337\242\236x-\007\224\217b\240=\261\202P7\376\256\303\005\322\241\\\223\213C\023z\000\252=&\027A\233\301\"zE;\247\026R\025\001t\002\204\010\021 ''@M\200\232\000\037\000\000x\321B\365olf-\260\010@\254_'\210v\236\332@dA\311S3\360\362\347\237q\276\216n\305\035iG$2\\No\204\210\237B\227u-\332\334\302\250\374\027\366\3046Xa:\244)h\010\r\201\334\017\022\276\204\006\177\246Fg\223U\t&\025\202GJ\342\241\361C\n<\3644o\377f\3736\332\247\315\376lC\305e\355\327\310O\312\276L\347\303\350\020\270\271\333*BM\2459""\007^H`a+\313\016\347\346\257\350@\230>\355L#\204R\216\232\202\320\307\nS?\324\317\224\"\010\245\006R\217W\324\361C\264\366\243\205\261.#_D}\\\356\207{\241MaI\353\030\302CA\250\205Y\005\254\244\2076\250\343H\232 \225N\325\214H\222\224$\035S@@\240\340\240P,\233U\310\371\363\323\203q&D\"K)b\020b\244D\002\n\322\222\224\2440l\006(b\001-\363-t\333?\035$}l\337\021\300\005\227\005N\005$\307\024\013z\214Z\024\303\302\300#\0271C\265w\305\236B~_c\022\271\326\354\256\031\221egV\230+\347\222\354{\341\001\313\223@<\244dSmZ&$\021\375\245\300\250U~\344\373\262\357Z\225ck\261@\250\"\232V\334\351\201\036R\214\374K\347\177\374Q\2154\265\303\242<u\021\225\027\345)\370\266I\304q\263\217\353\266\242\3006\323\305\014\323\274\233A\036\0050-\334\025 !*\205jsa_\230=5%*\213\216\034o+_v\202O\301\026(\214\227Z\rQw\000\233R_\203j\013\245_\024\305\036\362\2734\224TVF\254\241<\230\\A\005\310\310\324\343\t\023\014\277\363\271'Kx\233\315\262\347\230s\032\035.\221\224'\204+\354\016\353D\323\316\244}\030R\360\003\022S\272_\313\374\221\020\\y\264X\n\335\242\353\202=\210S\246\233\tp?\336\350\200\231\315\342\222\336\253\314\031L ?\254\377\241\213\336\334\263\325\222\372`C.\301\021_\263S\235\366\200\241I\016S\321\265\223\014\327\221\217\250\323\2015\353\257\234\323-\007\317\232\\\353K\n\266\036h\375\204o\343\347\037o\376\217\242\306\363A\270eJK\000\024\232\333\264\2547n\007\035e%V\214\355\312\334?a\276.^\tF}\223\247>7f{\263F\031[^H\343\001\353\367\001\253\363\200xUe?\250\321\222\357\212\3112-\207)\217P\347y\234n\355\\\027\237\013;\304Z\217K\327h,\223\324k\365\251d\2555\356\020\376\362^\023\220C\234\014\373\256mr\233\210\301\332\247e\376\314\357\235B[)'\326\342\216\266*3\000v\032\246\205\222\216\314\240\027\251\231s\326\343{\021\337#HM\372\200\242\177\211>\350\262x\2632\016\317\035\306\243\030\265\201\017\200QY\302\212\34329\346HT\032\313@'B3$\360\206sn\342\035\336\242\336\360a\341}\334IVg\n\340m\007\267\005A\322#\304\300T\271l\324\002\030\323B\313\342lK+@\014p\237L(\001\037\\|j@\351D\342\253\003\331b""\207Q\241\001q\036\255\\f\350\0004\251>a\337\211\326\276\225\326G\013\250aH \203[\005g($\"\267We\201\023\347E\035\030\036\274\024\003\342\350)\271Y\035\220\002T$\221\203j\002\002'IL\301!\323f\315\006f\266\346)A:\333M\033\230\245\225H3\374\361\016\223\334\311\326\217\347\247J\233\025%a/\356\232V\016\307\002\246\232Q\256f\323\001\003\223p\370\024\201\270?rP\030\201G\027\242D\027Op\371\205\330~;\301)\t\311\334\367s\337#\321r\235C\266\244\210\014\2650\2757^\210\210\265\2766\334\325\364\316DSC\354\033O\313\246\013v2\254\310\257>\375\004\026=\303C2[\217)\353\347\300\372dK\302!\212=\262N\303\357r\001\000\nj\327\266\347\010\262\334J\241\273\377\350{W\224\321\342\310\2015\005\246.\002\327\2704\206\023e\224\032\3671\226\220\031\317\274\360!#\002C*wEG\214V\307\225P\3523\241\022\343\313}\271\254:\324\331\344;\032$\341*%\305\301>\357\331\371`k\010\010\030\214N\270\237\321\005\014\374\25202\000{\250P\224j \360\037K\303\330\3736>S\240l\t\"\241/\2407X\212H\327\342\220\026\010k\220\336bDkt\213\214\251`\035$\241FU~\210\322\332g\020\235\277\365\t\335I\230\025\2567\262\2147S\233\003\016A\321\270s'`\322l>\244\206\247\033}\036.\371%\225\360\227Z-\227\237\nj\203\254\370\354`\272\230\000\004v\333\r\242\226\327.0\361 \360\220\002aa>N\270}\327\224\326\374\270e\363 lq\310\323xHI\023m\2179NZ#\246\206c\260\333\271d\r:\247\301\020\323y\377\260\301\323\354\311\330\265k5\202{\256~}\027\2615N\305U\007m\201\243nus\016\320\360\261\010W\257\344:6\302-I\324c\004I\004\341\235\311Jd\021[\003\310\212Z\307\310\346&\035\252B\241\306\205\360\347Q\205\2124\235,e\033\225\326H\277\242\256\353\340\334\267\377\035\246\233\301\217\014\253\037\014\265\002-,\005\\\301\202q\002L\256!\n\324\230\256\025\310\221\000_\257\373\314z\244\330\000\336\211\003\024e\222x\213l\2239\215\234R'\207\325\031\330\215g\276\271\r\231\217\305\357s\313\3157eF|\253\017N\314\014\265\010ik\363\027\227\202\346<~\261\305\226w\332@\2740,\204;\010\304\325x\325*\000#\214N\375\351\037E\004\254\211\320|\"d\252T\236D\362M\023J=\322\r\223\213\204y""\305\241u\361\303\275Lt\343\272\266\350\351\315S:;\301)q\270\026l\225N\316Q0/gW\217\205s\021u\210\331\207\335L\317\264\014&y\022%an3\030\207\3425\312r\364\213+\035\020X\303\266\264eb\354U\254\310\350\372y\204\331\303\205E]\207\207\256\346h\315\237\347\212{\214\362\305\020\226,\024\357B7\227Z\203\326a+\226\017gD\231\\\347\007\356a\003\350\020\351{(q\330T\256\177\270U\203\275\027\241F\2001\344R(\206Tt\216\206`r\246\222l\306l\307%\205\333j\226\213l\004$W5H\275\306\215\330\257\317\2449\234\250p\374\213\200\345\262M\203\030\357\265\327\013jg\241\260\327\206\034\214\201\221\203\276\t\022r\3252p\034.g\303\3307d\251\263&\304Y\375@x\353~\216c\271A\237v\343T\3760rT\270\305\302~Rx\342@\242\353\333\017\346*\325\270\3067\353\343\252\025u\363>\332\332\232z[\226}\307s\270\317\343T\2578B)`\276\2144\377$\246\017e\270\013\253P\253\253X\332}\306\223\316\263gx\302\233\215\204\014\007\341\334U?\241\330M\240\273%+\360W\300\005\317&@mE\372\203\332\336%\rGK\266\255\333\203G\351wB-\302:1\230\363\302\005\221\266+A#qmC\014\351:.\353\034r\217\355\036)5F\312\222\363v\246\263\350\232\262\265\351\306\2340\341\007\256\007\r\201\327\023\375\016G\255\245)\211\216\375\002\307\2479\034PO1\311\267{E\231\370)\2643\"\225e'\222\032\305\202Ul\247\354Y64\201,S\000\252NI\261\267c\334e\305o42\033\335T\024&\0308x\362~|%\271)\375(\331\200?\261j\330\222+\353\230\207Xm\231\272\23621%C1\304t\t\003;gD=\032$,N\227<\267E{\252\272\302\3752}\226j\232\002\334\240\307\205\244\006\177#i\312\033b8\032\007q\207>[)\336\317\006$\365U\211oj\215Q\320\035\311\014\223\246!+*\221\352\027\305\365\007}\265\203\004\254\370\362\344\261h\330~]\341\232?\256\330}8\356\261\207\n\301K\025q\026%J\315G\323\026\035qj31Dey}\252\270\\\223\251\263\332\322d\371\334\302^\324c\302oW\325\\wu\332\225\013\272Bk\240'Y\361\356\342\003\221.\363\371A+\240XrI\317\0342+\271y\234IG\337c\214\336\362\002m\225\214\203\317P\010\210\374\317\342\202\266\330\201\314\357&\006\336!\246I\351\016\213~L\353\364\204\300\215T\357\205\032`\265\260.\245e\333c\306\305\301""\036\236\253\334t\275\231\322E)(wK\027\3522fI\003\275OqY,2\340l\255AZ$\250Or\307\253\025\007<\256K\366*\376\364<F\001\300@\013\007\333\334\201\2531\344N:\365\261\307(i\03185\274\322\251\244\036\210y\376\213\366z\200o\007\002$cN\033,B>\020$\373+\304\004\332\203mY\254\307\361\355\017\311\255\017\344\265\200\236t\014U\310\344g\224\032\247\202T7R\250v\305&\207\202(\3466\225A\205)\326\025Ap\207hV\227\305z\224g\366\354\353$\373\023\205lZ6\013\014U\025\000\327\202\253\372\271e\315\234,\321t%\216\004{\n\223/w\307\210\332\3640 \323\302\271\020\2064Yu\366$\350\361_\223\021\234\225a\240^\007\302\305\227,\307\275\245\321\311%\333\336\305I\330\363\306~Q\370\246\334\260\001;c\262\350\366\262\222\2015\332h\266\300P\232\315l\013y\020\016\200\350\306\nC\240\323\n#\263\037\217c\032\315sV\205\262\017f\361\344W#\316;\266L\365;\021.\327\366\304\020\3275=\230w\343)(\223|B)\374h\313\251\276U\344\203\256\340*\222\373*,\326\341\241\r\331\243\226q\344r\312W]\226\r\274\010VA}\026NiZ\032`z\0103O\305R\234\250\314Y\244\206\244\317Z\336\225\tr&\253}J\261IJh\223\365QW\222\230\017w+\257\355\315\321f\341\317\r \325\030'n\317\342\357\202\313\2423\2633\220\346\236&-\032\232\202\311\244\350\246\362\264Agh\2709\235\\\204\356\275\202RI\316\002t!\220\372\250P?\303\225f}\200\232\314Z\335\353%\201^&2\034|\342\013\004/>\010\203(\246=\215S\3549\013\001a\355\352f\216%\376E\361\216\252B\006\006\262\274\373\033\224iT\244\000\207\212\270\337\037\032t.\331=H\205A\002\n\271{L\035\357\334+\020\222\326YC\364\355\223:KWkb\200\313m\244\220jR\036\337[\ta\013\277\204\017z\315=\347\004frWf\207\204V%\335?[\343XW\234\352\255/\357\024\216z^\014w\254\357|\005\364\257Z\270\375~K!\030\276\323\206\244,I\211\333\360\306#U\264!k\316\233]\241\226N,\340\344p\317G\000N\355\226.\306K\272\372F\362:\027J\200BR\366\035\013UV\300\006em\226\331\002\332L\332I\345\360\254\025w8\364\nO\251wsHKG.\013I\027\300\345\262\220[i<\351a\305\017\320\203\242\256:mfq\244\357\300\"\232\030^\377\322v\300\265\231(\031b\242%e\352\326\0006\004I\331\365\234""\275\276\367\261\302|d\354\270Y\"\313\243\n<\034;\253\301_\212\233\231\371F\254\314>\376\033\223Ir\333\000\000F$Eu\263h\216\223\233\335\371B \253\0017\020\214\322e\350\313\221l_z\275\020\317\212|\"x\275\004\332\017\325\336\231\032\324\245\003\002e\313\334Z\n\005#\233\205(~9\353\304\246\032\226m\377\312\275\201\210\342\240\370Zs\300\227%yY3`\204\213\223fZ\327\304\020\344\022\200\220\252e\252{eU]\364\242\272\032s\033\330c6\206\334\330lS\2265\266\2549\350\351\004\346b \021@iL\322\240\343J>\007\377\021\017B`\304\026\330\010b\025T;t\020\202\036T!0\373\237\263]\036Gz\220p\220XR\337\014\224\351\326\205\333\352pL\027\346\326A\031\312`\250\003\311dF\362\3356\177\271z\214F\t\324C\237\2006\351\023\347\316\273\217\n\341\227Zj\2108\232#\005\3728\236\363Zb\030#~\374&N[SfXA\031\252\351\267\000\014\\\310N\271}\347\"i?\350\365\377\310rye\224o\226\031\353\377\273\333\027\313\003g\022\037\336A|\017c\263s}\020i\0314\240\275\224l;\032\002\352\375\3510\nq\204Es+\306\213-og\224\360\303\230Df\247 \2723\317\325\271\351H\307\246Y\023,X\363W\344\027\355V\372\366\362\322\023\306\252<;\3318\300\2741\266\003@B\244\323\315\313\177\266\017\014nUM$\250\241\210\020\2404\031\2071\205C]CA>a\353\230B\337\264\240\216\234\000\350w'\3335\207\375\003\034\010\277L\235\221\023\036R\230\315,\216\316g,\227*C\245\313$\026\334\010aSW\221`@\341<\312\020*q\024\002\321\023e\334.nl\003|mc\301.\237=\036K3\035\003\334\374\2524U\305\265\034\314\252^c\014R\371\256'\245T\224\261E\302\002\r\223\244\3706\377<\241\r\325\261\377\r\305o\353\300\327\"W\243*H\232\304\327\010&j\271\350\227\017h\036\016\333~E\306Z\001\250\013\334b\352\r\352)r\271\3260\215\230\361m\215\336\013\345\014\322\027a\227@1+\217\263U;\353v*\360\027\336\360x\022\236\213I\215f\374\001de\0262\262H\260\236\n\013$h\210I:\251\004\355\367\023\265\330\277\321Fi%VP\003\273kP\372c\320\232\245\t\0330\335/\nG\303g\324[ZG\240\312\007\333\213\203\033\265\310\031\216F_2\313B0W\345\006\211\322\204\315\331\317\262\2449%\016\307\314\354\243.U\r1u\222R\347d\021\360\325\343d""\324\322uI\357\034^\220\237\235\201\2101\264I{\361\330\216\216\367=Q\n\340e\347\367\036\345\013g\374\332_\330> o\300 \0268\212\001ME`hw\312t?\\\367E\026\010\351%\204\022\0275O\0375\327B\205?\372\371\345\200\201=\312\274x\245\3729\302\3662\330\250\224\2128\276\200T\032\320\331\203\315b\340\2727\001\243\272#\220\006;\311\301\313j'\272\223\002r\255\364\315\371\273\210$\355\353\235d)\026\311\376VZ(W\233\253'hQ\023.\274h\311\365\025{>\300p\335\342l\315\316NatI\316\340\266$|;\023\212\271\300\233\3563N\022G3\325\304X|\032\302\005\005\373+\315o!\267E.;\262sg\204\200\254\037U\322\231\243W\2251a\007\242\252\026\237x\016\334\301\006<\210)4\2412!\033L\3008\207-/\r\364?]\255x\226\345g\037I\235s\345h]rR\2249!R\360\264\346 ^\033\244Q\244\235\357\001w\026\000t\346,\254\322\376q\020/\271\340\267\264d~\255\036c\031\203\342Q\253\314\200\253\270rV\022=\272\013\367C\035p\370m\232V\374\202\027\014\377\357g\312\022\034\034\320\377-6g\326I\036DXM\352\2333!\r\352\026s\300m\205\261\331\007x\347\276\025\275q4\305\367\352s\201\330%\207\307\264\210\016\271$\237u\304M6\217\005\323\013\276Mt\024\235\316\333\277nt\377\231\340\205\017\2219\326\265!\210\231\375G\313\215\243F\022\"\250\202M5~e\250d\354S4\336%?\361\346c\375Vb'M\246s\346\310\026\225-,/\320@\334Q\266~\205\231\335\220\"%\340t=Lt\315&\323E";
    PyObject *data = __Pyx_DecompressString(cstring, 6816, 3);
    if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error)
    const char* const bytes = __Pyx_PyBytes_AsString(data);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) }
    #endif
    #elif (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (6791 bytes) */
const char* const cstring = "BZh91AY&SYl\254\353C\000\005\224\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\300@@@@@@@@@@@@\000@\000`\035=\316\305F\276\207\327K\3537\257\275\247\237v\275\354\370\2517\267\257v{\265U\251\325NA\357{\317<v\231\334V\331%\2413\000\254ciB\316\316\346\333\241\263\234\351\005\2659\265\274\004\200>\251\276\212\034%\010\202!\246&@\324\364\236\206\221\223M\223#Si\246 \321\242e'\215Chj\2151\351G\351\251\033\324jmC\323)\275$\330\2235\000H\240\023 M\010\204\331F\232\0244m4\332\247\231'\246\250\007\250\003\324\000\000\000\310\0002\017D\000\0004\310 \240\215G\250\217F\246SC\324\307\240\247\247\242CM4\333I\264\221\210\036\240\321\246\231\007\250\000\007\250h\000=\r#\324\022iDI\232\212z)\236\232S=HoT\014F\230C hh\0002\r\001\223\023L\200\000\032i\223F\232\001\2105\022\032\206`\221\352=@\000\364\203'\251\352\036\240\000\001\241\220\320\000\000\323C@\311\352<\240\r\000\000H\221\001\014!0\214\232L\230\002d\215\250S\322l\223\324\332\236\241\240\320\000\000z\200\006\215\000\000\003A\353\2056\345\337\013\264i\021\254Q\214AJ\225u\017(\017=\177\316\377\277\3560\014\341\235\275\320\336\360o\000\367\325\312\360\013U\260\251\302D, \356\246\316\343\000!\023V\207\023k9 \301\036\257\255\367\273\277}\335\364\260\265\257\237\017\204\237\0133n\"\252\240V\252E\215|)\"\273\316uU\254\345T\006\021\204\301\2616\242 $\213\000b\"\212\212\304E`D\025\024Q\210\212meX\252\305\214\021A\030\n\010\221dDRE\025E\216\375\373\372;\020\22393\303\234./U\253CObU\000'\261\275J\232\244\215Z\023hm$\233\020\244\221a\016P\340M\344\014\345T\031\007\225\007&I\323\rd\222\235fMcxyA\024/Q+\253\n\2004\206\306\301\232\234mr[\321.\341,\001\206\2206\233K\000\3610*\300\033`\306(!\257iJ\215\033lk\313H-a\t2\370[\347#q*\002\260Y\207!\263\265\345\321\305\257c\025\005\205t/\020dS\2011U\000b\305\005`\305\034Y\t\214\225-:=9f\006\215\264\226O\334F\351)\206\362T\032\0066\353*\010\353\251T\022\n^.\007\021\211YZYLK\260\244\354\003)\2325\321f\301&\357\267\332UVh\332\267\203\021\256A\251\256\2778\270\273n`W|\221\200""\277E5\366\253\267tc\231<\031\njm\361,\331A6A<\352\221\311i\240r)4L\3062We\244\022NUn\245R\313\"\205Ox\323\251|\337:\225:H\337\036\"\212\2010\324\327\247\277B\211\264y\254\036<\222\033\311\330M2\004e\304\227\235\331`\tM\031\324Ce\007L\265\366\344\255\352\372\034\240@\343\335\036>\0143\314\350\216{m\312Q\371\255>z\326\251NL\373\0243\217\371b\322\237\370B\372Y\315=J\001\036\311\331\217\365!\316}G\313\200A\335[\024h\2359}Q\001;D\\\212c\334\367}\007\221>\332\372\361\312\361\234\277O?\364\216{e\225\300\353N\303\"p\327\207\224\250\355'a\307\352dP\253&O\234b\344X\260\177\274\021K/\013\351\035\261#\024\353y\325\276W\256\310\255#\254\365\264HF\032\0052\271)\331\007\000A\203\207\277\265\213\332\3331\221t\212a$\r}\273x\275.\211\250h0;\345+Y*\211\334\212\262\"\306\014\034iq\\\211\032!\250\232\211h6\207X\207\227\3225Ia\020\"\213<\036\215\3215B\202\177,3\356ni\356\020\333\246\206\233\036\216\204\322\271\346\2451\351\016v\260Y%G\310^a\266\332#%,\313\313^\332\0248:t\237\320\363\373\337S\330\353\266\376\323^~\016\000\356\340_t\303\216\016;\263XKg\214x\261\217F\331+o\344a\014\231\204\3125j\036\\D\240\235\254BT\302\226\314\251R\222~\036\010\224p^\204\237\017$\233Kl_\375}<Xl1\372\375;\014\334\016\024ND\273\203\307v\274L\020\265`\255\310\177_\262\272\317\350\353\231\362I\0232\014\242\345\216\336!&\327\020\320\003\372[\rl\341\200\3058\365\255\222\010!HPP_\211\360\2608+\363)As\234\016\n\3450\300\305\265X\337\007\000h\263!0\212\237>\004\030\207\266$\t\000\272 \313\263\310\303\335\324\032.\274\300\365 f\3074w\362\020\217\265\241\226hW\353\304\232\271\002\307\243\005\326~\000\204\301\r\3255\177$d\001\336\034n6\353\362:\275N\274\204\304KK\rr\007\010\262\016\244Up\277\\\310{\340C\n\301k\260D\\D\202^]\020\257g!\304\207\016Y\240\303;1\364\337\315\317\\\227\313\335\000\244\370\216\227>\017\007\354>!\331\247\323\276\362\350\010\3143\\\364\017G\355x9\366\036\014\262\312\277\303\331\255)C\200\356\353\237\223O\304\357\346\027\277:|\263\320'3\010\254N6\264y\326]\211bP\036y\034\274!\374\034 \327\340t>1""\202\366\03708\351c\326\004\202I!N\206T,\342\222!p\247\375\333\221\213\213)\014(\215\244\3730\360v\021\352\242\221E>3&\206Y!\217\232\245\372\366\020\260qS\227\263\346\372?3\376\357\261\025F\276\266\000s\212\225\304\347/\255\362\235\305\262\310\312;\352\203\314f\007n\371\353n\037\331J!xV*\356\203-)\327e\376Z`8G\t\234\031i\nfg\3663Z\264\214\016$\2348U\205C\202\026\320\305l\315\022\266\223]u&\332\272\010\330\211\005\204\230)\323P-i\227\026\006 \331\300\347j\336\361\366\217\354\334\330\351{\r\250\330>\270\350\212\311\325\332`42\340N\262\376\002\300D\037X\014L~t\311\330D=yt\333\344-v)\366\010P8\320\217\036\221\233\230\224\0213-\244\302y7&\211\326\001\350\375\232DWdT\212\252\327\357o\203T\307\227\213\251Jf\021\003\324\315\216R\201\222\333\342\311\320RU^/\342\224|<\207\031\364\370\222\3373\034\266g\367\001={\211\313\335\022 \224\320uo\353\265w\036\235\375\374\325\335]\006\\\201\2322\301#e!P]\350\371\214.E\026\036Y`\271\363z\270\021\276\331k\216\034;\277+\251\305\232TDjy\231\222\342\313@\240G\034\325\232\263P\232\230\010j\0233\235:\0050\010\251z\355\353\255g]^\005\335\337\177IOI\320\216\244\033C\223U\320@\261z0|\213)\216(\361\317?^V\201C\010\302y\237\210bj9&v\241\206\202\007N\014dhh\230YIM\014\234\234\236H3g\013\034ex\225\242\026B\231K%WXK\324\203-\nT\213\372\220\003\363\014\360}\337EP4\271\302\376\205\256?8\344>\217(\324\315\226\016J\207\276U\032\342\331P\335\032N\377\233\322\361\345\350<,\364A\336\3513\363\230S\247\036\202Z[i\365\365\325Q\247N\375\2724\2604\032\023\272\367\325:\340dX\371%\010\353r|n\276x&\322\372\225\266q\347/\007o\271\312.\035\320\010!\033$\234\\g)\271\021\216\270\247M\374A\325\235\261\003\263\351H;\241\032\030\323\037q\301\323\254\366\344{\326B\2464\363\236:{\276\335\375\033\270{\376\336\355d\270\266n7\347\312\232\325\242z\345\256\222\223V\266\251\214Tm\254UV\322\327!\304\\f\270nt\3208\264\234\3477Gk\304^\302>\325o\031\245\366\275k\016\333v\374\226J\261B%fB\307\223\334s9g z\367\305\263\361W\032k`\017\377S\341\307&\222\323K\034\324\\\233\016\353\366\321""\346s\322\010C\\,H\"\2128\335\026Tt\312e\234[Q\036R\204\031\033Xt,\346\337\255\342\027\235w\236\343\320\030~\267\234\212\265W-\010\250\320\235\210\360\202\231\364u\3606\261\2665\3108\353\377.Cd}\276\313\257\274\357\016\246\322\307\251M\204\245\353\227W\021V\224E]\340m\320\350\026\301d.\372\236w\321c\272\315\345j\007D\236\211\362w\271\226\034\325y\252\222\366TR\345\314K\252\271\277\000k\203\373\200\314,1F\206\363@;2\014\01382,C\001\237\332($\354r\206N\265\003 \310HB\2165\025r;e\242\272\351\202\223\250\324ZeU8a\025i\327I\257V\276/7M[\251\250\034\256\\a\020\321\3074\223\263P\252\362\256D\362\216+\2203\245\272{\314t(O\233N\231#\005\370\330\325\353\262\242\211\3535\232\267\364\333\312\033\364Fp\233\3071\207U]Y\333\030\351\n)|wn\356\303\3133P\330\330\225\211}\246\246~\032QI\344\327Q\243:\214(\212\2607X\014S\024jW\203\023\022~4\234\245\235<~\372\257\214\263\265\014\371r@\313Q}\231:\376\032B\351\227U\320tP[Gi'\362\t2I$\024\036H\367V\367\346\010h\320\030\322\2375\2337A\326\326\201A\315P\220$*C\323\353\322\236\204\306\355\207\235\252\362 =\027#\245\313\177J\207\005\220aG8\264mf\240\335\233L\275\344^\031\344\230C\020P\306\224\304\261\370\260\274\t\363t\2001\331X\211\314\032J \240\007\231VhJ\210\261\352\324\366-^^\" \361\272t\222\363\264D\3064b\242\025\013\027\024H\317\231\332}0\201:\253,\000\336\304\276\202\300\007'^\"\" qHt\332\276\237\216QwuN\304\007\213\350L\020C\225\364\\bn\367Wn0q\2000\001t]\330y\240\241\t\240\004\367\"\004e\332\022d\240X\310\017\212%W\201\252\004V\006r\035M\240\355\004B[7\237\307\231\233\212\206S\226e\330\312\002\316\301\026U\003T\216L\2406\220\205\302\016]\362\200.&\344\354\331)J\021\227\370\361\241\226\233m\2414K\016\020`\2121!\242\243\202\313\206\2639\351\2773\016y\305\305\301\324\310\366\374~Y\331\032c<\211\341\351\032Nz=J\350\272\377V\344\253\313\341\356\243&\353\311[f\333\345\033\250\237\262E8\021\371M\304\006\246\270\201\037\216\347\266\360\345S\310\242\010\271\327\262\203\351e;g\364\030\236L8S\375\234jlh\270\233\255\201\365Mh3\017)\n\327\274\327/""\371\207\016\000\211\021\006\206\232\254\370-\365\177>\3254f>\372DrK\0018$\273\273\314\300\363H\321\033E\247.@0>\004U\211\367\226E\340\004P\212\243\333\374jS\335\352\341\021\031\253\004c6\332\t\2704\017\341F\211\241\215\203Z\213Kv\223kc\310b\353\204\347e=\256z\366\205\374@a\204\241\231\344\363\240\030\213\006\346\\\r\366\334~\006r3\220\324\247\221\022\006\355Wrj\206\r\324\301J\261\003W\213\244\337\246\360\020$U\000WR\226\223\026\005'&`\223q\205\312\205;<E\302\346\212=\004v\320>\362m\220\347\026\364\370\240\3160]#\024\320\357\n\370\232\200'}\230o\362\316\321\271\313\036P\344\200\200\253d)\032\352\374\021\035\354C\021@T\304\353J\332\311\003*\364\211\010\0362\354\347\240\312\2628W{\360\237\007M*\334\205q\267\336\240\261\273\260\205V\010D\262I&\263\320S\342\3151#H\020\347\025\347dG\226xL\316\023s\177\203\016C\252\037\263\227\022\266\360D\376Rd\t\326\023\207\030\241=\236\324,A;6\333\030\333m\265Q\212i\260LH\035\202H\211\276\331\035\002\237!\235]\r\216\001\003\266:\016\323\242\360\336\300H\305=><{\230g\016\003c\026\322\254D\005\202#e+\030\212\225\253;}%3\306\353\306\244\367q\367\260Z\031\223=\232\315\310\276\327\201L\316\220C\225\"\355\024\231\234&\273 \213\030\317=\242\205)\316!\000k$g\n;N(E0V\336\260\325w\343\206\0336t\374\033\343\"P\320(\354\334qp\355\314\222\327T\303\247-\275y\312k\277\001\265\227\302\324\274wW\004\214\323i-iFi\346\003Z\355\342M\336l]\215\024F\207\251\315n\3730L\016Q\3048\373\243ln\301J\232*\252\252\252\252\252\252\252\2114\270\333\206\230\332\305\t\303ysg\275\004\237E\312\217\234M@\262]\220\271y\000\320\2554d\246\327\207\264LY\027\375\010`\333\033\001\261X\332\017YEFi\251\302}u&\270\264\310\234'b\313\236Y[\333\256\215\312v\030\250N\361\210\221D[X\007\250\351\n\333.Z\0132s\303!\003\022\365\353+R\376\026\022\305\226%3\r\212\326\002\035N\300k\036\242B\010\360k`}d2\306+\264\361\372\372\022\272\217\262\266\211\025\315!\330\3102\206\331Aq\342\312\004@\271\324\335\245J\326u\256R\244\310\365\247kPL\304L|6D\341\22390\240\314\016\266\270\211\255\321\301Xvp""\234}{\270\204\232\245!a\355\246\226\024|\002Y\022\263\225g,\334\266B\n\202\244e\370\331~\035=w\224e-\207?Y\356\366R\311:C\210\307\257Q#\r\017\302\224\330\214\325\252\311\023\243t\223\033\010\261\215.\260\355\244DH\223m\266 \357\246\n\033_\302n\215\226\000B\033/\235\233u\354;i\244\225O*^\250\221\271|\315\241\r\2441%\330vvr/\261m\332F/RP-\035\307\325\214EN\212\210\303\023\222\223\356\026P\024\004\317\037\301\254\217^z$\216\177\027\247\323\362\031\243\206.i\226\037\014\016\376j\231\276N\004\240\366\210\217.IY4\250rv~\007\001\215\315\342\313\321\245T\272\326W@\247\231\357\314.aH()U\233\227\306q\340\200\354\023CI\206\030I\010\304+\322\030A\370\243`,\010w\020B\311\244<\r\273c\244\356\272\234A\030\303\200&\375\251\310@\323a\204\350]\335\235\314\252\240DQ%\243@\240\325\005\222e\007\223ln\251g(B3\231\005@\021\240I\244\307J\366\033Ix.\332\253kx\0271Y\361\210_+g\243Y\003\212nP\2112@@U\006\240>ed\330k\264\221^\031L\366\240\333\260\347\225\017U\205\017nb\\\t\242\223\245\206\233\272\374\261d\026\nE\021\021\031\021\006\010 \262(\n( \305\001E\025\005I\311\324gbs\366\0042\204N\207\335\276\206gA\203F{\027\314\342\215\010\356\002\201\366Y*L\200\363\031\262\266\350\347\317<i'\354\210\370\200\215\322Z*w\005\322\315\014i\265\343H\007:\027*d\014M\203\203\241ttz\374\026D\205\230a\246~\021\312\260|\240\2370\013b\324\037\013\371\n\343\225\243\212v9na{E\246N/i\036\027\303Cn|G\236sRL\363\365h\270\344p\272H\201\246{2c\207Q\324\332_\t\210\273[6 2\243PG\221\300#\255\020\235\022\201S)\324\217\003\034\3667B\256V\001\1770\302LT\271\325\337\\\311g\344pZ\371\272\352KX\"\374\320[\231@\006{!\375x\\\036*\365\352\265e\312j\353K;lb-\267\344\0325\243\007|\2410\314\244\324G:\017W'&M4\324I6\345\rD+&\213`\365\223(\030R\032\2308\237\226i\356\326QXq\271P?\035\245\323%\2769\351Fl\003\t\326\004\0365\300\216P\235\245N\322\373:\324E\032\003\000d\373\241\357\315b.\211\253\0042/\327\334\025\360\262\014\241\r\230H\010V\023\224\245\214\3444\247\010!\266\224\331\032TDB\245\006\n,+%VO~\310j\216-\264X\246mD\305\232\223""\027%q+\014\006!\202Uqi\202\256\203\2108\260\002\242\352\225\030cA\261K\020\201$F2g\007\343\320\210\034\027pUP\240V\226\024>\332H\225\304\371\211\211\221\n #C\"\2348\004\301\024\245%\313\210I\002pF6\360\345\352\221\313\302\361\245\320\025\001\2546\220\344\371I\010\202&4\306\006\265b\251\225\007\336)\321R[b\376\230\274\220\373\234&\257\347\346\337u\354\262\360\222\207\014\020D\344\305\3042\310\"Y\030\304\223(\217;\315\257\260\026\001I\212\254\246\024Wg\232\335\277\354=(\317\365\010FX\271\307\256\033\215\324o\032\340\215\233\037?\t#\213\273\322\2441\367b6N\305}*\210\310|\24064\233F}w\346\253\251\260v\340\303\t\331r'\266a\301\000(\310\000\300\006\"\2443\211\251\376a\010\250\030\374\022a\027^wt\273\302\306\205~j\254TLo9\014\2051\020|\020\244\366O\n\225\242\221\251\004\032\327\027\317\035\265\215\215\245\0028\204\332b\311%,\247\224\250\016\374Q=W\235\n\262\367f\324@_\356\236\341s4\264v\315^\037\000\034|\371\241\034\346\354\025Y\006\330\225\305\206TIf!/\031\000\242\305X\261\211.\353rng&\300\2469\273\234\032k\002\2515\177\3053_#\223\362vG\034 6<\260A\032\357\035\021\034\346\002\252>vK\276\235H\365\314\216| \010\021N\004\303HV]\217%e\275\221\335\237\321\257\215\373\376\217\236\337Y\335\371\345u$3y\240\t\035\272\207\371<\333\214A\022^\356\001W\273K\252)\303n\272k\215\002&k:\263e\020dD\0019\354\254\250t\207e\230`b\226Qh\302\235\315\350\222\0309\240\364\3745V\014F&6\306\273\002\224)\214B\006\372\323\335X\213y\210Q\314t\357\\\276N;\204\320f\354\342r\020w\267\264-\\m\343\206\305\376)\021\316\227\314\345)X\344y\342\025\0206\223\022\035WN\246y\205\021K\273\220L\317\216\312\356\226ELso\234\263;\007\201\0202\220N\265\312\301M.Gv\014\2121\036\002]\350bM\311q\375\312\270\263\221\234\2022JJO\276;h\246\202y_\320\022D\347XO0_B\254\224\273)\356\321\366^8S\244F\324\323+\211\3451\363e\355+\213\336n]\315\363\221\n\021LnIm\222\r\024w\215sXn\316\376\234k\2671\327\241.\211Z\367\357\365r4\336\204\342\365g\260\320\017\263\236\274\273\014\225E+b)B,\210\202\240\322\030@\365\230Y\272\016\337>\267""\215\037\246\244g\266\3623\257T\226\271\300Q\367{n^\245\250c(\303q\312=\0044$\366qgTh\006t@W\225M\232A@nyc\215\335M}\344\315\254\031\004H/\023\304Tc\206s1\337\331\354\240\320q\272\202\271H\34090\242\3525SU!V\250\234\022\363$P*\250\201\021\n\022\207\004\273\020\0022F\330I&h@E\223\310\014\236^\t\000\212*\321Ba\352\030\204R\344199\254\202\3222\215\232\2050\256\r\026J\030\211\234,\325\206\320\2067|l\347{\2757\242\353p\2048\001^m\tt\335\311\013\235Qp$H\360\255\272% \206\300\2215\221\230\340\307!U,\254\322.\342\240\032^\204Y_\214T\266dbRH+Q\2318\005R\204%\235@\340c`3\240\024\224\344\224\326\324\2205c\240E\203E\261\n\350X\332e\014\006\0001\354\322M\203\032I\262\003\226\250\242S\263\206\372\210\320\030\343\235\237d\203\311\231Y\346!\372\234-\226\252W,_\033\030\305k\337\210\010\",?\245\210)'\023\277\002'&=2d\247*\311\347\004O5T\342\274\0014\027\343\005\003\254\247-\211T\025.f\021\317\232F]\300\274\267\202\336#\263\317\333J\246\215=\332\217a\235\030\241\034\227F\0253I\346|\243S-\327\225\025\233\021\361\321\016\306\371\307G\351m\372\313\312\003$\203'\276\224\353\356\263}*\214\275\231\224\262J}\00357\002\251xN\234\266\222\361\r\036\234k\024k\020_\2531J\345\016s\224\365]x#>'\255\n\337t\222\245\"\232$\250\351;WJ\351\241\355\232|>\346\020\271\353\177\033}\332\241Sd6\350\025|m\274}\246\016\317\213\252{\203\230-\335\263\3165\203:\314\373\234\362\001t3)\212\005\024\026\273\026\275Y2|W\035\007^l\232\367L\324\346T7\035\022\227d\353\230\246\312\313\005\n\263\332u\2279Eb*\353,\321\342aF\035t\323B\353\2452Z\020\232\0078\263%\222\334\371\370\340,\017\221&\201\260\261 \034\217\213\274H \232e\230\264i6\0339\315\273\220.1*JW\365\036\207\317\007\266\221RW\312J9C\177\306;\356&\332\317?^\007;\251\355\375bO\013\217\312{\017\337UQ\352\364\"l\036\252^=z\241@\251\252\2113\335u\233S\325\356\241!)\376\227|\1772\001\004\006$1%\001\207\365\030\t=/I\035\321\224?o\214J\004N\251i\004\211!\013+K\354\261\\\224\223@~\212o\274\221\356\345\376\360>\226\177;(\030\225;\3261\201\332+,\213\363\274\337\346\027\354hb""\177\247\265MB\224\303\350\353\215\302\003\374\t\037\231}\020f\023\022X0q\335r\035\232\017p\367\275?\337\357~r\311\207\360\365\276\033\247\352\177W9\352\201\317\244D\233\3129C\361{\333\263\372\256\341\0132\261\240\276(}<\357/ \370}-\376=]:J\2106\237\267M\207)\340b\001Q\035\302A\347\206\005\004\025\0171\316\027x\275\232\310\242\274\326r\247yO(HV\021\342\236\253W\233\356\366~\210x\334\256\377\233H\317n\0256\337\365\0276\276\322\367y\025\205\220?\336\316_tM\355\210/\374/\357yU=\222o\016a\345\361\312\020-\337j\t\356m\275\347\033\267\333{\301\376V\367\211/\033\327\320G\033\352\210zT\356\303\335\275\177\353^\204S\225\223\267\376\376%\205\341z\016F\335\363\361@\003\367\3314TeG\252p+\227\206(\220\340\210\"\205\022\374\217\340\007\254m\3073~\013\30098\205r\002\362\257\017\n2\252\242m\356\357k90\325\001\355\007\016\375\342\301\002\3752\024\241$?\312\022\337\245.\317\242?\273\017b\017\314\037\265\330{-]\201\377\265qu\275\247\366Ez2\023*\2408\277\307\375\324\374\177o\343\364\214\216\325 \340\334\222\000&\314\250\220\315\2746\322\245\320\334cf>\256\241\260\244\240\277?\323\364?\324m\275\327\240\277\272=\020\271\311\270\240\333\201\267\363\356\270\213j\255\261E?~\306\345\325\030\370\320\225\313p\034\233.\031\307\355\031\213\237\226\3239WoM%\333\361[.\213p[\260\t\023\307\202\371\"\370Z\270\227.U\234\367\355xO\253\223L\273\370\273\315\344\013vNE\r\237!3\334\227.\251\2668\220\321\270\200r\341\241\325\264\\FT\361\252\257R\247*\217]\177\026\007\274R\356r\365\\\337\210`z\335\351.\335\266\300\317\345\316\366*k\226l\354ZK\274\366\312\\\226S\035\302\266\303:\323\335\257\256o\2072\202\273\302Z\266\247\227\027\377Z\016\260q\256\251^\277\364\263\374l\251g\276WC\343[+\334_\315\217=\254\304\363\361\352\267p\260j\322U9\230\261aJ\205Z\332\241\366w\254C\nw\365kusjq\272\301\337\036\334\250w\3546\252~\354\243\342\027P;\366\354i\256\235wq@\325\336U\255\372V\253q\264\312\263\252\265N\001\351\335\254\330\337\n\236\203\320:\271\277W\315\301R\350\313o\263\004@^\3025r\332S\220y\234,\272\221K\204\240~""\262\251\340\261V\342\252\022\273c\211W\326\240^\336\t*\206|)z;\246\036W\277\300R\225\322\335\0339WI\326W\255=t\211\0174!e\330\365\005\353\310}\342\252\212)\246\021\266\351\t\212,D\215p\"\256\246y\024\201}\312\303\001\010h\353\t\010F\242E*hd\r={\260P4&aq\340Dr\332\"\214\373I$\372\247I\364\027\272\016\335\324NiujV\255\026\t\030\271\037Lk\311\311\213\3159F\357H9\224\360\204\354\377\276\236\024\277\031\300|\304\277\356~u\245\234\362:\016s\240\367d\365\305(\346\336y/\350\036\030b\351\316\271>,A4U\024\036\361P7\310\002k\340\231{xo\002W\376*\375_\372\374\214\345\313-%\223\300\325\r\014\343\264\241$\3132\276FL\215\221\224\002r\232\314E=\240s\240\313<\300pK)W\206l\366\330\214\335\332\"w/\217!Fq\224\235\3570\r\246a`W\034\325\330^\301==]J\2004\0221\027\233\234\2454;lX\202H,A\004\264\311\276\033\032\024\345\263\005\351\321o\250\373\354V:P\263\275\311\021j\224>D9\342\212\177\177\370\010\235\227\327E\355\213^\022$\022={'\010\243\351iy\333y\235zZ\327\021\242\034\3457f/\216\036%\213k\214\270\214\313\203XUR\264\341Hs\016\326p\332^\322\311\276\321ir#%\340\302\213$\013\357s <\3420qx\352\276\250\201\240c\"_6\231\315\307\211f\263\342\357\017u \275\376\207=\255\".\220m\0353x-\202e\307\250\254DJ\240PuE\035\023\376.\344\212p\241 \331Y\326\206";
    PyObject *data = __Pyx_DecompressString(cstring, 6791, 2);
    if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error)
    const char* const bytes = __Pyx_PyBytes_AsString(data);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) }
    #endif
    #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (6910 bytes) */
const char* const cstring = "x\332\275Z\311\177\333F\226\216\022uL'\262-Z\362\242x\021d;\226\2741a,\307\316bw\323$m1\326NJ\262\223\364@\020\tI\210H\200\002@-qg\272\217:\362\210#\216<\362\310#\217<\342\310#\377\204\374\t\363\275*\000\004\t*\311\314a~\266\200\252W\013^\275\372\336V\305o\205\227\225\355mY\027\016\024\371P(h\262!\250\232)\310Ge\315\220\005\303\324\225\202l\270]\016%C05M0JR\261\030\023\262\273Z\245X\020T\371\000m\206,\013\346\256b\304\222\222*hj\361X\310\353\262d\312\202$l\361\321\346\256d\n\212!\3445\325Tv*Z\305\020\024U(\311%M?\246Q\364Y\3110\224\035\025\037\0210\270\360\210\315\303{\020{n'w\342C]1\245\255\242\354v\340\013\330\326\265\322\037\215U\324\202|$\034*\346\256`\036\227ea\332\245\033\262)li\240n\026\265\274T\334\024$\265 l\032\246\246\313\233n\027S\227T\203I\245;+\237\t\223*\272\2347\205\202R\222UC\321T#\251\037\227MmO\021\326e\235\010\337\n\237\033\261\317\215\224\327A\370\274@\262\240y\371\330t\251l\036\013\306\256\004\246\314J\031\313\332\326t!\177l\356jjL\322u\3518}T&\246Rr\236\346^P\216 =\366y\010\\)a\004\2466%\023\223\307\374\256\272r \377\225\236i\365/O\272\264\365\013-\365\217;e\261\213\177e\2625\365P\227\312\177\245'\344\250l\037\377\225\236\033\1776\343+I)\312\005\002Y^R\363rQ\320\312\262\316\232^)z\351P\322\345\276]{U\224v\014*\317Iza@{&\274\377lg\215J\271\254\351\246\\\310\250\212\251HE\305`_\021d]\307\336\316HE\002\3521\340\303[\177\225\013\367N\323\252\3013pD\377\225\321\007\350Q\020JZA~H\272\rf!\201\351\374\264\200i\246\2014\002\367\364Ca\007\023z\2359\026!F\351\010H\235W\266t\tZ\226\222\215\274\256\224Mw\365\036\271W .\225j\013\363\217R\331\204\260'\037\013;\262\352\312\031\032\272_\201\310\014a3a\302\304lUL9\266\234XM,\244s\351U1\233\316m\322\2077\313\225\255\242\222\027M\031\033\010\225\337\024f\344\330NLX\230\307\224\313\222.\225dS\326\263\262\031[\230\027A\022\277~r/\266 \251\225m)oVtH \223\"\036\276_`\n\273N\n\253m\013\013Pj\262F\252\020\007\010\366d\030!\311\314\357\202\033\260[1L\241\254k\0070{\302&\270\026\213\262\272c\356N/jBA\336\226*E\330\037""\251,m)E\210\035CHKI\306l\205dRb\302rQ\226\310vB\312\200\254\260\031\354\277\031\013LT\222\363\340B1J\177e\026\2773\233\"\300\267\242\356\200\361EM\225\0275S\346f6\311\354\006Y\230\202\\T\266H\3542\314!\231s\354\274\316W\277\234^~4\373l\226\231:]&\2556\000\331\255|\021V\030+\203\244\266*J\321\304F\020GFL\310l\013\307Z\005\340\342\332SF\277\340\000s\027,\221!EA\230fF\223\355\266\210\341`r\332\265t0I4\372\225T4\344\330R\026p\314\313\014O\302\341.\024S(jR\201\326\264T1\031\017ZE-\200\033\325\363#R>/\343\3033\014\226\204\202b\021:\334\243o\247\351\301\262\016\t1\350K\025\342\326T\362\034\217J\237\302\n[\307\214\017\231\351L\245(\003d\202\014s\202\3316+\206\254\213X\321&)\317\246\241\261r\266\210\361}\312\261\2462\377D\206FS\301\010\224\025P\246\272\306\214\350\232\352\253\242\244\357T\310BQ\243\277\323b\2310\276\246\356\251\332\241z\252\234\326\324\222T.c\016n\024\362\320q\372\266A\333|\3144\230\351\363i2\371{\354\305\364\275O\244BAT\t>\004\006\001\010\372\362(\257A\260y\372\240\021\223\266\362\337\007\3746u\342\233\371\242\237\354\371\302\027\005\330*\254^f2\330\311\0133d[v\230\277\243m$\316\345#\023Kfa\200o9\261\025|H\201de\300\254\t\337?\027\276\014y\303\200nn\322\366\021\346x\225\246\333RL#F]6\205\022i\364\026\305!o\344cF#<\312\335\006\220s\244q\337\277\337# \377&\314\024\245-\271\370|\372={\3776\rY\351\260\260\317\337\363\367o\3026\371\203\347\357\331\353\267{/\272\003\r\200 \223BG\274E\245\020\352\031P\342\000_\013\0361\246vm\203(\352r\241\222\227EQ(T\030\206TM}\004\375=\000\013h\315\223\335G#G\322\213M\376\026\231.v'\347\316:I\304\330&C\323\237\310\254\274\2277\342\361/D\376\216\225\217\217\276w\2130#\302\314{C\243\005\363\260\260\320\203\2030\215\324\303\207CO\273O\2351u\340p[\227v\010\374\367*\276\302@\251\021\207\021\036i\263\205\202dJ\261\001\255\334G\321\224n\244\032\253\230\333\217\236%\322Y1\3712)\246\027\223\253\357\226sb*\221K0Zn\225^\351\344\313P\323\353\344B\"\233\314d\022\320\002h9\251O\202\373\347ymg\207\\x\302UQ\343\245T\360\275\226_\230W\014\263""\247\022\363w\220\303V\024\373\233a*\rX\310\323:H\206X\200\265\356%\356\310]\302\002\251\275\356WW\301\354\022\202^\237\220%\215\"s\353S\010\347\256{\367i\353R\261\342\021_\276Ld\323\311\304b2=/ndrsbf1\223K\246Ws\231W\231d\"\227\026\223o\304\205tr.\261\230\311.\210\271w\313i\321\324DY\255\224\250e-\367\352\031\332V\211\206\355 \322zz5\233YZ$\n\013j\223\363\211,\266\201=\027\022\313\330\017\346\306\215$\013\304\262&\371\251\235\343$L\245\262M\266YN\245\3316\245\322\257\022k\363\336KL\245W3\353\351.+Y\257\301\333\325p\313\353\364bz\225\226\020nz\223~'&\023\313\211\227\231\371L.\223\366\351\335\225\262\320\304\247\263\332\037M\230\315\274^\034@\336XM,\367\220i\021\251t\366+\374=N--$2\213\242\037\004eS\200<\313\"\226\274\3504L\tcl`\237\020\320\006\364\252\250y\004\034\252h\354V\314\002\334\315\240.\345\002\233d\267\242\356\031\324\356\242\206\212\363\262\272*\251;2\225)\370\357a\272\2070\230\347\376.\003Y\356\3554\210c\236%\364|\274\2174\370\363\341N\003\031\350\357\026b!\220\233\005\313\230\257\300\253\242\237k\364\266\273\315\003\211\242\0338k\272\030l\0378\247\237\360\005\212\261\002+\213p})\371@\311\313i\n\024x\221G\306\274\274\212\362\201\\H);\262\021@]ou\200\374B\035\302\262\353\357\262\255\250,e\t5\360l\306\0145 \\@\335\303\236V\222\024\325O\000\202u\303\305d:\231\232\213\213\311\245W\211dni\3255\030\234\350\225]\255N\247\2209\270v#],*eC1\202\351p\260\214\265\311j\237\314{\333\335\346\201\304\300>\006\333O\237S.\004\264\254\207\346\251[\0321\241\014\257\272 \035eLw\260\361\n\260\244\0027\252\210\244<\002O|\275\032\262\205\254\027\357z\264U\226\006\310\005xC.\316\327K\331\334W\317\342\263O_3\336\213\014:\274l\312\033\010\210\273\273\300\026\363\007M1w\371\014\210eI\321\347$\306*\371\265@1\014\260\336\306\020\270\3464\303\3440&CNN\t\021\035\376\317!,(z\236\ru\312\322\tD\n\202\010T\027\231\340\250\240\231\3012\035\037\224%\336\307\307_\260\034f\260\2575\304ao;?t\350nvo\253\247\031\275TO-z\250\375\326\007\215Y\214d\300p\203Z\367\225Q\021\245\003\327\024n\203Dy\007""\\m\236\035\237\315\317\323\201W\277J\361\204za)\2656\277\226\025_frY?J\365\013\031u[\013T\230\234\375:\233\252\237\350\243\"L\tKu`\237\220l\027\020,+\210,r\224\020\033\2532\362~U.,j\351\003\254uQ\313V\362\273\254\211G\302\201x\230\027{@\022$1\030\310\372\000R\230\323\301\235B\254\016\352\226\327\312\307\203\350\010eM]\033\330\2040\027\031\227\351\266\341C\210\t)W\362>\000\n\317\r\374\252\321\337\241o\212.\023\275\337\245hS\224\274@\321\225Xl\227q\343V\220\367S\326\346\2032\301\362{\277\232Dr\010\254\365\327\231\035\005\314\300\321\200\226#\306|\270\241_\352\341\036a\221\207\372x\372\025n\361t\314o\2011\310t\017\327|2\301\361%f\321\217\227*f\271b\236\332\360\007,\017\350\032\342\275\347<l\371M2\033\2173\353\273\274\232YH\263\007\323K\224\326)\014\205\361[^]\312\245\223\271tJL\254\345\346zk\351\305\034\205\360\024\214/'\320\270\366r>\203\004\351\355\362\322\"\232\334*\315\001\217wTFvV@\211\354\206N\211\032+3\035A\311s>T\324\362{\254gN\3236dio\031\201\0067S\313\354\350.Xp'\300\302\216\217\360\227Bn#.B\362\253\362\366*\315\263\232M\340\277H+\025\227\022X\241WY\316f\361\275\202VZ\324V\027_\363bV&%\357:0\244-\253i\026\312g\323\351Tv.\021\027\203\343A\370\352\253\331\020\351\311\327\375\244\307\317B\275\236\304\277\352%!\272\317\256\275d;\220\225%=\277\233a\247\220^)\274\355=m\241}\016\266n\321\201\236\250\364\315\347a6H\363\320\232E\014(\223Q\317\312\373\025\004\022 0\215t_\311\242f@:nE\253\250\246[N\037\301\035\030n\245\307\n\2724/\235\354\253\366\214#\342\206\016v\263K=t\212w\231\257\355z\271nKH8^\303\000\311\270M|\262\276j \234r[\376\340\253\375\261\207\337\340\231B\217\220'\201\371\025v\323$\026\230s\344\247q\314;\366\265\363\263\027\217\350\177\352\324aAfB4\335\305\267G6\335\351\375\321\314\270\227\025\177m\340a{[\321K\"\270a\213\221\212~_\003j\3227#\244\314F{74~\201v\000\345\200\360\272-\324\320W\r\212\337k\0314\303\222\336\2275\r$\016\300\305)\335\302(\031\330\261'a\240.\022\335\010x\020\367\352\236)\243\323[\372\243\233\236,;\304\363z\2422\2007N\r\263\302\350>""\244\250F\033\330=\320U\0202\205\311\206Ob\307\372Y\272u,\364Gd\271\24570\324\356M\010\031f\272\3242\345 \305\013\361X\300\303\036\264\036V\200\255\\\326e\303kDuU\316k;\370\272\\`\024\246\306\376\3718#\205\327\355\221C\013w\033\274\225\363*`\240\256-\322\251G\340\232/PD\000Ke\322\002N\245[\202\376\300\275\247\305\017o{\250\375\021\356\200\263;\"a\315\301*\234V\257\203'\"\334\330\202\244\262\031\331\t:\025\326\023\363kiq>\275\270\216\304\361\325\273\300Ed\240\010\241\034\260Z\027\374=\255\274q\000)\240F\201\326\001\263)\362a\254{\217ER\365/:\375B\314\223'\217\025\013]\257\333%x\220\3378E\340\033\003\304\275q\272\260\357KRA\332\312Kyv\241\347\035\314\212\374\256F\024\335[ \031%~\234)\031\307j^\321\020s\352Z\305TT\331\240\000\223\376\304<\271'V\242\343^?\356\024\331\365\006\353blI\206\314}d\327S\362\022\335\024l\341\343{`\323\3758\221\362y\221]\327\320\221\177(\363r\353\206{\354\030\274\247cv\203\033\017\221\037\252\213\242W\360\343\355|\021\374C\247EJ\246\300W~\217y\017\n\247\331ZNs\037=n#\357\376R\200v\234\0144\255\235\376\350\240\236\275\313$\020\367\244'|\"\024>\004ro\020\374[\323\356\351\217\033\334\213l#D\337[\206\334i\310\215\202\242\345\361`RT\014\227\363B\245T:F\310\241\025d\377\010#|\324\021>\335\360\203\177:8fN\217\335\\\311Gy\321\334bO|\206\336\300\243\227\016\260\020(\260\225^H\324}\363\233{O\212t\343\302n]\2665\275$\231\356\r7\346A\322,\212\247\273\350\240k\016\005\r\247\326\271\207eU%\317\206z\302\007Vz\223\250\260?\350u\005\001\207OE\272I2|\317\340\027\214@\326\307\212\334\034\213<7\333u\177\246\340\tC) \354\366ls\267 *%\n\236)],@\312`\245\307izi\244\027ot\177h\340\007\237\204\005_\221\211\033~g\347^\334)&\207\200r\004\211\220P\010\316\335k;*\001\333LZ\232H\226\313\273\233\303\333`Wj{X\305\216\301\256\341\370\230\242\202db+\354\23081\344\226\210\354!\204\312\276D\275\n\023fO\2055u\227J5]\356\255WT\272z\245\322\241\004\321\000[lRQ\246#\207\"\377\351\203'z\366k\"Qd(\303\363\027Bc\367\367\t\231\024l[\211\333V\202\000\3751)\261\002\211\302\007F\337\245p""\0270%\271D\277D\202\"\355\310>\354\260y\300\263\344\032\256\222\242\342\273\244\246\"\277\315&\320\224t\272\271\001,\251\263\212/\372O\272\010T\013\n\240\245\312\207\354Ao\200\222^`\325}1F\2752\337\036:WRaWet\016^Hj\305\002\365r_l\240W\346\003\2652\005\013eXP\372\353\252\013[k\360\336\022C\274\031\272\243\251\004F\350\205i\371}\245{k)\366\324\272j\350\022\310\217a\021\246Wwm\247W\365\257\334=BW\354.\201\3752\002\314\213bY'neV\2408\253\314Sa\266\026\303\253\004M\203G;\255\216\211\310d\342\013\374W0|\"^\356\231\247\367G2}U\354t\031\371v~W\316\357\031\225\022\257\271\326\202\212\314\232\262R\005\222\315\357\001\034i\325\353w\300N\010\t-\373\025\251\310\341\301m\335\240\244\243{e\035\322O\237 \037Qq\207b\007=\250W\272\314~\356\002\321A\374\374i \257\205\007\320\351f\267\254\037\032,\321\355Y9e7,\303!8\260\002\360\020Hy\014\271\270\215\255(\360{{\303K\022)\003\342kqs!\274<\247\331=+\013\230\023q\200ia7\317\310v\330'\361\"/\315\222\237\276\334\250/#2\274\314\303P\212t\227\214\245s\203\244\231\201\037\2170s\302\334\227\373K\002\366*R\206M\235\r\215\377\350\304\320\031\022\300\230\016\356\344\262aje\366\223E\210\254\002\007R!\370H;\")\264'\263\000.L\262\365\242\271K\221\262Bz\244k\207\314\006\262\007\377>/2\013\314\213]\r\340u\027\355\274\302\005m\"\342+2\305\250\024\027\244#7\220DY\361\216\250\373O\256\271E\2550\003\300\237\001\217\331\315\022*~\324\317j\354:\262\347R\322\373e\016\217\023\334\225\366T\014?\2048\240{o\3660\274`;\024\221\207\242\360\001\006\337c\356\220G\330\242\353\340\202U`\203W\365 \377GC\037\340\2373\374\245\363\345\253\246\324\211\334\262\3578w\277iD\033\017\232+\355s\347\333#\347OT+a\255\264G\306\252_U7\254\004\272\326\207\332W\357\330\211\366\265/j\373\355\311'\365\225\366\315\311N\344\323\223\331\223_\255\250u\037-#\027\253\017-\311\332'\352w\325\035k\315\276c\027j\367\353\211\372\317\315hO\353s\353#+\336\0369\327\036\235t&\237\326\367\033C\355\261\361\366\350\345j\321\236\262\343\277\177\374\301\331Q\347\302\224\215A\227\253R{\344J\025\243\306\253)""\347\352=\347\336\363\006\330\232\260n\332fm\266vP\337h\274jN\321\210\221\223o\252s\326k\373im\272~\245q\246\361\257\326Sg5\333\036\271p\362\336\272\215\245x\263wF.UW\252\212\365\337\265\237\032\0375\342\235\310hu\330\031\237\251\r\325&\033C\215k\315D'r\341\304t\306\036\324\342\265\327\365\2703,8B\274\036u\206A\350DnX+\374c\263'\373\355\221\361j\242C\342\272T\315Y\023\316-\010\245\276\335H4\3365\2456\246\035\252F\177\217|p\376\202\333n\307\352C\365\211\306T#\3566v\"\237Yw\234\233\261\332V\375L\275\322H\264#\023\326\270%\326^\326v\352k\215)\306G5^}e\335sn\317\326\023\355\350%\347\322\264m:\017\2367rM0D{p\343^-\332\026\250\365\316\267\215\251\366\375D3\372\377\271)\327\254Yg\022(J5\361%\010\022\314N\333\227\355\303Z\251\021\3676%Y=\264\244\360>@4\347n`\277\342\355\321\tg\002\302\305\333\232\254\ra\330\371+\325\274u\305\036\302 \347\302\244e\330\237\333F\355^\375\357\315\351V\324\035\337\036\277\204\t\316^\255\232\016\001\262~\241\261\357\374c\025\033\336\211\\\267R\3301'\016d\207x\352D\256Z\303\316u\200\271>\331\034r\0229'\267\326\346\373M\263\234oh\255\225\377$\376\003\224\023C\327\256\2434)\264\205)z\336\234\304\177\020>\273_\303\336\010`\017\217Ok\217k\022\024\"r\327.8\367\201\315\306^+\332\031\244B\326;[\302\350i\332+H\373\353\352xu% \177b4\001J\344\334\311\312\211R\375\325\276VKx\225\337\354D\227\316\366\027\3734\346\214\021h/\327\366;\370\304l\365\277\355\025\366\201\3637\235\233\263\365\037\032\200\340\244eB\274\021\3323<\256\325\222X\"\270\276c\247\234\031\246\355Nz\335Y\337`\354\022\326\236ZS\355\321+\316\225\207\265D\2153\356\\r\277\201\211#\370\212s\205\324\002*\002\034B@x\035\321\342o\333\317j\361\036\254\177Q\217\326g`N~vVhW|\304\023\n\246\254\257\355\350\1770\t\261\375\336\276m\257t\"gI\231R\326\220\025m_\030%\261<\260V\234\233O\352\253\365}\326\310\206\203\356\\\004C\355\321/jz\235\367\034\253\306\211\267\0070\006`\344\246\225\267\243\366\024W\201}\326\332\211<p\036$\232\327[+\255m'G\353m\003\266\340}\344$U=S=\266\207\010\322c\244h\316g\261\232\304>w""\251\272\341\\'D\234m\\n\0345\367[gZG\316\306\333\016A\277\272O\210\361$R=r&\037\327\343u,g\2466\\\233\243\335\205\200\301\344i\302\271jO\324\036A\275\"\315\2775\177r\226\177v~\376\247\363\317\377r%\344N\315\027p\344\\\231\251}T{\321\210B).\216\221\202\214[o\261\317\205\332L\375^\343\353\3468\3145v\356\260\232w&\236\324s\215\361\006\323\257=\222\001\351W\324\031\235\"Q\267]\2230f15=\013)\343\365\251\025\367\276DMi{\334\316\325\306\261\363\321\213\374S\357\354\022\255\214\3319\002\353h\365\202E\353\216N\331\001+\363\271U\351\2613\027\230\225\200\231\331s\342?\264\0368k\353\035\017\211.j\036\325r\330\275\310C\002\344\357\237\270\202\331\2602\366\217\220\370\231\372q\363\323\326\013\347\335\266\263]t\212%\247\244\372\350\021\354\363\244m\256\315\0354b\307\331\331s\3660\256\354\224\367\235}=\000\274\n\026\221\263.\322\242\241\336\204\211(\327\360\310\2103\002\317\206\305\223\250\306\256CHc\244\336c\267\301\363\330\370\351\366\224S\037\332\322\377\311\216r\t\315\267\336\020\260\270\204\310\313\275v\256=t\036\376\2439\024\362r\235H\264\032\255\336\263\236\023\270x\361E\355Z=Yg {\352\334\177\321\220\032\377nI\255\367\316\217?\371\302&T&\250V\241\327m\373\tLl$ \363\237\241\251\323\215\211\346\203\326;g]r$\022\270\243j}\032\373\215\235\360e\303\304\302\004\024\220M\014L\205e\323/\261\377\235lz\320C\215\227\\\351\220\227\003B\257Bs\361\272f':d \350KS\356c\302\002\353\247\013\345\213\232Yg\262\031\242\307\247\365\307u\211\244\370\347Br\026\240\254\220\317\277\177\377\340\203\177|\370\346C\274\336|\270A\257\215\017\337\322\353\355\207\357>\034(;\276\021^\360\360/\3531\234bW\321\024f\232\271\242uC\nfF\247\334\351\3749\332\210\327\246\002\026\235<\246ox\037\201\022i|\332\214\207GMZ\007v\226V|\213\205\"\321\3408\347\026\031\2619\004/\353\315x3\325\032\352S\034x\305\366(\366\274\023\362&\177\356\010\235\363@\214\375C\355\227\306Y\n[\356:w\277\247`\247w\"\022\314\035{\326\231F\030\323\370\016\256\233\2062\017\004w[\373\266\276\302\024\365d\016\274\300\231z\253\352\232\333\300b``""\235\3734\315\263\220\024X\177\302\3007u\266\317\263\366q=4\024\3345\336\222i^\t\214\246O\317\361\017Sq\211\214:\025\177@,\344\275\230\351\206A;{\356$S]\341>\025aM\224J\244\r\323\366%\330\n\240]\206\022\214\216;\343\334\231\216\222;\302\343;;_\213\326\340\202\307\253\213P\207ok+d\236\243\344\024F0\341\032\2404kq\247\006W\3717k\305b\206g\nN\350\330\036\2663\265\025\004\216+\276s\362y\233\267\206\270\003\370\315J\322x\212\177\013p\365\276=\347])L\243\n\354\367-\373\001L\364g\215\331\006\371\"\017\216W\231^\356\326\224\272\331x\322<\3234[q\337v\256\364\364\343\016n\2701\327\314\264r\316\nw\272\335\236\\\254\343\325\037\371\327\317\237\260\357\"\t\201t\340\311{\"\t\036U+\215\367\255\251V\274\007\224$\243\257k7\352\030L\241\340\005>\313M\010%\362\271\275\322'3\332\212'\010/.\273:0z\245j\222b\332\0335\306\301.\371u\237\213P(s\257\021o$\374\257\217W\323\330\315\273\366\320\300\001\036\307\007\315\025?\017\350\260\210o\254\232`\301s'\362%\005\254\315\241\376\344A\001\361\023,t\266\265\337E\037\255\326\300.?\256J\316\025h)>:A\006`\342.\3045A\361\377\004\"\025\337\307\0160\262\303\340\375\017\314\354bk\317y\367#Q\257[Oa\010\234\307\257\233\373\341p\036\270\376\244=r\235\207\354\343\320\200x\347*\351p\357\003\222\210NC \037Sp~\350\334\374\252>\205\300}\312I\2561S\216\341Hf\234\331L+:08?\303\243\251\245f\334Im0\307\210\360\306\271L\263\274hNB(\336f\347\253WX\264\210\030\014\213\276T\375\311\376\010F\006\373\321\223\223\33130\036\263\265c\030\304o[]u\356 r\274t\231dr\371J\373\306\315\366u\026\322\323N\312\224\344\001C\277\237';\035g\312B\233\367M\365\265\365\004J\366\272\366\264>\345\273\264\366\271\313\310T\242\256\317\371\314zd\377\212\334\363\223\346T\373\3348\362\236}\277a\212z\356X,\340\237\301\212\021\237\205\372\277\246M\273X\275k\235\261\366)\367\301\250\216?>\260$\236FN7/7\017\020\323\006\021\366\264z\273*\332I\330\264\217\340\335\334\220\376\026\334\327\n\255v\374\206\225\203f\316@\224\317\032\317[\037c\350\350U\222a\307\003F\373\\\224\244\312r;r\241\3270\327~m\250""\323uS\273\260\361G\365\337\232?`\260\353\254\"\334\2341N!M\374\037\273\203q\377\256K\355\353\320eR\221\213\325;\325]K\346\373\303}\342\254u\204\265\223e\275:\343\314\274h\374\322\032\362\021\334\237\237\264O\311O\3723,\327x\365\205\017\244\241w\221\304\214\327~\254\037P\342|Z7\301\376\330\226\340\032\276\255\257\303\360\035\267\206\310\372\006;.\264~r\336\276#\017x\023\036k\0309\3266<\345Yd8\335)\335\035'\001\002F\33300\353\265\257\331:\275\325\271fp\243\226\341>\215\0077\221\001N\203\355\302\025\236!Q\2149\312\242y\360R\254\337o$\002S\336\260V\\w\371\215\265\010\300?e\366\352u\223\t\237E<\244\274\276\316t<\235\311\262Z\027Y\367!\327\267\365\037\033\373\276\242\220\032\317x\023\214U\247)+'\267}\321+v\"l\251\3541A\371\005X\361\n\201\231\357\301\321\315\325\027\235\227H\0067\235M\251\253\211\354\220\343\031\013\312\275\242\273\223\250|g\025\354)^\251T\337\320by\345\000\352>l\317y\"\244\014h\017\331\313[\312+\234\341\033\316\215G\316\243d\223I\365VO\224\321\201k\310\2613\244\306\236\223\371\221BB?\316\200%\255\335\255\017u\307\303bt\006\347\320\247LsZ\016\355\317Lv\225\030k?|\324\376\223\254\2427\236\276\020:yaI\352[\353'\352F\205\025z\375\223R\337?=\317\242\200m\344\344\r\374\335P{\370\223\223\007\325\025\004e\334dO\331C\003\216\254\3566\207\220+\205<\031K\256gj\027(\214\017\331\247\251\3067\315D3\327\212\266\274\370\225 \024\255Bv\354\333\201\330W\255'\352\357\020\245\357{&e\204\233\241q\004\361\326\035k\2576Q\277K>\214\371\255\223}gx\022\226\327\313\360\241\024\267\230\355\212\234;Yu\243\254h_\227\352'<\332\211X\027(%g\255~\272\336=\316\3638zk\277sbH1`\226=mD\254F\2338\345N\354\273Z\217\005\022\367\225\372\331F\264\207\r\222/;\301B\202\334\031\2168P\214(\215z\301\017\267\230\311\267\320B\3479t\276C\333\222\256NX3d\260\370!\021\344\260\364?\342\322J\226";
    PyObject *data = __Pyx_DecompressString(cstring, 6910, 1);
    if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error)
    const char* const bytes = __Pyx_PyBytes_AsString(data);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) }
    #endif
    #else /* compression: none (16680 bytes) */
const char* const bytes = ": Buffer view does not expose stridesBuffer was too small. Should never see this.Can only create a buffer that is contiguous in memory.Cannot assign to read-only memoryviewCannot create writable memory view from read-only memoryviewCannot index with type 'Cannot set both `local` and `store`Cannot transpose memoryview with indirect dimensionsCryptoki Version: %s.%sDimension %d is not directEmpty shape tuple for cython.arrayExpand DecryptMixin with an implementation.Expand DeriveMixin with an implementation.Expand EncryptMixin with an implementation.Expand Object with an implementation.Expand SignMixin with an implementation.Expand UnwrapMixin with an implementation.Expand VerifyMixin with an implementation.Expand WrapMixin with an implementation.Failed to cancel operationFirmware Version: %s.%sFlags: %sHardware Version: %s.%sIndirect dimensions not supportedInitialisation error (already initialized). Should never see this.Initialisation error (not initialized). Should never see this.Invalid mode, expected 'c' or 'fortran', got Invalid shape in axis Library Description: %sLibrary Version: %s.%sLibrary: %sML-DSA key generation requires `Attribute.PARAMETER_SET` in `public_template` (e.g. MLDSAParameterSet.ML_DSA_65).Manufacturer ID: %s<MemoryView of More than 1 token matches %sMust provide `key_length'No default capabilities for this key type. Please specify `capabilities`.No default mechanism for this key type. Please specify `mechanism`.No token matching %sNoneNote that Cython is deliberately stricter than PEP-484 and rejects subclasses of builtin types. If you need to pass subclasses then set the 'annotation_typing' directive to False.OS exception while loading Out of bounds on buffer access (axis Parallel not supported. Should never see this.Protected authentication is not supported by loaded moduleSet either `user_pin` or `so_pin`Slot Description: %sUnable to convert item to objectUnexpected argument to mechanism_paramUnknown exception while loading Unmapped error"" code %sUser type invalid. Should never see this.?.>')\nadd_note and  at 0xcollections.abc<contiguous and direct><contiguous and indirect>disableenablegc (got got differing extents in dimension isenableditemsize <= 0 for cython.array`key_length` is the length in bits.`key` must be a Key.`key_type` must be KeyType.<{klass} (label='{label}' serial={serial} flags={flags})><{klass} (slotID={slot_id} flags={flags})>`mechanism` must be a Mechanism.no default __reduce__ due to non-trivial __cinit__ object>`object_class` must be ObjectClass.`param_length` is the length in bits.pkcs11/_pkcs11.pyx<pkcs11.lib ({so})><strided and direct><strided and direct or indirect><strided and indirect>(tree fragment)unable to allocate array data.unable to allocate shape and strides.utf-8AES_CBC_ENCRYPT_DATAAES_CTRAES_ECB_ENCRYPT_DATAAES_GCMASCIIAnotherUserAlreadyLoggedInArgumentsBadAttributeAttributeListAttributeList.__reduce_cython__AttributeList.__setstate_cython__AttributeList.as_dictAttributeList.getAttributeMapperAttributeReadOnlyAttributeSensitiveAttributeTypeInvalidAttributeValueInvalidBBASECANCEL_WITH_INITCERTIFICATE_CK_MECHANISM_TYPE_to_enum_CK_UTF8CHAR_to_str_CK_VERSION_to_tupleCLASS_CLASS_MAPCTRParamsCancelStrategyCertificateDECRYPTDEFAULTDEFAULT_DERIVE_MECHANISMSDEFAULT_ENCRYPT_MECHANISMSDEFAULT_GENERATE_MECHANISMSDEFAULT_KEY_CAPABILITIESDEFAULT_MECHANISM_PARAMSDEFAULT_PARAM_GENERATE_MECHANISMSDEFAULT_SIGN_MECHANISMSDEFAULT_WRAP_MECHANISMSDERIVEDES2DES3DOMAIN_PARAMETERSDataCryptOperationDataCryptOperation.__reduce_cython__DataCryptOperation.__setstate_cython__DataCryptOperation.unclean_shutdownDataCryptOperation.update_chunksDataInvalidDataLenRangeDataSignOperationDataSignOperation.__reduce_cython__DataSignOperation.__setstate_cython__DataSignOperation.unclean_shutdownDataVerifyOperationDataVerifyOperation.__reduce_cython__DataVerifyOperation.__setstate_cython__DataVerifyOperation.unclean_shutdownDecryptMixinDecryptMixin.__decrypt_operationDecryptMixin._decryptDecryptMixin._dec""rypt_generator_DecryptMixin__decrypt_operationDeriveMixinDeriveMixin.derive_keyDeviceErrorDeviceMemoryDeviceRemovedDigestOperationDigestOperation.__reduce_cython__DigestOperation.__setstate_cython__DigestOperation._finalizeDigestOperation._initiateDigestOperation.ingest_chunksDomainParametersDomainParamsInvalidECDH1_COFACTOR_DERIVEECDH1_DERIVEEC_PARAMSEDDSAENCRYPTEllipsisEncryptMixinEncryptMixin.__encrypt_operationEncryptMixin._encryptEncryptMixin._encrypt_generator_EncryptMixin__encrypt_operationEncryptedDataInvalidEncryptedDataLenRangeExceededMaxIterationsFunctionCancelledFunctionFailedFunctionNotSupportedFunctionRejectedGCMParamsGOST28147GeneralErrorGenerateWithParametersMixinGenerateWithParametersMixin.generate_keypairHasFuncListHasFuncList.__reduce_cython__HasFuncList.__setstate_cython__HostMemoryKEY_TYPEKeyKeyHandleInvalidKeyIndigestibleKeyNeededKeyNotNeededKeyNotWrappableKeyOperationKeyOperation.__reduce_cython__KeyOperation.__setstate_cython__KeyOperation._cancel_operationKeyOperation._finalizeKeyOperation._initiateKeyOperation.unclean_shutdownKeySizeRangeKeyTypeKeyTypeInconsistentKeyUnextractableLLocalDomainParametersML_DSAMODULUS_BITSMechanismMechanismInfoMechanismInvalidMechanismParamInvalidMechanismWithParamMechanismWithParam.__reduce_cython__MechanismWithParam.__setstate_cython__MultipleTokensReturnedNoEventNoSuchTokenObjectObjectClassObjectHandleInvalidObjectHandleWrapperObjectHandleWrapper.__reduce_cython__ObjectHandleWrapper.__setstate_cython__ObjectHandleWrapper.copyObjectHandleWrapper.destroyObjectHandleWrapper.identityObject.__getitem__Object.__init__Object.__setitem__Object._identityObject.copyObject.destroyObject.get_attributesObject.handleObject.sessionOperationActiveOperationContextOperationContext.__enter__OperationContext.__exit__OperationContext.__reduce_cython__OperationContext.__setstate_cython__OperationContext._finalizeOperationContext._initiateOperationNotInitializedOperationWithBinaryOutputOperationWithBinaryOutput.__reduce_cython__Op""erationWithBinaryOutput.__setstate_cython__PARAMETER_SETPKCS11ErrorPRIMEPRIME_BITSPRIVATE_KEYPROTECTED_AUTHPROTECTED_AUTHENTICATION_PATHPUBLIC_EXPONENTPUBLIC_KEYPinExpiredPinIncorrectPinInvalidPinLenRangePinLockedPinTooWeakPrivateKeyPublicKeyPublicKeyInvalid__Pyx_PyDict_NextRefRLockRSARSA_PKCS_OAEPRSA_PKCS_PSSRandomNoRNGRandomSeedNotSupportedSECRET_KEYSEEDSHA1_RSA_PKCS_PSSSHA224_RSA_PKCS_PSSSHA256_RSA_PKCS_PSSSHA384_RSA_PKCS_PSSSHA512_RSA_PKCS_PSSSIGNSUBPRIMESearchIterSearchIter.__reduce_cython__SearchIter.__setstate_cython__SearchIter._batch_iterSearchIter._finalizeSearchIter._initiateSecretKeySequenceSessionSessionClosedSessionCountSessionExistsSessionHandleInvalidSessionReadOnlySessionReadOnlyExistsSessionReadWriteSOExistsSession.__digest_operationSession.__reduce_cython__Session.__setstate_cython__Session._digestSession._digest_generator_Session__digest_operationSession._generate_keypairSession._identitySession.closeSession.create_domain_parametersSession.create_objectSession.generate_domain_parametersSession.generate_keySession.generate_randomSession.get_objectsSession.init_pinSession.reaffirm_credentialsSession.seed_randomSession.set_pinSignMixinSignMixin.__sign_operationSignMixin._signSignMixin._sign_generator_SignMixin__sign_operationSignOrVerifyOperationSignOrVerifyOperation.__reduce_cython__SignOrVerifyOperation.__setstate_cython__SignOrVerifyOperation.ingest_chunksSignatureInvalidSignatureLenRangeSlotSlotFlagSlotIDInvalidSlot.__reduce_cython__Slot.__setstate_cython__Slot._identitySlot.get_mechanism_infoSlot.get_mechanismsSlot.get_tokenStoredDomainParametersTOKENTemplateIncompleteTemplateInconsistentTokenTokenFlagTokenNotPresentTokenNotRecognisedTokenWriteProtectedToken.__reduce_cython__Token.__setstate_cython__Token._identityToken.openUNWRAPUnwrapMixinUnwrapMixin.unwrap_keyUnwrappingKeyHandleInvalidUnwrappingKeySizeRangeUnwrappingKeyTypeInconsistentUserAlreadyLoggedInUserNotLoggedInUserPinNotInitializedUserTooManyTypesUserTypeVALUE_LENVERIFYVerifyMixinVer""ifyMixin.__verify_operationVerifyMixin._verifyVerifyMixin._verify_generator_VerifyMixin__verify_operationView.MemoryViewWRAPWrapMixinWrapMixin.wrap_keyWrappedKeyInvalidWrappedKeyLenRangeWrappingKeyHandleInvalidWrappingKeySizeRangeWrappingKeyTypeInconsistent*aadabcacquireallocate_buffer__annotate__as_dictasyncio.coroutinesattrattr_countattr_dataattribute_mapperattrsbasebatch_batch_iterbatch_sizeblockingbuffer_sizecc_user_type_cancel_operationcancel_strategycapabilitieschunkchunks__class____class_getitem__cline_in_tracebackclosecopycountcreate_domain_parameterscreate_objectcryptoki_versiondatadata_lendata_ptr_decrypt_decrypt_generator__decrypt_operationdefault_templatederive_keydestroy__dict___digest_digest_generator__digest_operation__doc__dtype_is_objectdummyencode_encrypt_encrypt_generator__encrypt_operation__enter__enumerateerrorexc_tbexc_typeexc_val__exit__final_user_type_finalizefinalizefirmware_versionflagflagsformatfortran__func__generate_domain_parametersgenerate_key_generate_keypairgenerate_keypairgenerate_randomgeneric_key_templategetget_attributesget_mechanism_infoget_mechanismsget_objectsget_slotsget_tokenget_tokens__getitem____getstate__handlehardware_versionidid_identity_identity__import__indexinfoingest_chunks__init__init_pininitialize_initiate_is_coroutineitemitemsitemsizeiteratorixkeykey_datakey_lengthkey_ptrkey_to_wrapkey_typekeysklasskwargslabellengthliblib.__reduce_cython__lib.__setstate_cython__lib.finalizelib.get_slotslib.get_tokenlib.get_tokenslib.initializelib.reinitializelib.unloadlib.wait_for_slot_eventlibrary_versionlocal__main__majormanufacturerIDmapmappingmechmech_datamech_typemechanismmechanism_parammechanismsmemviewmerge_templates__metaclass__minormode__module____mro_entries__name__name__nbitsndim__new__newnew_objnew_pinnew_pin_datanew_pin_lengthnextnonceobjobject_classold_pinold_pin_dataold_pin_lengthopopenpackpack_attributeparamparam_lengthpinpin_datapin_lengthpin_newpin_oldpkcs11pkcs11._pkcs11pkcs11.attributespkcs11.constantspkcs11.d""efaultspkcs11.exceptionspkcs11.mechanismspkcs11.typespop__prepare__presentprivate_attrsprivate_key_templateprivate_templateprivate_template_propertypublic_attrspublic_key_templatepublic_templatepublic_template___pyx_checksum__pyx_state__pyx_type__pyx_unpickle_Enum__pyx_vtable____qualname__randomreaffirm_credentials__reduce____reduce_cython____reduce_ex__registerreinitializereleaseresultresultsretvalrstriprwsecret_key_templateseedseed_dataseed_lenseed_randomselfsendserialsession__set_name__set_pinsetdefault__setitem____setstate____setstate_cython__shapesig_lensig_ptr_sign_sign_generator__sign_operationsignaturesilentsizeslotslotDescriptionslot_flagsslot_idslot_listslotssoso_pinsrc_keystartstepstopstorestructsupertag_bitstemplatetemplate___test__threadingthrowtokentoken_flagstoken_labeltoken_mechanismstoken_presenttoken_serialtotaltypesulMaxKeySizeulMinKeySizeunclean_shutdownunloadunpackunpack_attributesunwrap_keyunwrapping_keyupdateupdate_chunksuser_pinuser_templateuser_templatesuser_typevaluevalues_verify_verify_generator__verify_operationwait_for_slot_eventwrap_keywrapped_key_lenwrapped_key_ptrwrapperwrapping_keyx\001\000\001\000\001\320\0040\3200F\300a\340\010\"\240$\320&9\270\021\270+\300Q\330\r\016\330\014\016\210n\230A\230Q\330\014\023\2202\220W\230A\320\0040\260\001\330\030$\240A\330\033/\250q\330\0375\260Q\330\036\037\340\010\013\2104\210z\230\021\230*\240A\330\014\022\220,\230a\230q\340\010\013\210;\220g\230U\240$\240d\250*\260A\260\\\300\021\330\014\022\220,\230a\230q\340\010\013\210=\230\003\2301\330\014\r\330\020\037\320\0377\260q\270\001\330\023\024\330\020\026\220l\240!\2401\360\006\000\t\020\320\017!\240\021\330\014\026\220a\330\014\027\220q\340\010\024\220D\320\030)\320)=\270Q\330\014\031\230\036\240t\2504\250v\260W\270F\300!\360\006\000\t\014\2109\220H\230G\2407\250'\260\027\270\007\270|\3107\320RS\330\014\017\210{\230#\230Q\330\020\026\220l\240!\2401\340\014\025\220Q\220i\230~\250[\270\003\2701\340\010\020\220\004\320\024(\250\001\250\037\270\001""\270\033\300A\340\010\017\210t\320\023+\2501\250G\2601\320\004 \320 1\260\021\320\004+\2501\340\010\035\230Q\360\006\000\t\014\2104\210q\330\014\024\220A\340\r\016\330\014\025\220T\230\031\320\"5\260Q\260f\270A\270Y\300a\330\010\020\220\001\220\021\360\010\000\016\017\330\014\025\220T\230\031\240.\260\001\260\031\270!\2701\330\010\020\220\001\220\021\340\010\032\230$\320\036.\250b\260\007\260u\270A\330\010\031\230\024\230_\250B\250g\260U\270!\340\010\017\210t\2201\220F\230)\320#4\260A\330\021\025\320\025'\240t\320+=\270T\300\021\320\0045\260Q\330\035)\250\021\330 4\260A\330$:\270!\330*A\300\021\340\010\013\2104\210z\230\021\230*\240A\330\014\022\220,\230a\230q\340\010\013\210;\220g\230U\240$\240d\250*\260A\260\\\300\021\330\014\022\220,\230a\230q\340\010\013\210=\230\003\2301\330\014\r\330\020\037\320\0377\260q\270\001\330\023\024\330\020\026\220l\240!\2401\360\006\000\t\020\320\017!\240\021\330\014\026\220a\330\014\027\220q\340\010\033\2304\320\0370\3200D\300A\330\014\020\220\004\220F\230'\240\026\240w\250m\2701\360\006\000\t\014\2109\220C\220w\230a\330\014\017\210{\230#\230Q\330\020\026\220l\240!\2401\360\010\000\r\035\230G\2401\330\020\031\320\031+\2501\330\020\031\230\037\250\001\360\006\000\016\027\220c\230\027\240\001\330\014\017\320\017\037\230s\240%\240s\250)\260?\300'\310\021\330\020\026\220l\240!\330\024\025\360\010\000\t\030\220t\320\033/\250q\260\017\270q\320@R\320RS\340\010\034\230D\320 1\3201F\300a\330\014\020\220\004\220F\230'\240\026\240w\250m\2701\340\010\030\230\004\320\0340\260\001\260\037\300\001\320AT\320TU\330\010\017\210t\320\023/\250q\260\016\270o\310Q\200A\200A\330\033+\2501\330\033\034\200A\330\037 \330 !\330\037 \330\036\037\330\036\037\200A\330\032*\250!\340\010 \240\001\330\010 \240\013\2503\250a\250q\330\010&\240d\320*=\270Q\270k\310\021\340\r\016\330\014\016\210n\230A\230Q\330\014\023\2202\220W\230A\230Y\240a\200A\330'4\260A\330\010\013\2106\220\024\220Q\330\014\022\220,\230a\230q\340\010\020\220\004\220A\220Q\330\010\r\210Q\210i\220z""\240\033\250A\330\010\r\210Q\210i\220}\240A\330\010\r\210Q\210i\220z\240\021\340\010\013\2101\330\014\023\320\023(\250\001\250\026\250q\340\014\023\2204\220~\240Q\240a\200A\330\016\036\320\0364\260J\270a\330\010\037\230t\2401\330\010!\240\021\330\010!\240\033\250C\250q\260\001\330\010$\240D\320(9\270\021\270+\320EV\320VW\340\r\016\330\014\017\210t\2207\230!\330\020\027\320\027,\250A\250Q\330\014\023\2202\320\025(\250\001\250\026\250q\200A\330\010\023\2204\320\027+\2501\250A\340\010'\240t\2501\330\010'\240x\250q\330\010#\2408\2501\360\010\000\016\017\330\014\025\220T\230\031\240/\260\021\260(\270+\300\\\320QR\320RS\330\010\020\220\001\220\021\340\010\017\210{\230!\2306\240\021\200A\340\010\023\2204\220{\240#\240Q\340\010\t\330\014\024\220D\230\001\230\021\330\017\020\330\014\022\220+\230Q\320\0365\260R\260q\340\010\t\330\014\020\220\001\220\021\330\014\022\320\022(\250\001\330\020/\250r\260\021\330\017\020\330\014\023\2201\200A\330\010+\2504\250q\330\010\036\230c\240\021\240!\340\010\013\2104\210q\330\014\023\2201\340\010+\320+A\300\034\310Q\310f\320TV\320VW\330\010\033\2301\330\010\014\210D\220\007\220y\240\001\240\021\330\014\023\2201\220F\320\032.\250a\340\010\t\330\014\025\220W\320\034/\250q\260\t\270\026\270x\300q\310\007\310x\320WX\340\014\026\220a\220q\330\010\017\210q\200A\330\010\023\2204\220x\320\0373\2601\260A\340\010(\250\004\250H\260A\330\010$\240D\250\001\330\010'\240x\250q\330\010#\2408\2501\360\010\000\016\017\330\014\025\220T\230\030\240\031\250-\260q\270\010\300\005\300[\320P\\\320\\]\320]^\330\010\020\220\001\220\021\330\010\017\210q\200A\340\010\013\2104\210x\320\027(\250\003\250>\270\021\360\006\000\022\023\330\020\031\230\024\230X\240Q\240d\250(\260)\2706\300\024\300Q\330\014\017\210w\220c\320\0315\260T\270\024\270Q\330\020\026\220k\240\021\240!\360\010\000\r\021\320\020!\240\021\200A\330\010\013\2104\210z\230\023\230A\330\014\020\220\t\230\021\330\014\020\220\013\2301\200A\340\010\013\2104\210z\230\023\230E\240\024\240T\250\024\250Q\330\021""\022\330\020\031\230\024\230Y\240m\2601\260A\330\014\024\220A\220Q\330\014\020\220\017\230q\200A\330\021!\240\021\340\010\013\2104\210z\230\021\230%\230u\240A\330\014\022\220,\230a\230q\340\010\017\320\017!\240\021\240$\240k\3201J\310+\320UV\340\010\037\230t\2401\330\010'\240t\2501\330\010-\250T\260\021\330\010,\250C\250q\360\n\000\016\017\330\014\025\220W\230I\240Z\250q\260\007\260y\300\013\310>\320Yf\320fl\320lm\320mn\330\010\020\220\001\220\021\340\010 \240\016\250a\250q\340\r\016\330\014\025\220W\230I\240Z\250q\260\007\260y\300\013\310>\320Yf\320fg\320gk\320kl\320lp\320pq\320qr\330\010\020\220\001\220\021\340\010\017\210u\220A\220T\230\022\2301\200A\330\033+\320+A\300\021\330\033\034\200A\330\010\014\320\014$\240A\240T\250\021\200A\330\023\034\230A\330\023 \240\001\330\023#\2401\330\023\024\340\010\013\2104\210z\230\021\230*\240A\330\014\022\220,\230a\230q\340\010\013\2104\210z\230\021\230,\240a\330\014\022\220,\230a\230q\340\010\013\210=\230\003\2301\330\014\r\330\020\037\320\0377\260q\270\001\330\023\024\330\020\026\220l\240!\2401\360\006\000\t\020\320\017!\240\021\240$\240k\3201L\310K\320WX\340\010\037\230t\2401\340\010\024\220G\320\033,\320,@\300\001\330\014\031\230\036\240t\2504\250v\260W\270F\300!\340\010\021\220\021\220)\230=\250\001\330\010\021\220\021\220)\230>\250\033\260C\260q\330\010#\2407\320*>\270a\270\177\310a\310{\320Z[\330\010'\240t\2501\330\010(\250\004\250A\330\010'\240u\250A\330\010#\2405\250\001\360\010\000\016\017\330\014\025\220W\230I\240\\\260\021\260'\270\031\300+\310Y\320Va\320am\320mn\320no\330\010\020\220\001\220\021\340\010\017\210{\230!\2309\240A\200A\330\023\034\230A\330\023#\2401\330\023 \240\001\330\023\024\340\010\013\2104\210z\230\021\230.\250\001\330\014\022\220,\230a\230q\340\010\013\2104\210z\230\021\230*\240A\330\014\022\220,\230a\230q\340\010\013\210=\230\003\2301\330\014\r\330\020\037\320\0377\260q\270\001\330\023\024\330\020\026\220l\240!\2401\360\006\000\t\020\320\017!\240\021\240$\240k\3201J\310+\320UV\340\010\037\230t""\2401\360\006\000\t\025\220G\320\033,\320,A\300\021\340\020\031\230\030\240\021\330\020\031\230\033\240A\340\014\020\220\001\330\014\022\220!\330\014\022\220!\330\014\031\230\021\340\010#\2407\320*>\270a\270\177\310a\310{\320Z[\330\010'\240t\2501\330\010/\250t\2601\330\010(\250\001\330\010(\250\013\2603\260a\260q\330\010'\240u\250A\330\010#\2405\250\001\360\010\000\016\017\330\014\025\220W\230I\240\\\260\021\260'\270\031\300+\320M]\320]n\320n\177\360\000\000@\002K\002\360\000\000K\002W\002\360\000\000W\002X\002\360\000\000X\002Y\002\330\010\020\220\001\220\021\340\010\017\210{\230!\2309\240A\200A\330\010(\250\004\250A\360\006\000\t\014\2104\210|\2303\230a\330\021\022\330\020\031\230\024\230Y\240i\250q\260\001\330\014\024\220A\220Q\340\r\016\330\014\025\220T\230\031\240/\260\021\260!\330\010\020\220\001\220\021\200A\330\010(\250\004\250A\330\010\"\240!\330\010!\240\033\250C\250q\260\001\360\006\000\016\017\330\014\025\220T\230\031\240-\250q\260\010\270\013\3001\330\010\020\220\001\220\021\200A\330\010(\250\004\250A\330\010\037\230v\240S\250\001\330\010\"\240.\260\001\260\021\360\006\000\016\017\330\014\025\220T\230\031\320\"3\2601\260H\270A\270V\3001\300D\310\001\330\010\020\220\001\220\021\340\010\017\210u\220A\220Q\200A\330\020 \240\001\340\010!\240\021\330\010!\240\033\250C\250q\260\001\330\010 \240\001\330\010 \240\013\2503\250a\250q\330\010&\240d\320*=\270Q\270k\310\021\340\r\016\330\014\016\320\016#\2401\240J\250j\270\t\300\021\320\004&\320&<\270A\330\010!\240\021\330\010!\240\033\250C\250q\260\001\360\006\000\t$\2404\320':\270!\270;\300a\330\r\016\330\014\023\2202\320\025*\250!\250:\260Q\200A\330\010\014\210H\220A\220W\230A\200A\330\010(\250\004\250H\260A\330\010$\240D\250\001\360\006\000\016\017\330\014\025\220T\230\030\240\031\320*:\270!\2708\3001\330\010\020\220\001\220\021\200A\330\010(\250\004\250H\260A\330\010'\240t\2509\260A\330\010#\2404\240y\260\001\360\006\000\016\017\330\014\025\220T\230\030\240\031\320*<\270A\270X\300[\320PQ\330\010\020\220\001""\220\021\200A\330\010\014\210H\220H\230A\200A\330\010\014\210H\220O\2408\2501\330\010\014\210J\220a\330\010\014\210J\220a\330\010\017\210q\200A\360\n\000\t\r\210I\220Q\330\014\017\210t\2201\330\020\021\330\014\017\210z\230\021\230'\240\025\240a\330\020\026\220e\2301\330\020\024\320\024+\2501\250A\340\020\033\2301\330\020\033\230;\240c\250\021\250!\330\020\024\220N\240!\240:\250Q\200A\340\010\021\220\021\330\010\014\210I\220U\230!\2304\230q\330\014\023\2201\220D\230\005\230Q\230a\330\014\022\220!\2204\220y\240\004\240I\250Q\250g\260Q\330\010\017\210q\200A\330\010\014\210J\220a\330\010\014\210L\230\001\330\010\013\2104\210}\230C\230q\330\014\025\220Q\220d\230!\330\014\020\220\017\230q\200A\330\010\014\210J\220a\220w\230a\200A\330\010\017\320\017\"\240+\250T\260\032\2704\270q\200A\340\r\016\330\014\025\220T\230\030\240\021\240$\240h\250i\260t\2705\300\007\300t\3101\330\010\014\320\014$\240A\240Q\200A\340\r\016\330\014\025\220T\230\030\240\031\250-\260q\270\004\270H\300I\310T\320QV\320VW\330\010\014\320\014$\240A\240Q\200A\330\010\020\220\001\220\024\220Z\230q\200A\330\010\016\210a\200A\330\010\"\240$\240a\330\010+\2501\360\010\000\016\017\330\014\025\220T\230\031\320\"5\260Q\260i\270{\310!\3101\330\010\020\220\001\220\021\340\010\017\210u\220N\240!\2406\250\035\260a\200A\360\010\000\t\017\210a\200A\330\010\036\230a\330\010%\240Q\330\010\014\210I\220U\230!\2304\230q\330\014\017\210t\2205\230\001\230\026\230v\240S\250\001\330\020\027\220t\2309\240A\240W\250A\330\010\016\210h\220a\220q\200A\330\010\"\240$\240a\360\010\000\016\017\330\014\025\220T\230\031\240/\260\021\260)\2701\270A\330\010\020\220\001\220\021\340\010\024\220E\230\021\230&\240\001\200A\330\010\"\240$\240a\360\010\000\016\017\330\014\025\220T\230\031\320\"5\260Q\260i\270v\300Q\300a\330\010\020\220\001\220\021\340\010\013\2106\220\023\220A\330\014\026\220a\340\0100\260\017\270q\300\001\340\r\016\330\014\025\220T\230\031\320\"5\260Q\260i\270q\300\n\310!\3104\310q\320PQ\330\010\020\220\001\220\021\340\010\017""\210s\220!\2203\220a\320\0273\2601\200A\330\031\"\240!\330\031&\240a\330\031)\250\021\330\031/\250q\340\010\037\230t\2401\330\010\013\210=\230\003\2301\330\014\r\330\020\037\320\0377\260q\270\004\270A\330\023\024\330\020\026\220l\240!\2401\360\006\000\t\020\320\017!\240\021\240$\240k\3201N\310k\320YZ\360\006\000\t\034\2307\320\"3\3203G\300q\330\014\020\220\004\220F\230'\240\026\240w\250m\2701\360\n\000\t\n\330\014\034\230G\2401\330\020\024\220O\2401\340\030!\240\021\330\030!\240\021\330\030!\240\021\330\030!\240\021\360\010\000\021'\240a\360\006\000\t\030\220w\320\0362\260!\260?\300!\320CU\320UV\340\010\034\230G\320#4\3204I\310\021\330\014\020\220\004\220F\230'\240\026\240w\250m\2701\340\010\030\230\007\320\0373\2601\260O\3001\320DW\320WX\340\010\017\210w\320\0262\260!\260>\300\037\320PQ\200A\360\010\000\t\017\210c\220\027\230\001\230\021\330\010\023\2201\330\010\025\220[\240\003\2401\240A\330\010\024\220A\340\r\016\330\014\025\220T\230\031\240(\250!\2504\250y\270\013\300:\310Q\330\010\020\220\001\220\021\200A\340\017\020\330\025\026\330\023\024\330\026\027\330\035\036\330\034*\250!\340\010\"\240$\240e\2501\340\010\036\230a\360\016\000\t\014\2101\330\014\025\220Q\340\010\013\2109\220G\2305\240\004\240G\2507\260!\330\014\022\220,\230a\230q\330\r\026\220c\230\021\330\014\022\220!\330\014\032\230-\240z\260\027\270\n\300!\330\r\024\220C\220q\330\014\022\220!\330\014\032\230!\330\r\026\220g\230Q\330\014\022\220(\230'\240\021\240!\330\014\032\230-\240z\260\027\270\n\300!\330\r\024\220G\2301\330\014\022\220&\230\007\230q\240\001\330\014\032\230!\340\014\022\220!\330\014\032\230!\340\r\016\330\014\025\220T\230\031\240.\260\001\260\031\270'\300\026\300v\310Q\310a\330\010\020\220\001\220\021\340\010\013\2107\220#\220_\240C\240y\260\003\2601\330\014\017\210t\2207\230\"\230I\240Q\330\025\026\330\024\035\230T\240\031\250(\260!\2608\270=\310\006\310a\330\020\030\230\001\230\021\340\020\026\220l\240!\2401\330\r\021\220\027\230\001\330\014\027\220q\330\014\031\230\033\240C\240q""\250\001\340\021\022\330\020\031\230\024\230Y\240h\250a\250x\260}\300J\310a\330\014\024\220A\220Q\340\010\026\220e\2301\330\014\022\220!\330\026\027\330\026\027\330\023$\240C\240\177\260a\330\034+\2501\200A\330\010\022\220$\220h\230e\2401\240A\330\010\017\210{\230!\2304\230x\240z\260\021\200A\330\030(\320(>\270j\310\001\340\010\037\230t\2401\330\010$\240D\320(9\270\021\270+\320EV\320VW\330\r\016\330\014\017\210t\2207\230!\330\020\027\320\027,\250A\250Q\330\014\016\210n\230A\230Q\330\014\023\2202\220W\230A\200A\330\010\017\320\017!\240\021\240$\240k\3201J\310+\320UV\330\010\"\240&\250\001\250\024\250Z\260v\270T\300\021\200A\330\010\017\320\017!\240\021\240$\240k\3201J\310+\320UV\330\010 \240\006\240a\240t\250:\260V\2704\270y\310\001\200A\340\010\017\320\017!\240\021\240$\240k\3201M\310[\320XY\340\010!\240\036\250q\260\004\260J\270f\300D\310\t\320QR\200A\330\010\017\320\017!\240\021\330\014\022\220!\330\014\027\220q\330\010\036\230f\240A\240V\2506\260\021\200A\330\010\037\230t\2401\330\010\014\320\014$\240A\240W\250I\260Q\200A\330\010\037\230t\2401\360\010\000\t\r\210I\220Q\330\014\017\210t\2201\330\020\021\330\014\027\220q\330\014\027\220{\240#\240Q\240a\330\014\020\320\020!\240\021\240$\240l\260*\270A\200A\330\010\037\230t\2401\330\010\035\230Q\330\r\016\330\014\023\2209\230N\250!\2507\260)\2701\270G\3001\200A\330\010'\240t\2501\360\n\000\t\017\210c\220\027\230\001\230\021\340\010\023\2201\330\010\025\220S\230\001\230\021\340\r\016\330\014\025\220T\230\031\240*\250A\250X\260Z\270q\330\010\020\220\001\220\021\200A\360\006\000\t(\240t\2501\360\n\000\t\023\220'\230\027\240\001\240\021\330\010\022\220'\230\027\240\001\240\021\340\010\027\220q\330\010\027\220q\330\010\031\230\023\230A\230Q\330\010\031\230\023\230A\230Q\340\r\016\330\014\025\220T\230\031\240)\2501\250H\260N\320BR\320R`\320`a\330\010\020\220\001\220\021\200A\340\010\017\210t\2208\2301\200A\330\010\017\210t\2208\2301\230A\200A\330\010\017\210t\220;\230d\240!\200A\330\010\017\210u\220K\230t\2401\200A\330""\010\017\210v\220[\240\004\240H\250I\260Q\200A\330\010\017\210w\220k\240\024\240X\250T\260\021\320\004\035\320\035-\320-C\3001\360\010\000\t\"\240\021\330\010!\240\033\250C\250q\260\001\340\010%\240T\320)=\270Q\270k\320IZ\320Z[\330\r\016\330\014\023\2202\320\025)\250\021\250&\260\001\320\004\035\320\035-\320-C\300:\310Q\340\010\037\230t\2401\330\010!\240\021\330\010!\240\033\250C\250q\260\001\340\010%\240T\320)=\270Q\270k\320IZ\320Z[\330\r\016\330\014\017\210t\2207\230!\330\020\027\320\027,\250A\250Q\330\014\023\2202\320\025)\250\021\250&\260\001\320\004G\300q\330-C\3001\330,-\330\010\013\2104\210z\230\021\230*\240A\330\014\022\220,\230a\230q\340\010\013\2104\210z\230\021\230.\250\001\330\014\022\220,\230a\230q\340\010\017\320\017!\240\021\330\014\026\220a\330\014\027\220q\340\010\t\330\014\025\220X\230[\250\001\330\014\025\220X\230Q\330\014\025\220]\240!\340\010\020\220\004\320\024(\250\001\250\037\270\001\270\033\300A\340\010\017\210t\320\023+\2501\250G\2601\320\004 \240\001\330\010\014\210K\220q\200\001\330\004\n\210+\220Q\320\004&\240a\360\006\000\t!\240\001\360\010\000\016\017\330\014\025\220T\230\031\240.\260\001\260\031\270&\300\001\300\021\330\010\020\220\001\220\021\340\010\013\2106\220\023\220A\330\014\023\2201\340\010(\250\017\260q\270\001\340\r\016\330\014\025\220T\230\031\240.\260\001\260\031\270!\2709\300A\300T\310\021\310!\330\010\020\220\001\220\021\360\n\000\t\021\220\001\340\010\014\210K\220q\330\021\022\330\020\031\230\024\230Y\240n\260A\260Y\270a\270q\330\014\024\220A\220Q\340\014\021\220\027\230\001\330\024\031\230\021\230$\230k\250\031\260&\270\004\270A\360\006\000\t\020\210q\320\004\037\230q\330\010\013\2104\210q\330\014\020\320\020\"\240!\2401\330\010\r\210R\210z\230\021\230'\240\021\320\004\037\230q\330\010\013\2104\210q\330\014\020\220\n\230!\330\014\020\220\010\230\017\240x\250q\320\004\037\230q\340\010(\250\004\250H\260A\360\006\000\t\014\2104\210q\330\021\022\330\020\031\230\024\230X\240Y\320.A\300\021\300!\330\014\017\210t\2201\330\020""\024\320\024)\250\021\250!\320\004\037\230q\330\010\037\230t\2401\330\010\013\2104\210q\330\014\020\320\020(\250\001\250\027\260\t\270\021\330\010\r\210R\210z\230\021\230'\240\021\200\001\330\004\017\320\017\037\230u\240A\340\004\010\320\010\031\230\021\330\010\013\210>\230\027\240\001\330\014\024\220G\2301\230A\340\004\013\2101\330\010\r\210Q\330\010\014\210E\220\031\230(\240&\250\001\330\010\013\2106\220\027\230\001O";
    PyObject *data = NULL;
    CYTHON_UNUSED_VAR(__Pyx_DecompressString);
    #endif
    PyObject **stringtab = __pyx_mstate->__pyx_string_tab;
    Py_ssize_t pos = 0;
    for (int i = 0; i < 681; i++) {
      Py_ssize_t bytes_length = index[i].length;
      PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL);
      if (likely(string) && i >= 91) PyUnicode_InternInPlace(&string);
      if (unlikely(!string)) {
        Py_XDECREF(data);
        __PYX_ERR(0, 1, __pyx_L1_error)
      }
      stringtab[i] = string;
      pos += bytes_length;
    }
    for (int i = 681; i < 763; i++) {
      Py_ssize_t bytes_length = index[i].length;
      PyObject *string = PyBytes_FromStringAndSize(bytes + pos, bytes_length);
      stringtab[i] = string;
      pos += bytes_length;
      if (unlikely(!string)) {
        Py_XDECREF(data);
        __PYX_ERR(0, 1, __pyx_L1_error)
      }
    }
    Py_XDECREF(data);
    for (Py_ssize_t i = 0; i < 763; i++) {
      if (unlikely(PyObject_Hash(stringtab[i]) == -1)) {
        __PYX_ERR(0, 1, __pyx_L1_error)
      }
    }
    #if CYTHON_IMMORTAL_CONSTANTS
    {
      PyObject **table = stringtab + 681;
      for (Py_ssize_t i=0; i<82; ++i) {
        #if PY_VERSION_HEX >= 0x030F0000
        PyUnstable_SetImmortal(table[i]);
        #elif CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
        if ((PY_SSIZE_T_MAX <= _Py_IMMORTAL_REFCNT_LOCAL)) break;
        #if PY_VERSION_HEX < 0x030E0000
        if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1)
        #else
        if (PyUnstable_Object_IsUniquelyReferenced(table[i]))
        #endif
        {
          Py_SET_REFCNT(table[i], ((Py_ssize_t)_Py_IMMORTAL_REFCNT_LOCAL + 1));
        }
        #else
        if ((PY_SSIZE_T_MAX < _Py_IMMORTAL_INITIAL_REFCNT)) break;
        Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
        #endif
      }
    }
    #endif
  }
  {
    PyObject **numbertab = __pyx_mstate->__pyx_number_tab + 0;
    int8_t const cint_constants_1[] = {0,-1,1,8,10,16};
    int16_t const cint_constants_2[] = {8192};
    int32_t const cint_constants_4[] = {136983863L};
    for (int i = 0; i < 8; i++) {
      numbertab[i] = PyLong_FromLong((i < 6 ? cint_constants_1[i - 0] : (i < 7 ? cint_constants_2[i - 6] : cint_constants_4[i - 7])));
      if (unlikely(!numbertab[i])) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  #if CYTHON_IMMORTAL_CONSTANTS
  {
    PyObject **table = __pyx_mstate->__pyx_number_tab;
    for (Py_ssize_t i=0; i<8; ++i) {
      #if PY_VERSION_HEX >= 0x030F0000
      PyUnstable_SetImmortal(table[i]);
      #elif CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
      if ((PY_SSIZE_T_MAX <= _Py_IMMORTAL_REFCNT_LOCAL)) break;
      #if PY_VERSION_HEX < 0x030E0000
      if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1)
      #else
      if (PyUnstable_Object_IsUniquelyReferenced(table[i]))
      #endif
      {
        Py_SET_REFCNT(table[i], ((Py_ssize_t)_Py_IMMORTAL_REFCNT_LOCAL + 1));
      }
      #else
      if ((PY_SSIZE_T_MAX < _Py_IMMORTAL_INITIAL_REFCNT)) break;
      Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
      #endif
    }
  }
  #endif
  return 0;
  __pyx_L1_error:;
  return -1;
}
/* #### Code section: init_codeobjects ### */
typedef struct {
    unsigned int argcount : 4;
    unsigned int num_posonly_args : 1;
    unsigned int num_kwonly_args : 1;
    unsigned int nlocals : 5;
    unsigned int flags : 10;
    unsigned int first_line : 12;
} __Pyx_PyCode_New_function_description;
/* NewCodeObj.proto */
static PyObject* __Pyx_PyCode_New(
        const __Pyx_PyCode_New_function_description descr,
        PyObject * const *varnames,
        PyObject *filename,
        PyObject *funcname,
        PyObject *line_table,
        PyObject *tuple_dedup_map
);


static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) {
  PyObject* tuple_dedup_map = PyDict_New();
  if (unlikely(!tuple_dedup_map)) return -1;
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 733};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_results, __pyx_mstate->__pyx_n_u_count, __pyx_mstate->__pyx_n_u_ix};
    __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_batch_iter, __pyx_mstate->__pyx_kp_b_iso88591_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 915};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_attrs, __pyx_mstate->__pyx_n_u_batch_size, __pyx_mstate->__pyx_n_u_op, __pyx_mstate->__pyx_n_u_batch};
    __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_get_objects, __pyx_mstate->__pyx_kp_b_iso88591_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1588};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_chunks, __pyx_mstate->__pyx_n_u_data_ptr, __pyx_mstate->__pyx_n_u_data_len, __pyx_mstate->__pyx_n_u_chunk};
    __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_update_chunks, __pyx_mstate->__pyx_kp_b_iso88591_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1621};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_data, __pyx_mstate->__pyx_n_u_mechanism, __pyx_mstate->__pyx_n_u_mechanism_param, __pyx_mstate->__pyx_n_u_buffer_size, __pyx_mstate->__pyx_n_u_op};
    __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_encrypt_generator, __pyx_mstate->__pyx_kp_b_iso88591_A_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {6, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1655};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_data, __pyx_mstate->__pyx_n_u_mechanism, __pyx_mstate->__pyx_n_u_mechanism_param, __pyx_mstate->__pyx_n_u_pin, __pyx_mstate->__pyx_n_u_buffer_size, __pyx_mstate->__pyx_n_u_session, __pyx_mstate->__pyx_n_u_op};
    __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_decrypt_generator, __pyx_mstate->__pyx_kp_b_iso88591_A_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {6, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 2127};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_token_label, __pyx_mstate->__pyx_n_u_token_serial, __pyx_mstate->__pyx_n_u_token_flags, __pyx_mstate->__pyx_n_u_slot_flags, __pyx_mstate->__pyx_n_u_mechanisms, __pyx_mstate->__pyx_n_u_slot, __pyx_mstate->__pyx_n_u_token, __pyx_mstate->__pyx_n_u_token_mechanisms};
    __pyx_mstate_global->__pyx_codeobj_tab[5] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_get_tokens, __pyx_mstate->__pyx_kp_b_iso88591_A_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[5])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[7] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[7])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 112};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_attribute_mapper, __pyx_mstate->__pyx_n_u_attr, __pyx_mstate->__pyx_n_u_result, __pyx_mstate->__pyx_n_u_index};
    __pyx_mstate_global->__pyx_codeobj_tab[8] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_as_dict, __pyx_mstate->__pyx_kp_b_iso88591_A_IU_4q_1D_Qa_4y_IQgQ_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[8])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 120};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_item, __pyx_mstate->__pyx_n_u_attribute_mapper, __pyx_mstate->__pyx_n_u_index, __pyx_mstate->__pyx_n_u_key};
    __pyx_mstate_global->__pyx_codeobj_tab[9] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_get, __pyx_mstate->__pyx_kp_b_iso88591_A_a_Q_IU_4q_t5_vS_t9AWA_haq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[9])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[10] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[10])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[11] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[11])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[12] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[12])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[13] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[13])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 370};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_slot_id, __pyx_mstate->__pyx_n_u_info, __pyx_mstate->__pyx_n_u_retval};
    __pyx_mstate_global->__pyx_codeobj_tab[14] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_get_token, __pyx_mstate->__pyx_kp_b_iso88591_A_a_T_1A_E, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[14])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 381};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_slot_id, __pyx_mstate->__pyx_n_u_count, __pyx_mstate->__pyx_n_u_retval, __pyx_mstate->__pyx_n_u_mechanisms};
    __pyx_mstate_global->__pyx_codeobj_tab[15] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_get_mechanisms, __pyx_mstate->__pyx_kp_b_iso88591_A_a_T_5QivQa_6_A_a_0_q_T_5Qiq_4q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[15])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 401};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_mechanism, __pyx_mstate->__pyx_n_u_slot_id, __pyx_mstate->__pyx_n_u_mech_type, __pyx_mstate->__pyx_n_u_info, __pyx_mstate->__pyx_n_u_retval};
    __pyx_mstate_global->__pyx_codeobj_tab[16] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_get_mechanism_info, __pyx_mstate->__pyx_kp_b_iso88591_A_a_1_T_5Qi_1_uN_6_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[16])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 413};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[17] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_identity_2, __pyx_mstate->__pyx_kp_b_iso88591_A_t_d, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[17])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[18] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[18])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[19] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[19])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {7, 0, 0, 16, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 482};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_rw, __pyx_mstate->__pyx_n_u_user_pin, __pyx_mstate->__pyx_n_u_so_pin, __pyx_mstate->__pyx_n_u_user_type, __pyx_mstate->__pyx_n_u_attribute_mapper, __pyx_mstate->__pyx_n_u_cancel_strategy, __pyx_mstate->__pyx_n_u_slot_id, __pyx_mstate->__pyx_n_u_handle, __pyx_mstate->__pyx_n_u_flags, __pyx_mstate->__pyx_n_u_final_user_type, __pyx_mstate->__pyx_n_u_pin_data, __pyx_mstate->__pyx_n_u_pin_length, __pyx_mstate->__pyx_n_u_retval, __pyx_mstate->__pyx_n_u_c_user_type, __pyx_mstate->__pyx_n_u_pin};
    __pyx_mstate_global->__pyx_codeobj_tab[20] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_open, __pyx_mstate->__pyx_kp_b_iso88591_A_e1_a_1_Q_9G5_G7_aq_c_z_Cq_gQ_z, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[20])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 551};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[21] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_identity_2, __pyx_mstate->__pyx_kp_b_iso88591_A_uKt1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[21])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[22] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[22])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[23] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[23])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 571};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[24] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_enter, __pyx_mstate->__pyx_kp_b_iso88591_A_HO81_Ja_Ja_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[24])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 577};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_exc_type, __pyx_mstate->__pyx_n_u_exc_val, __pyx_mstate->__pyx_n_u_exc_tb};
    __pyx_mstate_global->__pyx_codeobj_tab[25] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_exit, __pyx_mstate->__pyx_kp_b_iso88591_A_Jawa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[25])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 593};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[26] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_initiate, __pyx_mstate->__pyx_kp_b_iso88591_A_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[26])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 596};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_silent};
    __pyx_mstate_global->__pyx_codeobj_tab[27] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_finalize, __pyx_mstate->__pyx_kp_b_iso88591_q_4q_xq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[27])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[28] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[28])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[29] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[29])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[30] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[30])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[31] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[31])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 756};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_handle, __pyx_mstate->__pyx_n_u_attr_data, __pyx_mstate->__pyx_n_u_attr_count, __pyx_mstate->__pyx_n_u_retval};
    __pyx_mstate_global->__pyx_codeobj_tab[32] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_initiate, __pyx_mstate->__pyx_kp_b_iso88591_A_HA_t9A_4y_T_AX_PQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[32])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 766};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_silent, __pyx_mstate->__pyx_n_u_handle, __pyx_mstate->__pyx_n_u_retval};
    __pyx_mstate_global->__pyx_codeobj_tab[33] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_finalize, __pyx_mstate->__pyx_kp_b_iso88591_q_HA_4q_XY_A_t1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[33])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[34] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[34])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[35] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[35])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 791};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_retval};
    __pyx_mstate_global->__pyx_codeobj_tab[36] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_initiate, __pyx_mstate->__pyx_kp_b_iso88591_A_T_q_HITQVVW_AQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[36])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 810};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_chunks, __pyx_mstate->__pyx_n_u_data_ptr, __pyx_mstate->__pyx_n_u_data_len, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_chunk};
    __pyx_mstate_global->__pyx_codeobj_tab[37] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_ingest_chunks, __pyx_mstate->__pyx_kp_b_iso88591_A_IQ_t1_z_a_e1_1A_1_c_N_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[37])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 829};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_silent, __pyx_mstate->__pyx_n_u_session};
    __pyx_mstate_global->__pyx_codeobj_tab[38] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_finalize, __pyx_mstate->__pyx_kp_b_iso88591_q_t1_4q_Rz, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[38])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[39] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[39])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[40] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[40])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS), 836};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_default_template, __pyx_mstate->__pyx_n_u_user_templates, __pyx_mstate->__pyx_n_u_template, __pyx_mstate->__pyx_n_u_user_template, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[41] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_merge_templates, __pyx_mstate->__pyx_kp_b_iso88591_uA_G1A_1_Q_E_6, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[41])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 890};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[42] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_identity_2, __pyx_mstate->__pyx_kp_b_iso88591_A_wk_XT, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[42])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 902};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_handle, __pyx_mstate->__pyx_n_u_retval};
    __pyx_mstate_global->__pyx_codeobj_tab[43] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_close, __pyx_mstate->__pyx_kp_b_iso88591_A_A_4_3a_Yiq_AQ_T, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[43])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 920};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pin, __pyx_mstate->__pyx_n_u_pin_data, __pyx_mstate->__pyx_n_u_pin_length, __pyx_mstate->__pyx_n_u_user_type, __pyx_mstate->__pyx_n_u_retval};
    __pyx_mstate_global->__pyx_codeobj_tab[44] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_reaffirm_credentials, __pyx_mstate->__pyx_kp_b_iso88591_A_c_1_1A_A_T_4y_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[44])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 933};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_attrs, __pyx_mstate->__pyx_n_u_template, __pyx_mstate->__pyx_n_u_handle, __pyx_mstate->__pyx_n_u_attr_data, __pyx_mstate->__pyx_n_u_attr_count, __pyx_mstate->__pyx_n_u_new_2, __pyx_mstate->__pyx_n_u_retval};
    __pyx_mstate_global->__pyx_codeobj_tab[45] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_create_object, __pyx_mstate->__pyx_kp_b_iso88591_A_4_1A_t1_xq_81_T_QRRS_6, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[45])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 948};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key_type, __pyx_mstate->__pyx_n_u_attrs, __pyx_mstate->__pyx_n_u_local, __pyx_mstate->__pyx_n_u_store};
    __pyx_mstate_global->__pyx_codeobj_tab[46] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_create_domain_parameters, __pyx_mstate->__pyx_kp_b_iso88591_A_4A_6_Q_aq_AQ_Qiz_A_Qi_A_Qiz_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[46])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {7, 0, 0, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 963};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key_type, __pyx_mstate->__pyx_n_u_param_length, __pyx_mstate->__pyx_n_u_store, __pyx_mstate->__pyx_n_u_mechanism, __pyx_mstate->__pyx_n_u_mechanism_param, __pyx_mstate->__pyx_n_u_template, __pyx_mstate->__pyx_n_u_mech, __pyx_mstate->__pyx_n_u_template_2, __pyx_mstate->__pyx_n_u_attrs};
    __pyx_mstate_global->__pyx_codeobj_tab[47] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_generate_domain_parameters, __pyx_mstate->__pyx_kp_b_iso88591_Gq_C1_4z_A_aq_4z_aq_a_q_X_XQ_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[47])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {10, 0, 0, 13, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 988};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key_type, __pyx_mstate->__pyx_n_u_key_length, __pyx_mstate->__pyx_n_u_id, __pyx_mstate->__pyx_n_u_label, __pyx_mstate->__pyx_n_u_store, __pyx_mstate->__pyx_n_u_capabilities, __pyx_mstate->__pyx_n_u_mechanism, __pyx_mstate->__pyx_n_u_mechanism_param, __pyx_mstate->__pyx_n_u_template, __pyx_mstate->__pyx_n_u_mech, __pyx_mstate->__pyx_n_u_template_2, __pyx_mstate->__pyx_n_u_attrs};
    __pyx_mstate_global->__pyx_codeobj_tab[48] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_generate_key, __pyx_mstate->__pyx_kp_b_iso88591_0_A_q_5Q_4z_A_aq_gU_d_A_aq_1_7q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[48])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {11, 0, 0, 16, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1041};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key_type, __pyx_mstate->__pyx_n_u_key_length, __pyx_mstate->__pyx_n_u_id, __pyx_mstate->__pyx_n_u_label, __pyx_mstate->__pyx_n_u_store, __pyx_mstate->__pyx_n_u_capabilities, __pyx_mstate->__pyx_n_u_mechanism, __pyx_mstate->__pyx_n_u_mechanism_param, __pyx_mstate->__pyx_n_u_public_template, __pyx_mstate->__pyx_n_u_private_template, __pyx_mstate->__pyx_n_u_mech, __pyx_mstate->__pyx_n_u_public_template_2, __pyx_mstate->__pyx_n_u_public_attrs, __pyx_mstate->__pyx_n_u_private_template_2, __pyx_mstate->__pyx_n_u_private_attrs};
    __pyx_mstate_global->__pyx_codeobj_tab[49] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_generate_keypair, __pyx_mstate->__pyx_kp_b_iso88591_5Q_4A_A_4z_A_aq_gU_d_A_aq_1_7q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[49])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1118};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_seed, __pyx_mstate->__pyx_n_u_handle, __pyx_mstate->__pyx_n_u_seed_data, __pyx_mstate->__pyx_n_u_seed_len, __pyx_mstate->__pyx_n_u_retval};
    __pyx_mstate_global->__pyx_codeobj_tab[50] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_seed_random, __pyx_mstate->__pyx_kp_b_iso88591_A_A_Cq_T_q_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[50])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1128};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_nbits, __pyx_mstate->__pyx_n_u_handle, __pyx_mstate->__pyx_n_u_length, __pyx_mstate->__pyx_n_u_random, __pyx_mstate->__pyx_n_u_retval};
    __pyx_mstate_global->__pyx_codeobj_tab[51] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_generate_random, __pyx_mstate->__pyx_kp_b_iso88591_A_A_vS_T_31HAV1D_uAQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[51])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1140};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_mechanism, __pyx_mstate->__pyx_n_u_mechanism_param, __pyx_mstate->__pyx_n_u_mech};
    __pyx_mstate_global->__pyx_codeobj_tab[52] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_digest_operation, __pyx_mstate->__pyx_kp_b_iso88591_A_q_fAV6, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[52])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1146};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_data, __pyx_mstate->__pyx_n_u_mechanism, __pyx_mstate->__pyx_n_u_mechanism_param, __pyx_mstate->__pyx_n_u_data_ptr, __pyx_mstate->__pyx_n_u_data_len, __pyx_mstate->__pyx_n_u_retval, __pyx_mstate->__pyx_n_u_op};
    __pyx_mstate_global->__pyx_codeobj_tab[53] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_digest, __pyx_mstate->__pyx_kp_b_iso88591_A_Cq_4_a_2_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[53])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1155};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_data, __pyx_mstate->__pyx_n_u_mechanism, __pyx_mstate->__pyx_n_u_mechanism_param, __pyx_mstate->__pyx_n_u_op};
    __pyx_mstate_global->__pyx_codeobj_tab[54] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_digest_generator, __pyx_mstate->__pyx_kp_b_iso88591_00Fa_9_Q_nAQ_2WA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[54])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 11, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1162};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_old_pin, __pyx_mstate->__pyx_n_u_new_pin, __pyx_mstate->__pyx_n_u_old_pin_length, __pyx_mstate->__pyx_n_u_new_pin_length, __pyx_mstate->__pyx_n_u_handle, __pyx_mstate->__pyx_n_u_old_pin_data, __pyx_mstate->__pyx_n_u_new_pin_data, __pyx_mstate->__pyx_n_u_retval, __pyx_mstate->__pyx_n_u_pin_old, __pyx_mstate->__pyx_n_u_pin_new};
    __pyx_mstate_global->__pyx_codeobj_tab[55] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_set_pin, __pyx_mstate->__pyx_kp_b_iso88591_A_t1_q_q_AQ_AQ_T_1HNBRR_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[55])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1182};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pin, __pyx_mstate->__pyx_n_u_handle, __pyx_mstate->__pyx_n_u_pin_data, __pyx_mstate->__pyx_n_u_pin_length, __pyx_mstate->__pyx_n_u_retval};
    __pyx_mstate_global->__pyx_codeobj_tab[56] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_init_pin, __pyx_mstate->__pyx_kp_b_iso88591_A_t1_c_1_S_T_AXZq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[56])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[57] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[57])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[58] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[58])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1282};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_handle, __pyx_mstate->__pyx_n_u_obj, __pyx_mstate->__pyx_n_u_retval};
    __pyx_mstate_global->__pyx_codeobj_tab[59] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_destroy, __pyx_mstate->__pyx_kp_b_iso88591_A_HA_D_T_81, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[59])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1291};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_attrs, __pyx_mstate->__pyx_n_u_template, __pyx_mstate->__pyx_n_u_handle, __pyx_mstate->__pyx_n_u_obj, __pyx_mstate->__pyx_n_u_attr_data, __pyx_mstate->__pyx_n_u_attr_count, __pyx_mstate->__pyx_n_u_new_obj, __pyx_mstate->__pyx_n_u_retval};
    __pyx_mstate_global->__pyx_codeobj_tab[60] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_copy, __pyx_mstate->__pyx_kp_b_iso88591_A_4x_31A_HA_D_xq_81_T_q_P_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[60])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1306};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[61] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_identity, __pyx_mstate->__pyx_kp_b_iso88591_A_T_4q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[61])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[62] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[62])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[63] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[63])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1313};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_wrapper};
    __pyx_mstate_global->__pyx_codeobj_tab[64] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_init, __pyx_mstate->__pyx_kp_b_iso88591_Kq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[64])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1316};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_item};
    __pyx_mstate_global->__pyx_codeobj_tab[65] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_getitem, __pyx_mstate->__pyx_kp_b_iso88591_A_t81A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[65])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1319};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[66] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_setitem, __pyx_mstate->__pyx_kp_b_iso88591_A_HAWA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[66])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1322};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_keys, __pyx_mstate->__pyx_n_u_wrapper, __pyx_mstate->__pyx_n_u_total, __pyx_mstate->__pyx_n_u_key_ptr, __pyx_mstate->__pyx_n_u_ix, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_result};
    __pyx_mstate_global->__pyx_codeobj_tab[67] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_get_attributes, __pyx_mstate->__pyx_kp_b_iso88591_A_4q_c_4q_1_A_QfTVVW_1_D_y_1F_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[67])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1340};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[68] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_session, __pyx_mstate->__pyx_kp_b_iso88591_A_t81, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[68])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1344};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[69] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_handle, __pyx_mstate->__pyx_kp_b_iso88591_A_t81, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[69])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1348};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_attrs, __pyx_mstate->__pyx_n_u_new_obj};
    __pyx_mstate_global->__pyx_codeobj_tab[70] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_copy, __pyx_mstate->__pyx_kp_b_iso88591_A_he1A_4xz, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[70])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1352};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[71] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_destroy, __pyx_mstate->__pyx_kp_b_iso88591_A_HHA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[71])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1355};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[72] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_identity_2, __pyx_mstate->__pyx_kp_b_iso88591_A_v_HIQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[72])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {9, 0, 0, 15, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1433};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_id, __pyx_mstate->__pyx_n_u_label, __pyx_mstate->__pyx_n_u_store, __pyx_mstate->__pyx_n_u_capabilities, __pyx_mstate->__pyx_n_u_mechanism, __pyx_mstate->__pyx_n_u_mechanism_param, __pyx_mstate->__pyx_n_u_public_template, __pyx_mstate->__pyx_n_u_private_template, __pyx_mstate->__pyx_n_u_session, __pyx_mstate->__pyx_n_u_mech, __pyx_mstate->__pyx_n_u_public_template_2, __pyx_mstate->__pyx_n_u_public_attrs, __pyx_mstate->__pyx_n_u_private_template_2, __pyx_mstate->__pyx_n_u_private_attrs};
    __pyx_mstate_global->__pyx_codeobj_tab[73] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_generate_keypair_2, __pyx_mstate->__pyx_kp_b_iso88591_A_a_q_t1_1_7q_A_l_1_k1NkYZ_7_33G, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[73])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1509};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[74] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_unclean_shutdown, __pyx_mstate->__pyx_kp_b_iso88591_A_a_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[74])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1515};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_retval};
    __pyx_mstate_global->__pyx_codeobj_tab[75] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_initiate, __pyx_mstate->__pyx_kp_b_iso88591_A_T_hit5_t1_AQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[75])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1521};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_silent, __pyx_mstate->__pyx_n_u_retval};
    __pyx_mstate_global->__pyx_codeobj_tab[76] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_cancel_operation, __pyx_mstate->__pyx_kp_b_iso88591_A_4x_XQd_6_Q_wc_5T_Q_k, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[76])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1535};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_silent};
    __pyx_mstate_global->__pyx_codeobj_tab[77] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_finalize, __pyx_mstate->__pyx_kp_b_iso88591_q_4q_1_Rz, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[77])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[78] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[78])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[79] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[79])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1585};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[80] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_unclean_shutdown, __pyx_mstate->__pyx_kp_b_iso88591_A_AT, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[80])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[81] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[81])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[82] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[82])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1603};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_mechanism, __pyx_mstate->__pyx_n_u_mechanism_param, __pyx_mstate->__pyx_n_u_buffer_size, __pyx_mstate->__pyx_n_u_mech};
    __pyx_mstate_global->__pyx_codeobj_tab[83] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_encrypt_operation, __pyx_mstate->__pyx_kp_b_iso88591_A_k1M_XY_q_JfD_QR, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[83])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1609};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_data, __pyx_mstate->__pyx_n_u_mechanism, __pyx_mstate->__pyx_n_u_mechanism_param, __pyx_mstate->__pyx_n_u_buffer_size, __pyx_mstate->__pyx_n_u_data_ptr, __pyx_mstate->__pyx_n_u_data_len, __pyx_mstate->__pyx_n_u_op};
    __pyx_mstate_global->__pyx_codeobj_tab[84] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_encrypt, __pyx_mstate->__pyx_kp_b_iso88591_C1_Cq_T_QkIZZ_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[84])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1636};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_mechanism, __pyx_mstate->__pyx_n_u_mechanism_param, __pyx_mstate->__pyx_n_u_buffer_size, __pyx_mstate->__pyx_n_u_mech};
    __pyx_mstate_global->__pyx_codeobj_tab[85] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_decrypt_operation, __pyx_mstate->__pyx_kp_b_iso88591_A_k1M_XY_q_JfD_QR, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[85])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {6, 0, 0, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1642};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_data, __pyx_mstate->__pyx_n_u_mechanism, __pyx_mstate->__pyx_n_u_mechanism_param, __pyx_mstate->__pyx_n_u_pin, __pyx_mstate->__pyx_n_u_buffer_size, __pyx_mstate->__pyx_n_u_session, __pyx_mstate->__pyx_n_u_data_ptr, __pyx_mstate->__pyx_n_u_data_len, __pyx_mstate->__pyx_n_u_op};
    __pyx_mstate_global->__pyx_codeobj_tab[86] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_decrypt, __pyx_mstate->__pyx_kp_b_iso88591_C_Q_t1_Cq_T_QkIZZ_t7_AQ_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[86])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1674};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_chunks, __pyx_mstate->__pyx_n_u_session, __pyx_mstate->__pyx_n_u_data_ptr, __pyx_mstate->__pyx_n_u_data_len, __pyx_mstate->__pyx_n_u_chunk};
    __pyx_mstate_global->__pyx_codeobj_tab[87] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_ingest_chunks, __pyx_mstate->__pyx_kp_b_iso88591_A_t1_IQ_t1_q_Qa_l_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[87])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[88] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[88])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[89] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[89])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1711};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_session};
    __pyx_mstate_global->__pyx_codeobj_tab[90] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_unclean_shutdown, __pyx_mstate->__pyx_kp_b_iso88591_A_t1_AWIQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[90])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[91] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[91])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[92] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[92])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1719};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_mechanism, __pyx_mstate->__pyx_n_u_mechanism_param, __pyx_mstate->__pyx_n_u_buffer_size, __pyx_mstate->__pyx_n_u_mech};
    __pyx_mstate_global->__pyx_codeobj_tab[93] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_sign_operation, __pyx_mstate->__pyx_kp_b_iso88591_A_k1J_UV_at_V4y, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[93])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {6, 0, 0, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1723};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_data, __pyx_mstate->__pyx_n_u_mechanism, __pyx_mstate->__pyx_n_u_mechanism_param, __pyx_mstate->__pyx_n_u_pin, __pyx_mstate->__pyx_n_u_buffer_size, __pyx_mstate->__pyx_n_u_session, __pyx_mstate->__pyx_n_u_data_ptr, __pyx_mstate->__pyx_n_u_data_len, __pyx_mstate->__pyx_n_u_op};
    __pyx_mstate_global->__pyx_codeobj_tab[94] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_sign, __pyx_mstate->__pyx_kp_b_iso88591_A_4Ja_t1_Cq_D_9_EVVW_t7_AQ_2_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[94])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {6, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1735};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_data, __pyx_mstate->__pyx_n_u_mechanism, __pyx_mstate->__pyx_n_u_mechanism_param, __pyx_mstate->__pyx_n_u_pin, __pyx_mstate->__pyx_n_u_buffer_size, __pyx_mstate->__pyx_n_u_session, __pyx_mstate->__pyx_n_u_op};
    __pyx_mstate_global->__pyx_codeobj_tab[95] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_sign_generator, __pyx_mstate->__pyx_kp_b_iso88591_A_j_t1_D_9_EVVW_t7_AQ_nAQ_2WA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[95])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1782};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_session, __pyx_mstate->__pyx_n_u_dummy};
    __pyx_mstate_global->__pyx_codeobj_tab[96] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_unclean_shutdown, __pyx_mstate->__pyx_kp_b_iso88591_A_t1_Q_9N_7_1G1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[96])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[97] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[97])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[98] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[98])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1792};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_mechanism, __pyx_mstate->__pyx_n_u_mechanism_param, __pyx_mstate->__pyx_n_u_mech};
    __pyx_mstate_global->__pyx_codeobj_tab[99] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_verify_operation, __pyx_mstate->__pyx_kp_b_iso88591_A_k1J_UV_ZvT, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[99])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1796};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_data, __pyx_mstate->__pyx_n_u_signature, __pyx_mstate->__pyx_n_u_mechanism, __pyx_mstate->__pyx_n_u_mechanism_param, __pyx_mstate->__pyx_n_u_data_ptr, __pyx_mstate->__pyx_n_u_data_len, __pyx_mstate->__pyx_n_u_sig_ptr, __pyx_mstate->__pyx_n_u_sig_len, __pyx_mstate->__pyx_n_u_op};
    __pyx_mstate_global->__pyx_codeobj_tab[100] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_verify, __pyx_mstate->__pyx_kp_b_iso88591_A_Cq_3aq_d_Qk_1Jj, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[100])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1808};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_data, __pyx_mstate->__pyx_n_u_signature, __pyx_mstate->__pyx_n_u_mechanism, __pyx_mstate->__pyx_n_u_mechanism_param, __pyx_mstate->__pyx_n_u_sig_ptr, __pyx_mstate->__pyx_n_u_sig_len, __pyx_mstate->__pyx_n_u_op};
    __pyx_mstate_global->__pyx_codeobj_tab[101] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_verify_generator, __pyx_mstate->__pyx_kp_b_iso88591_A_3aq_d_Qk_nAQ_2WAYa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[101])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 12, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1823};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_mechanism, __pyx_mstate->__pyx_n_u_mechanism_param, __pyx_mstate->__pyx_n_u_mech, __pyx_mstate->__pyx_n_u_session, __pyx_mstate->__pyx_n_u_mech_data, __pyx_mstate->__pyx_n_u_wrapping_key, __pyx_mstate->__pyx_n_u_key_to_wrap, __pyx_mstate->__pyx_n_u_length, __pyx_mstate->__pyx_n_u_retval, __pyx_mstate->__pyx_n_u_data};
    __pyx_mstate_global->__pyx_codeobj_tab[102] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_wrap_key, __pyx_mstate->__pyx_kp_b_iso88591_A_4z_uA_aq_k1J_UV_t1_t1_T_Cq_WIZ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[102])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {11, 0, 0, 23, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1855};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_object_class, __pyx_mstate->__pyx_n_u_key_type, __pyx_mstate->__pyx_n_u_key_data, __pyx_mstate->__pyx_n_u_id, __pyx_mstate->__pyx_n_u_label, __pyx_mstate->__pyx_n_u_mechanism, __pyx_mstate->__pyx_n_u_mechanism_param, __pyx_mstate->__pyx_n_u_store, __pyx_mstate->__pyx_n_u_capabilities, __pyx_mstate->__pyx_n_u_template, __pyx_mstate->__pyx_n_u_mech, __pyx_mstate->__pyx_n_u_session, __pyx_mstate->__pyx_n_u_template_2, __pyx_mstate->__pyx_n_u_attrs, __pyx_mstate->__pyx_n_u_mech_data, __pyx_mstate->__pyx_n_u_unwrapping_key, __pyx_mstate->__pyx_n_u_wrapped_key_ptr, __pyx_mstate->__pyx_n_u_wrapped_key_len, __pyx_mstate->__pyx_n_u_attr_data, __pyx_mstate->__pyx_n_u_attr_count, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_retval};
    __pyx_mstate_global->__pyx_codeobj_tab[103] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_unwrap_key, __pyx_mstate->__pyx_kp_b_iso88591_A_A_1_4z_aq_4z_A_aq_1_7q_l_1_k1J, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[103])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {10, 0, 0, 20, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1909};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key_type, __pyx_mstate->__pyx_n_u_key_length, __pyx_mstate->__pyx_n_u_id, __pyx_mstate->__pyx_n_u_label, __pyx_mstate->__pyx_n_u_store, __pyx_mstate->__pyx_n_u_capabilities, __pyx_mstate->__pyx_n_u_mechanism, __pyx_mstate->__pyx_n_u_mechanism_param, __pyx_mstate->__pyx_n_u_template, __pyx_mstate->__pyx_n_u_mech, __pyx_mstate->__pyx_n_u_session, __pyx_mstate->__pyx_n_u_template_2, __pyx_mstate->__pyx_n_u_attrs, __pyx_mstate->__pyx_n_u_mech_data, __pyx_mstate->__pyx_n_u_src_key, __pyx_mstate->__pyx_n_u_attr_data, __pyx_mstate->__pyx_n_u_attr_count, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_retval};
    __pyx_mstate_global->__pyx_codeobj_tab[104] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_derive_key, __pyx_mstate->__pyx_kp_b_iso88591_A_A_1_4z_A_aq_4z_a_aq_1_7q_l_1_k, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[104])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2024};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[105] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_initialize, __pyx_mstate->__pyx_kp_b_iso88591_A_4z_E_T_Q_Ym1A_AQ_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[105])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2039};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[106] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_finalize_2, __pyx_mstate->__pyx_kp_b_iso88591_A_Zq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[106])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2042};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[107] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_reinitialize, __pyx_mstate->__pyx_kp_b_iso88591_A_4z_A_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[107])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2090};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_token_present, __pyx_mstate->__pyx_n_u_present, __pyx_mstate->__pyx_n_u_count, __pyx_mstate->__pyx_n_u_retval, __pyx_mstate->__pyx_n_u_slot_list, __pyx_mstate->__pyx_n_u_slot_id, __pyx_mstate->__pyx_n_u_info, __pyx_mstate->__pyx_n_u_slots};
    __pyx_mstate_global->__pyx_codeobj_tab[108] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_get_slots, __pyx_mstate->__pyx_kp_b_iso88591_a_T_6_A_1_q_T_9AT_Kq_YnAYaq_AQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[108])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 2164};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_kwargs, __pyx_mstate->__pyx_n_u_iterator, __pyx_mstate->__pyx_n_u_token};
    __pyx_mstate_global->__pyx_codeobj_tab[109] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_get_token, __pyx_mstate->__pyx_kp_b_iso88591_A_4_Q_D_Q_5Rq_r_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[109])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2180};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_blocking, __pyx_mstate->__pyx_n_u_slot_id, __pyx_mstate->__pyx_n_u_flag, __pyx_mstate->__pyx_n_u_retval, __pyx_mstate->__pyx_n_u_info, __pyx_mstate->__pyx_n_u_slotDescription, __pyx_mstate->__pyx_n_u_manufacturerID};
    __pyx_mstate_global->__pyx_codeobj_tab[110] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_wait_for_slot_event, __pyx_mstate->__pyx_kp_b_iso88591_1_Q_4q_A_T_5QfAYa_T_1_b_uA__BgU, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[110])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2204};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[111] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pkcs11__pkcs11_pyx, __pyx_mstate->__pyx_n_u_unload, __pyx_mstate->__pyx_kp_b_iso88591_A_Ja_L_4_Cq_Qd_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[111])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[112] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[112])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[113] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[113])) goto bad;
  }
  Py_DECREF(tuple_dedup_map);
  return 0;
  bad:
  Py_DECREF(tuple_dedup_map);
  return -1;
}
/* #### Code section: init_globals ### */

static int __Pyx_InitGlobals(void) {
  /* PythonCompatibility.init */
  if (likely(__Pyx_init_co_variables() == 0)); else
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* AssertionsEnabled.init */
  if (likely(__Pyx_init_assertions_enabled() == 0)); else
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* CommonTypesMetaclass.init */
  if (likely(__pyx_CommonTypesMetaclass_init(__pyx_m) == 0)); else
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* Generator.init */
  if (likely(__pyx_Generator_init(__pyx_m) == 0)); else
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* CachedMethodType.init */
  #if CYTHON_COMPILING_IN_LIMITED_API
  {
      PyObject *typesModule=NULL;
      typesModule = PyImport_ImportModule("types");
      if (typesModule) {
          __pyx_mstate_global->__Pyx_CachedMethodType = PyObject_GetAttrString(typesModule, "MethodType");
          Py_DECREF(typesModule);
      }
  } // error handling follows
  #endif
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* CythonFunctionShared.init */
  if (likely(__pyx_CyFunction_init(__pyx_m) == 0)); else
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  return 0;
  __pyx_L1_error:;
  return -1;
}
/* #### Code section: cleanup_globals ### */
/* #### Code section: cleanup_module ### */
/* #### Code section: main_method ### */
/* #### Code section: utility_code_pragmas ### */
#ifdef _MSC_VER
#pragma warning( push )
/* Warning 4127: conditional expression is constant
 * Cython uses constant conditional expressions to allow in inline functions to be optimized at
 * compile-time, so this warning is not useful
 */
#pragma warning( disable : 4127 )
#endif



/* #### Code section: utility_code_def ### */

/* --- Runtime support code --- */
/* Refnanny */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule(modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, "RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

/* PyErrExceptionMatches (used by PyObjectGetAttrStrNoError) */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    n = PyTuple_GET_SIZE(tuple);
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
    for (i=0; i<n; i++) {
        if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
    int result;
    PyObject *exc_type;
#if PY_VERSION_HEX >= 0x030C00A6
    PyObject *current_exception = tstate->current_exception;
    if (unlikely(!current_exception)) return 0;
    exc_type = (PyObject*) Py_TYPE(current_exception);
    if (exc_type == err) return 1;
#else
    exc_type = tstate->curexc_type;
    if (exc_type == err) return 1;
    if (unlikely(!exc_type)) return 0;
#endif
    #if CYTHON_AVOID_BORROWED_REFS
    Py_INCREF(exc_type);
    #endif
    if (unlikely(PyTuple_Check(err))) {
        result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
    } else {
        result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
    }
    #if CYTHON_AVOID_BORROWED_REFS
    Py_DECREF(exc_type);
    #endif
    return result;
}
#endif

/* PyErrFetchRestore (used by PyObjectGetAttrStrNoError) */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
#if PY_VERSION_HEX >= 0x030C00A6
    PyObject *tmp_value;
    assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value)));
    if (value) {
        #if CYTHON_COMPILING_IN_CPYTHON
        if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb))
        #endif
            PyException_SetTraceback(value, tb);
    }
    tmp_value = tstate->current_exception;
    tstate->current_exception = value;
    Py_XDECREF(tmp_value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
#else
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#endif
}
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
#if PY_VERSION_HEX >= 0x030C00A6
    PyObject* exc_value;
    exc_value = tstate->current_exception;
    tstate->current_exception = 0;
    *value = exc_value;
    *type = NULL;
    *tb = NULL;
    if (exc_value) {
        *type = (PyObject*) Py_TYPE(exc_value);
        Py_INCREF(*type);
        #if CYTHON_COMPILING_IN_CPYTHON
        *tb = ((PyBaseExceptionObject*) exc_value)->traceback;
        Py_XINCREF(*tb);
        #else
        *tb = PyException_GetTraceback(exc_value);
        #endif
    }
#else
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#endif
}
#endif

/* PyObjectGetAttrStr (used by PyObjectGetAttrStrNoError) */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
    return PyObject_GetAttr(obj, attr_name);
}
#endif

/* PyObjectGetAttrStrNoError (used by GetBuiltinName) */
#if __PYX_LIMITED_VERSION_HEX < 0x030d0000
static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        __Pyx_PyErr_Clear();
}
#endif
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
    PyObject *result;
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
    (void) PyObject_GetOptionalAttr(obj, attr_name, &result);
    return result;
#else
#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
        return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
    }
#endif
    result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
    if (unlikely(!result)) {
        __Pyx_PyObject_GetAttrStr_ClearAttributeError();
    }
    return result;
#endif
}

/* GetBuiltinName */
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_mstate_global->__pyx_b, name);
    if (unlikely(!result) && !PyErr_Occurred()) {
        PyErr_Format(PyExc_NameError,
            "name '%U' is not defined", name);
    }
    return result;
}

/* GetTopmostException (used by SaveResetException) */
#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
{
    _PyErr_StackItem *exc_info = tstate->exc_info;
    while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) &&
           exc_info->previous_item != NULL)
    {
        exc_info = exc_info->previous_item;
    }
    return exc_info;
}
#endif

/* SaveResetException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    PyObject *exc_value = exc_info->exc_value;
    if (exc_value == NULL || exc_value == Py_None) {
        *value = NULL;
        *type = NULL;
        *tb = NULL;
    } else {
        *value = exc_value;
        Py_INCREF(*value);
        *type = (PyObject*) Py_TYPE(exc_value);
        Py_INCREF(*type);
        *tb = PyException_GetTraceback(exc_value);
    }
  #elif CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    *type = exc_info->exc_type;
    *value = exc_info->exc_value;
    *tb = exc_info->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
  #else
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
  #endif
}
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
    _PyErr_StackItem *exc_info = tstate->exc_info;
    PyObject *tmp_value = exc_info->exc_value;
    exc_info->exc_value = value;
    Py_XDECREF(tmp_value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
  #else
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = type;
    exc_info->exc_value = value;
    exc_info->exc_traceback = tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
  #endif
}
#endif

/* FastTypeChecks */
#if CYTHON_COMPILING_IN_CPYTHON
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
    while (a) {
        a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*);
        if (a == b)
            return 1;
    }
    return b == &PyBaseObject_Type;
}
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (a == b) return 1;
    mro = a->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(a, b);
}
static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (cls == a || cls == b) return 1;
    mro = cls->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            PyObject *base = PyTuple_GET_ITEM(mro, i);
            if (base == (PyObject *)a || base == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b);
}
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
    if (exc_type1) {
        return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2);
    } else {
        return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
    }
}
static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    assert(PyExceptionClass_Check(exc_type));
    n = PyTuple_GET_SIZE(tuple);
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
    for (i=0; i<n; i++) {
        PyObject *t = PyTuple_GET_ITEM(tuple, i);
        if (likely(PyExceptionClass_Check(t))) {
            if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
        } else {
        }
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
    if (likely(err == exc_type)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        if (likely(PyExceptionClass_Check(exc_type))) {
            return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
        } else if (likely(PyTuple_Check(exc_type))) {
            return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
        } else {
        }
    }
    return PyErr_GivenExceptionMatches(err, exc_type);
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
    assert(PyExceptionClass_Check(exc_type1));
    assert(PyExceptionClass_Check(exc_type2));
    if (likely(err == exc_type1 || err == exc_type2)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
    }
    return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
}
#endif

/* TupleAndListFromArray (used by fastcall) */
#if !CYTHON_COMPILING_IN_CPYTHON && CYTHON_METH_FASTCALL
static CYTHON_INLINE PyObject *
__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)
{
    PyObject *res;
    Py_ssize_t i;
    if (n <= 0) {
        return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple);
    }
    res = PyTuple_New(n);
    if (unlikely(res == NULL)) return NULL;
    for (i = 0; i < n; i++) {
        Py_INCREF(src[i]);
        if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < (0))) {
            Py_DECREF(res);
            return NULL;
        }
    }
    return res;
}
#elif CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) {
    PyObject *v;
    Py_ssize_t i;
    for (i = 0; i < length; i++) {
        v = dest[i] = src[i];
        Py_INCREF(v);
    }
}
static CYTHON_INLINE PyObject *
__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)
{
    PyObject *res;
    if (n <= 0) {
        return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple);
    }
    res = PyTuple_New(n);
    if (unlikely(res == NULL)) return NULL;
    __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n);
    return res;
}
static CYTHON_INLINE PyObject *
__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n)
{
    PyObject *res;
    if (n <= 0) {
        return PyList_New(0);
    }
    res = PyList_New(n);
    if (unlikely(res == NULL)) return NULL;
    __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n);
    return res;
}
#endif

/* BytesEquals (used by UnicodeEquals) */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL ||\
        !(CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS)
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        const char *ps1, *ps2;
        Py_ssize_t length = PyBytes_GET_SIZE(s1);
        if (length != PyBytes_GET_SIZE(s2))
            return (equals == Py_NE);
        ps1 = PyBytes_AS_STRING(s1);
        ps2 = PyBytes_AS_STRING(s2);
        if (ps1[0] != ps2[0]) {
            return (equals == Py_NE);
        } else if (length == 1) {
            return (equals == Py_EQ);
        } else {
            int result;
#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000)
            Py_hash_t hash1, hash2;
            hash1 = ((PyBytesObject*)s1)->ob_shash;
            hash2 = ((PyBytesObject*)s2)->ob_shash;
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                return (equals == Py_NE);
            }
#endif
            result = memcmp(ps1, ps2, (size_t)length);
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
#endif
}

/* UnicodeEquals (used by fastcall) */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    int s1_is_unicode, s2_is_unicode;
    if (s1 == s2) {
        goto return_eq;
    }
    s1_is_unicode = PyUnicode_CheckExact(s1);
    s2_is_unicode = PyUnicode_CheckExact(s2);
    if (s1_is_unicode & s2_is_unicode) {
        Py_ssize_t length, length2;
        int kind;
        void *data1, *data2;
        #if !CYTHON_COMPILING_IN_LIMITED_API
        if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
            return -1;
        #endif
        length = __Pyx_PyUnicode_GET_LENGTH(s1);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(length < 0)) return -1;
        #endif
        length2 = __Pyx_PyUnicode_GET_LENGTH(s2);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(length2 < 0)) return -1;
        #endif
        if (length != length2) {
            goto return_ne;
        }
#if CYTHON_USE_UNICODE_INTERNALS
        {
            Py_hash_t hash1, hash2;
            hash1 = ((PyASCIIObject*)s1)->hash;
            hash2 = ((PyASCIIObject*)s2)->hash;
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                goto return_ne;
            }
        }
#endif
        kind = __Pyx_PyUnicode_KIND(s1);
        if (kind != __Pyx_PyUnicode_KIND(s2)) {
            goto return_ne;
        }
        data1 = __Pyx_PyUnicode_DATA(s1);
        data2 = __Pyx_PyUnicode_DATA(s2);
        if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
            goto return_ne;
        } else if (length == 1) {
            goto return_eq;
        } else {
            int result = memcmp(data1, data2, (size_t)(length * kind));
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & s2_is_unicode) {
        goto return_ne;
    } else if ((s2 == Py_None) & s1_is_unicode) {
        goto return_ne;
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
return_eq:
    return (equals == Py_EQ);
return_ne:
    return (equals == Py_NE);
#endif
}

/* fastcall */
#if CYTHON_METH_FASTCALL
static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s)
{
    Py_ssize_t i, n = __Pyx_PyTuple_GET_SIZE(kwnames);
    #if !CYTHON_ASSUME_SAFE_SIZE
    if (unlikely(n == -1)) return NULL;
    #endif
    for (i = 0; i < n; i++)
    {
        PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i);
        #if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely(!namei)) return NULL;
        #endif
        if (s == namei) return kwvalues[i];
    }
    for (i = 0; i < n; i++)
    {
        PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i);
        #if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely(!namei)) return NULL;
        #endif
        int eq = __Pyx_PyUnicode_Equals(s, namei, Py_EQ);
        if (unlikely(eq != 0)) {
            if (unlikely(eq < 0)) return NULL;
            return kwvalues[i];
        }
    }
    return NULL;
}
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) {
    Py_ssize_t i, nkwargs;
    PyObject *dict;
#if !CYTHON_ASSUME_SAFE_SIZE
    nkwargs = PyTuple_Size(kwnames);
    if (unlikely(nkwargs < 0)) return NULL;
#else
    nkwargs = PyTuple_GET_SIZE(kwnames);
#endif
    dict = PyDict_New();
    if (unlikely(!dict))
        return NULL;
    for (i=0; i<nkwargs; i++) {
#if !CYTHON_ASSUME_SAFE_MACROS
        PyObject *key = PyTuple_GetItem(kwnames, i);
        if (!key) goto bad;
#else
        PyObject *key = PyTuple_GET_ITEM(kwnames, i);
#endif
        if (unlikely(PyDict_SetItem(dict, key, kwvalues[i]) < 0))
            goto bad;
    }
    return dict;
bad:
    Py_DECREF(dict);
    return NULL;
}
#endif
#endif

/* PyObjectCall (used by PyObjectFastCall) */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = Py_TYPE(func)->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
        return NULL;
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCallMethO (used by PyObjectFastCall) */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func);
    self = __Pyx_CyOrPyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
        return NULL;
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectFastCall (used by PyObjectCallOneArg) */
#if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API
static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs) {
    PyObject *argstuple;
    PyObject *result = 0;
    size_t i;
    argstuple = PyTuple_New((Py_ssize_t)nargs);
    if (unlikely(!argstuple)) return NULL;
    for (i = 0; i < nargs; i++) {
        Py_INCREF(args[i]);
        if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) != (0)) goto bad;
    }
    result = __Pyx_PyObject_Call(func, argstuple, kwargs);
  bad:
    Py_DECREF(argstuple);
    return result;
}
#endif
#if CYTHON_VECTORCALL && !CYTHON_COMPILING_IN_LIMITED_API
  #if PY_VERSION_HEX < 0x03090000
    #define __Pyx_PyVectorcall_Function(callable) _PyVectorcall_Function(callable)
  #elif CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE vectorcallfunc __Pyx_PyVectorcall_Function(PyObject *callable) {
    PyTypeObject *tp = Py_TYPE(callable);
    #if defined(__Pyx_CyFunction_USED)
    if (__Pyx_CyFunction_CheckExact(callable)) {
        return __Pyx_CyFunction_func_vectorcall(callable);
    }
    #endif
    if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_VECTORCALL)) {
        return NULL;
    }
    assert(PyCallable_Check(callable));
    Py_ssize_t offset = tp->tp_vectorcall_offset;
    assert(offset > 0);
    vectorcallfunc ptr;
    memcpy(&ptr, (char *) callable + offset, sizeof(ptr));
    return ptr;
}
  #else
    #define __Pyx_PyVectorcall_Function(callable) PyVectorcall_Function(callable)
  #endif
#endif
static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject *const *args, size_t _nargs, PyObject *kwargs) {
    Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs);
#if CYTHON_COMPILING_IN_CPYTHON
    if (nargs == 0 && kwargs == NULL) {
        if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS))
            return __Pyx_PyObject_CallMethO(func, NULL);
    }
    else if (nargs == 1 && kwargs == NULL) {
        if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O))
            return __Pyx_PyObject_CallMethO(func, args[0]);
    }
#endif
    if (kwargs == NULL) {
        #if CYTHON_VECTORCALL
          #if CYTHON_COMPILING_IN_LIMITED_API
            return PyObject_Vectorcall(func, args, _nargs, NULL);
          #else
            vectorcallfunc f = __Pyx_PyVectorcall_Function(func);
            if (f) {
                return f(func, args, _nargs, NULL);
            }
          #endif
        #endif
    }
    if (nargs == 0) {
        return __Pyx_PyObject_Call(func, __pyx_mstate_global->__pyx_empty_tuple, kwargs);
    }
    #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API
    return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs);
    #else
    return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs);
    #endif
}

/* PyObjectCallOneArg (used by CallUnboundCMethod0) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *args[2] = {NULL, arg};
    return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
}

/* UnpackUnboundCMethod (used by CallUnboundCMethod0) */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000
static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) {
    PyObject *result;
    PyObject *selfless_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args));
    if (unlikely(!selfless_args)) return NULL;
    result = PyObject_Call(method, selfless_args, kwargs);
    Py_DECREF(selfless_args);
    return result;
}
#elif CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03090000
static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) {
        return _PyObject_Vectorcall
            (method, args ? args+1 : NULL, nargs ? nargs-1 : 0, kwnames);
}
#else
static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) {
    return
#if PY_VERSION_HEX < 0x03090000
    _PyObject_Vectorcall
#else
    PyObject_Vectorcall
#endif
        (method, args ? args+1 : NULL, nargs ? (size_t) nargs-1 : 0, kwnames);
}
#endif
static PyMethodDef __Pyx_UnboundCMethod_Def = {
     "CythonUnboundCMethod",
     __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_SelflessCall),
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000
     METH_VARARGS | METH_KEYWORDS,
#else
     METH_FASTCALL | METH_KEYWORDS,
#endif
     NULL
};
static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
    PyObject *method, *result=NULL;
    method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
    if (unlikely(!method))
        return -1;
    result = method;
#if CYTHON_COMPILING_IN_CPYTHON
    if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
    {
        PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
        target->func = descr->d_method->ml_meth;
        target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
    } else
#endif
#if CYTHON_COMPILING_IN_PYPY
#else
    if (PyCFunction_Check(method))
#endif
    {
        PyObject *self;
        int self_found;
#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
        self = PyObject_GetAttrString(method, "__self__");
        if (!self) {
            PyErr_Clear();
        }
#else
        self = PyCFunction_GET_SELF(method);
#endif
        self_found = (self && self != Py_None);
#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
        Py_XDECREF(self);
#endif
        if (self_found) {
            PyObject *unbound_method = PyCFunction_New(&__Pyx_UnboundCMethod_Def, method);
            if (unlikely(!unbound_method)) return -1;
            Py_DECREF(method);
            result = unbound_method;
        }
    }
#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    if (unlikely(target->method)) {
        Py_DECREF(result);
    } else
#endif
    target->method = result;
    return 0;
}

/* CallUnboundCMethod0 */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
    int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc);
    if (likely(was_initialized == 2 && cfunc->func)) {
        if (likely(cfunc->flag == METH_NOARGS))
            return __Pyx_CallCFunction(cfunc, self, NULL);
        if (likely(cfunc->flag == METH_FASTCALL))
            return __Pyx_CallCFunctionFast(cfunc, self, NULL, 0);
        if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
            return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, NULL, 0, NULL);
        if (likely(cfunc->flag == (METH_VARARGS | METH_KEYWORDS)))
            return __Pyx_CallCFunctionWithKeywords(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple, NULL);
        if (cfunc->flag == METH_VARARGS)
            return __Pyx_CallCFunction(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple);
        return __Pyx__CallUnboundCMethod0(cfunc, self);
    }
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    else if (unlikely(was_initialized == 1)) {
        __Pyx_CachedCFunction tmp_cfunc = {
#ifndef __cplusplus
            0
#endif
        };
        tmp_cfunc.type = cfunc->type;
        tmp_cfunc.method_name = cfunc->method_name;
        return __Pyx__CallUnboundCMethod0(&tmp_cfunc, self);
    }
#endif
    PyObject *result = __Pyx__CallUnboundCMethod0(cfunc, self);
    __Pyx_CachedCFunction_SetFinishedInitializing(cfunc);
    return result;
}
#endif
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
    PyObject *result;
    if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
    result = __Pyx_PyObject_CallOneArg(cfunc->method, self);
    return result;
}

/* py_dict_items (used by OwnedDictNext) */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) {
    return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_items, d);
}

/* py_dict_values (used by OwnedDictNext) */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) {
    return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_values, d);
}

/* OwnedDictNext (used by ParseKeywordsImpl) */
#if CYTHON_AVOID_BORROWED_REFS
static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue) {
    PyObject *next = NULL;
    if (!*ppos) {
        if (pvalue) {
            PyObject *dictview = pkey ? __Pyx_PyDict_Items(p) : __Pyx_PyDict_Values(p);
            if (unlikely(!dictview)) goto bad;
            *ppos = PyObject_GetIter(dictview);
            Py_DECREF(dictview);
        } else {
            *ppos = PyObject_GetIter(p);
        }
        if (unlikely(!*ppos)) goto bad;
    }
    next = PyIter_Next(*ppos);
    if (!next) {
        if (PyErr_Occurred()) goto bad;
        return 0;
    }
    if (pkey && pvalue) {
        *pkey = __Pyx_PySequence_ITEM(next, 0);
        if (unlikely(*pkey)) goto bad;
        *pvalue = __Pyx_PySequence_ITEM(next, 1);
        if (unlikely(*pvalue)) goto bad;
        Py_DECREF(next);
    } else if (pkey) {
        *pkey = next;
    } else {
        assert(pvalue);
        *pvalue = next;
    }
    return 1;
  bad:
    Py_XDECREF(next);
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000
    PyErr_FormatUnraisable("Exception ignored in __Pyx_PyDict_NextRef");
#else
    PyErr_WriteUnraisable(__pyx_mstate_global->__pyx_n_u_Pyx_PyDict_NextRef);
#endif
    if (pkey) *pkey = NULL;
    if (pvalue) *pvalue = NULL;
    return 0;
}
#else // !CYTHON_AVOID_BORROWED_REFS
static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue) {
    int result = PyDict_Next(p, ppos, pkey, pvalue);
    if (likely(result == 1)) {
        if (pkey) Py_INCREF(*pkey);
        if (pvalue) Py_INCREF(*pvalue);
    }
    return result;
}
#endif

/* RaiseDoubleKeywords (used by ParseKeywordsImpl) */
static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
}

/* CallUnboundCMethod2 */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) {
    int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc);
    if (likely(was_initialized == 2 && cfunc->func)) {
        PyObject *args[2] = {arg1, arg2};
        if (cfunc->flag == METH_FASTCALL) {
            return __Pyx_CallCFunctionFast(cfunc, self, args, 2);
        }
        if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
            return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, 2, NULL);
    }
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    else if (unlikely(was_initialized == 1)) {
        __Pyx_CachedCFunction tmp_cfunc = {
#ifndef __cplusplus
            0
#endif
        };
        tmp_cfunc.type = cfunc->type;
        tmp_cfunc.method_name = cfunc->method_name;
        return __Pyx__CallUnboundCMethod2(&tmp_cfunc, self, arg1, arg2);
    }
#endif
    PyObject *result = __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2);
    __Pyx_CachedCFunction_SetFinishedInitializing(cfunc);
    return result;
}
#endif
static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){
    if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_COMPILING_IN_CPYTHON
    if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
        PyObject *result = NULL;
        PyObject *args = PyTuple_New(2);
        if (unlikely(!args)) return NULL;
        Py_INCREF(arg1);
        PyTuple_SET_ITEM(args, 0, arg1);
        Py_INCREF(arg2);
        PyTuple_SET_ITEM(args, 1, arg2);
        if (cfunc->flag & METH_KEYWORDS)
            result = __Pyx_CallCFunctionWithKeywords(cfunc, self, args, NULL);
        else
            result = __Pyx_CallCFunction(cfunc, self, args);
        Py_DECREF(args);
        return result;
    }
#endif
    {
        PyObject *args[4] = {NULL, self, arg1, arg2};
        return __Pyx_PyObject_FastCall(cfunc->method, args+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
    }
}

/* ParseKeywordsImpl (used by ParseKeywords) */
static int __Pyx_ValidateDuplicatePosArgs(
    PyObject *kwds,
    PyObject ** const argnames[],
    PyObject ** const *first_kw_arg,
    const char* function_name)
{
    PyObject ** const *name = argnames;
    while (name != first_kw_arg) {
        PyObject *key = **name;
        int found = PyDict_Contains(kwds, key);
        if (unlikely(found)) {
            if (found == 1) __Pyx_RaiseDoubleKeywordsError(function_name, key);
            goto bad;
        }
        name++;
    }
    return 0;
bad:
    return -1;
}
#if CYTHON_USE_UNICODE_INTERNALS
static CYTHON_INLINE int __Pyx_UnicodeKeywordsEqual(PyObject *s1, PyObject *s2) {
    int kind;
    Py_ssize_t len = PyUnicode_GET_LENGTH(s1);
    if (len != PyUnicode_GET_LENGTH(s2)) return 0;
    kind = PyUnicode_KIND(s1);
    if (kind != PyUnicode_KIND(s2)) return 0;
    const void *data1 = PyUnicode_DATA(s1);
    const void *data2 = PyUnicode_DATA(s2);
    return (memcmp(data1, data2, (size_t) len * (size_t) kind) == 0);
}
#endif
static int __Pyx_MatchKeywordArg_str(
    PyObject *key,
    PyObject ** const argnames[],
    PyObject ** const *first_kw_arg,
    size_t *index_found,
    const char *function_name)
{
    PyObject ** const *name;
    #if CYTHON_USE_UNICODE_INTERNALS
    Py_hash_t key_hash = ((PyASCIIObject*)key)->hash;
    if (unlikely(key_hash == -1)) {
        key_hash = PyObject_Hash(key);
        if (unlikely(key_hash == -1))
            goto bad;
    }
    #endif
    name = first_kw_arg;
    while (*name) {
        PyObject *name_str = **name;
        #if CYTHON_USE_UNICODE_INTERNALS
        if (key_hash == ((PyASCIIObject*)name_str)->hash && __Pyx_UnicodeKeywordsEqual(name_str, key)) {
            *index_found = (size_t) (name - argnames);
            return 1;
        }
        #else
        #if CYTHON_ASSUME_SAFE_SIZE
        if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key))
        #endif
        {
            int cmp = PyUnicode_Compare(name_str, key);
            if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
            if (cmp == 0) {
                *index_found = (size_t) (name - argnames);
                return 1;
            }
        }
        #endif
        name++;
    }
    name = argnames;
    while (name != first_kw_arg) {
        PyObject *name_str = **name;
        #if CYTHON_USE_UNICODE_INTERNALS
        if (unlikely(key_hash == ((PyASCIIObject*)name_str)->hash)) {
            if (__Pyx_UnicodeKeywordsEqual(name_str, key))
                goto arg_passed_twice;
        }
        #else
        #if CYTHON_ASSUME_SAFE_SIZE
        if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key))
        #endif
        {
            if (unlikely(name_str == key)) goto arg_passed_twice;
            int cmp = PyUnicode_Compare(name_str, key);
            if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
            if (cmp == 0) goto arg_passed_twice;
        }
        #endif
        name++;
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
bad:
    return -1;
}
static int __Pyx_MatchKeywordArg_nostr(
    PyObject *key,
    PyObject ** const argnames[],
    PyObject ** const *first_kw_arg,
    size_t *index_found,
    const char *function_name)
{
    PyObject ** const *name;
    if (unlikely(!PyUnicode_Check(key))) goto invalid_keyword_type;
    name = first_kw_arg;
    while (*name) {
        int cmp = PyObject_RichCompareBool(**name, key, Py_EQ);
        if (cmp == 1) {
            *index_found = (size_t) (name - argnames);
            return 1;
        }
        if (unlikely(cmp == -1)) goto bad;
        name++;
    }
    name = argnames;
    while (name != first_kw_arg) {
        int cmp = PyObject_RichCompareBool(**name, key, Py_EQ);
        if (unlikely(cmp != 0)) {
            if (cmp == 1) goto arg_passed_twice;
            else goto bad;
        }
        name++;
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    goto bad;
bad:
    return -1;
}
static CYTHON_INLINE int __Pyx_MatchKeywordArg(
    PyObject *key,
    PyObject ** const argnames[],
    PyObject ** const *first_kw_arg,
    size_t *index_found,
    const char *function_name)
{
    return likely(PyUnicode_CheckExact(key)) ?
        __Pyx_MatchKeywordArg_str(key, argnames, first_kw_arg, index_found, function_name) :
        __Pyx_MatchKeywordArg_nostr(key, argnames, first_kw_arg, index_found, function_name);
}
static void __Pyx_RejectUnknownKeyword(
    PyObject *kwds,
    PyObject ** const argnames[],
    PyObject ** const *first_kw_arg,
    const char *function_name)
{
    #if CYTHON_AVOID_BORROWED_REFS
    PyObject *pos = NULL;
    #else
    Py_ssize_t pos = 0;
    #endif
    PyObject *key = NULL;
    __Pyx_BEGIN_CRITICAL_SECTION(kwds);
    while (
        #if CYTHON_AVOID_BORROWED_REFS
        __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL)
        #else
        PyDict_Next(kwds, &pos, &key, NULL)
        #endif
    ) {
        PyObject** const *name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (!*name) {
            size_t index_found = 0;
            int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name);
            if (cmp != 1) {
                if (cmp == 0) {
                    PyErr_Format(PyExc_TypeError,
                        "%s() got an unexpected keyword argument '%U'",
                        function_name, key);
                }
                #if CYTHON_AVOID_BORROWED_REFS
                Py_DECREF(key);
                #endif
                break;
            }
        }
        #if CYTHON_AVOID_BORROWED_REFS
        Py_DECREF(key);
        #endif
    }
    __Pyx_END_CRITICAL_SECTION();
    #if CYTHON_AVOID_BORROWED_REFS
    Py_XDECREF(pos);
    #endif
    assert(PyErr_Occurred());
}
static int __Pyx_ParseKeywordDict(
    PyObject *kwds,
    PyObject ** const argnames[],
    PyObject *values[],
    Py_ssize_t num_pos_args,
    Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs)
{
    PyObject** const *name;
    PyObject** const *first_kw_arg = argnames + num_pos_args;
    Py_ssize_t extracted = 0;
#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments)
    if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1;
#endif
    name = first_kw_arg;
    while (*name && num_kwargs > extracted) {
        PyObject * key = **name;
        PyObject *value;
        int found = 0;
        #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
        found = PyDict_GetItemRef(kwds, key, &value);
        #else
        value = PyDict_GetItemWithError(kwds, key);
        if (value) {
            Py_INCREF(value);
            found = 1;
        } else {
            if (unlikely(PyErr_Occurred())) goto bad;
        }
        #endif
        if (found) {
            if (unlikely(found < 0)) goto bad;
            values[name-argnames] = value;
            extracted++;
        }
        name++;
    }
    if (num_kwargs > extracted) {
        if (ignore_unknown_kwargs) {
            if (unlikely(__Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name) == -1))
                goto bad;
        } else {
            __Pyx_RejectUnknownKeyword(kwds, argnames, first_kw_arg, function_name);
            goto bad;
        }
    }
    return 0;
bad:
    return -1;
}
static int __Pyx_ParseKeywordDictToDict(
    PyObject *kwds,
    PyObject ** const argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject** const *name;
    PyObject** const *first_kw_arg = argnames + num_pos_args;
    Py_ssize_t len;
#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments)
    if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1;
#endif
    if (PyDict_Update(kwds2, kwds) < 0) goto bad;
    name = first_kw_arg;
    while (*name) {
        PyObject *key = **name;
        PyObject *value;
#if !CYTHON_COMPILING_IN_LIMITED_API && (PY_VERSION_HEX >= 0x030d00A2 || defined(PyDict_Pop))
        int found = PyDict_Pop(kwds2, key, &value);
        if (found) {
            if (unlikely(found < 0)) goto bad;
            values[name-argnames] = value;
        }
#elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000
        int found = PyDict_GetItemRef(kwds2, key, &value);
        if (found) {
            if (unlikely(found < 0)) goto bad;
            values[name-argnames] = value;
            if (unlikely(PyDict_DelItem(kwds2, key) < 0)) goto bad;
        }
#else
    #if CYTHON_COMPILING_IN_CPYTHON
        value = _PyDict_Pop(kwds2, key, kwds2);
    #else
        value = __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_pop, kwds2, key, kwds2);
    #endif
        if (value == kwds2) {
            Py_DECREF(value);
        } else {
            if (unlikely(!value)) goto bad;
            values[name-argnames] = value;
        }
#endif
        name++;
    }
    len = PyDict_Size(kwds2);
    if (len > 0) {
        return __Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name);
    } else if (unlikely(len == -1)) {
        goto bad;
    }
    return 0;
bad:
    return -1;
}
static int __Pyx_ParseKeywordsTuple(
    PyObject *kwds,
    PyObject * const *kwvalues,
    PyObject ** const argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs)
{
    PyObject *key = NULL;
    PyObject** const * name;
    PyObject** const *first_kw_arg = argnames + num_pos_args;
    for (Py_ssize_t pos = 0; pos < num_kwargs; pos++) {
#if CYTHON_AVOID_BORROWED_REFS
        key = __Pyx_PySequence_ITEM(kwds, pos);
#else
        key = __Pyx_PyTuple_GET_ITEM(kwds, pos);
#endif
#if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely(!key)) goto bad;
#endif
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            PyObject *value = kwvalues[pos];
            values[name-argnames] = __Pyx_NewRef(value);
        } else {
            size_t index_found = 0;
            int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name);
            if (cmp == 1) {
                PyObject *value = kwvalues[pos];
                values[index_found] = __Pyx_NewRef(value);
            } else {
                if (unlikely(cmp == -1)) goto bad;
                if (kwds2) {
                    PyObject *value = kwvalues[pos];
                    if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
                } else if (!ignore_unknown_kwargs) {
                    goto invalid_keyword;
                }
            }
        }
        #if CYTHON_AVOID_BORROWED_REFS
        Py_DECREF(key);
        key = NULL;
        #endif
    }
    return 0;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    goto bad;
bad:
    #if CYTHON_AVOID_BORROWED_REFS
    Py_XDECREF(key);
    #endif
    return -1;
}

/* ParseKeywords */
static int __Pyx_ParseKeywords(
    PyObject *kwds,
    PyObject * const *kwvalues,
    PyObject ** const argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs)
{
    if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)))
        return __Pyx_ParseKeywordsTuple(kwds, kwvalues, argnames, kwds2, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs);
    else if (kwds2)
        return __Pyx_ParseKeywordDictToDict(kwds, argnames, kwds2, values, num_pos_args, function_name);
    else
        return __Pyx_ParseKeywordDict(kwds, argnames, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs);
}

/* RaiseArgTupleInvalid */
static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *more_or_less;
    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

/* ArgTypeTestFunc (used by ArgTypeTest) */
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
{
    __Pyx_TypeName type_name;
    __Pyx_TypeName obj_type_name;
    PyObject *extra_info = __pyx_mstate_global->__pyx_empty_unicode;
    int from_annotation_subclass = 0;
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    else if (!exact) {
        if (likely(__Pyx_TypeCheck(obj, type))) return 1;
    } else if (exact == 2) {
        if (__Pyx_TypeCheck(obj, type)) {
            from_annotation_subclass = 1;
            extra_info = __pyx_mstate_global->__pyx_kp_u_Note_that_Cython_is_deliberately;
        }
    }
    type_name = __Pyx_PyType_GetFullyQualifiedName(type);
    obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME
        ", got " __Pyx_FMT_TYPENAME ")"
#if __PYX_LIMITED_VERSION_HEX < 0x030C0000
        "%s%U"
#endif
        , name, type_name, obj_type_name
#if __PYX_LIMITED_VERSION_HEX < 0x030C0000
        , (from_annotation_subclass ? ". " : ""), extra_info
#endif
        );
#if __PYX_LIMITED_VERSION_HEX >= 0x030C0000
    if (exact == 2 && from_annotation_subclass) {
        PyObject *res;
        PyObject *vargs[2];
        vargs[0] = PyErr_GetRaisedException();
        vargs[1] = extra_info;
        res = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_kp_u_add_note, vargs, 2, NULL);
        Py_XDECREF(res);
        PyErr_SetRaisedException(vargs[0]);
    }
#endif
    __Pyx_DECREF_TypeName(type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
    return 0;
}

/* RaiseException */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *instance_class = NULL;
        if (value && PyExceptionInstance_Check(value)) {
            instance_class = (PyObject*) Py_TYPE(value);
            if (instance_class != type) {
                int is_subclass = PyObject_IsSubclass(instance_class, type);
                if (!is_subclass) {
                    instance_class = NULL;
                } else if (unlikely(is_subclass == -1)) {
                    goto bad;
                } else {
                    type = instance_class;
                }
            }
        }
        if (!instance_class) {
            PyObject *args;
            if (!value)
                args = PyTuple_New(0);
            else if (PyTuple_Check(value)) {
                Py_INCREF(value);
                args = value;
            } else
                args = PyTuple_Pack(1, value);
            if (!args)
                goto bad;
            owned_instance = PyObject_Call(type, args, NULL);
            Py_DECREF(args);
            if (!owned_instance)
                goto bad;
            value = owned_instance;
            if (!PyExceptionInstance_Check(value)) {
                PyErr_Format(PyExc_TypeError,
                             "calling %R should have returned an instance of "
                             "BaseException, not %R",
                             type, Py_TYPE(value));
                goto bad;
            }
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
    if (cause) {
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
#if PY_VERSION_HEX >= 0x030C00A6
        PyException_SetTraceback(value, tb);
#elif CYTHON_FAST_THREAD_STATE
        PyThreadState *tstate = __Pyx_PyThreadState_Current;
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
#else
        PyObject *tmp_type, *tmp_value, *tmp_tb;
        PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
        Py_INCREF(tb);
        PyErr_Restore(tmp_type, tmp_value, tb);
        Py_XDECREF(tmp_tb);
#endif
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}

/* PyObjectFastCallMethod */
#if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000
static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf) {
    PyObject *result;
    PyObject *attr = PyObject_GetAttr(args[0], name);
    if (unlikely(!attr))
        return NULL;
    result = __Pyx_PyObject_FastCall(attr, args+1, nargsf - 1);
    Py_DECREF(attr);
    return result;
}
#endif

/* RaiseUnexpectedTypeError */
static int
__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj)
{
    __Pyx_TypeName obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME,
                 expected, obj_type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
    return 0;
}

/* CIntToDigits (used by CIntToPyUnicode) */
static const char DIGIT_PAIRS_10[2*10*10+1] = {
    "00010203040506070809"
    "10111213141516171819"
    "20212223242526272829"
    "30313233343536373839"
    "40414243444546474849"
    "50515253545556575859"
    "60616263646566676869"
    "70717273747576777879"
    "80818283848586878889"
    "90919293949596979899"
};
static const char DIGIT_PAIRS_8[2*8*8+1] = {
    "0001020304050607"
    "1011121314151617"
    "2021222324252627"
    "3031323334353637"
    "4041424344454647"
    "5051525354555657"
    "6061626364656667"
    "7071727374757677"
};
static const char DIGITS_HEX[2*16+1] = {
    "0123456789abcdef"
    "0123456789ABCDEF"
};

/* BuildPyUnicode (used by COrdinalToPyUnicode) */
static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, const char* chars, int clength,
                                                int prepend_sign, char padding_char) {
    PyObject *uval;
    Py_ssize_t uoffset = ulength - clength;
#if CYTHON_USE_UNICODE_INTERNALS
    Py_ssize_t i;
    void *udata;
    uval = PyUnicode_New(ulength, 127);
    if (unlikely(!uval)) return NULL;
    udata = PyUnicode_DATA(uval);
    if (uoffset > 0) {
        i = 0;
        if (prepend_sign) {
            __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, 0, '-');
            i++;
        }
        for (; i < uoffset; i++) {
            __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, i, padding_char);
        }
    }
    for (i=0; i < clength; i++) {
        __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, uoffset+i, chars[i]);
    }
#else
    {
        PyObject *sign = NULL, *padding = NULL;
        uval = NULL;
        if (uoffset > 0) {
            prepend_sign = !!prepend_sign;
            if (uoffset > prepend_sign) {
                padding = PyUnicode_FromOrdinal(padding_char);
                if (likely(padding) && uoffset > prepend_sign + 1) {
                    PyObject *tmp = PySequence_Repeat(padding, uoffset - prepend_sign);
                    Py_DECREF(padding);
                    padding = tmp;
                }
                if (unlikely(!padding)) goto done_or_error;
            }
            if (prepend_sign) {
                sign = PyUnicode_FromOrdinal('-');
                if (unlikely(!sign)) goto done_or_error;
            }
        }
        uval = PyUnicode_DecodeASCII(chars, clength, NULL);
        if (likely(uval) && padding) {
            PyObject *tmp = PyUnicode_Concat(padding, uval);
            Py_DECREF(uval);
            uval = tmp;
        }
        if (likely(uval) && sign) {
            PyObject *tmp = PyUnicode_Concat(sign, uval);
            Py_DECREF(uval);
            uval = tmp;
        }
done_or_error:
        Py_XDECREF(padding);
        Py_XDECREF(sign);
    }
#endif
    return uval;
}

/* COrdinalToPyUnicode (used by CIntToPyUnicode) */
static CYTHON_INLINE int __Pyx_CheckUnicodeValue(int value) {
    return value <= 1114111;
}
static PyObject* __Pyx_PyUnicode_FromOrdinal_Padded(int value, Py_ssize_t ulength, char padding_char) {
    Py_ssize_t padding_length = ulength - 1;
    if (likely((padding_length <= 250) && (value < 0xD800 || value > 0xDFFF))) {
        char chars[256];
        if (value <= 255) {
            memset(chars, padding_char, (size_t) padding_length);
            chars[ulength-1] = (char) value;
            return PyUnicode_DecodeLatin1(chars, ulength, NULL);
        }
        char *cpos = chars + sizeof(chars);
        if (value < 0x800) {
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0xc0 | (value & 0x1f));
        } else if (value < 0x10000) {
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0xe0 | (value & 0x0f));
        } else {
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0xf0 | (value & 0x07));
        }
        cpos -= padding_length;
        memset(cpos, padding_char, (size_t) padding_length);
        return PyUnicode_DecodeUTF8(cpos, chars + sizeof(chars) - cpos, NULL);
    }
    if (value <= 127 && CYTHON_USE_UNICODE_INTERNALS) {
        const char chars[1] = {(char) value};
        return __Pyx_PyUnicode_BuildFromAscii(ulength, chars, 1, 0, padding_char);
    }
    {
        PyObject *uchar, *padding_uchar, *padding, *result;
        padding_uchar = PyUnicode_FromOrdinal(padding_char);
        if (unlikely(!padding_uchar)) return NULL;
        padding = PySequence_Repeat(padding_uchar, padding_length);
        Py_DECREF(padding_uchar);
        if (unlikely(!padding)) return NULL;
        uchar = PyUnicode_FromOrdinal(value);
        if (unlikely(!uchar)) {
            Py_DECREF(padding);
            return NULL;
        }
        result = PyUnicode_Concat(padding, uchar);
        Py_DECREF(padding);
        Py_DECREF(uchar);
        return result;
    }
}

/* CIntToPyUnicode */
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!(is_unsigned || value == 0 || value > 0) ||
                    !(sizeof(value) <= 2 || value & ~ (int) 0x01fffff || __Pyx_CheckUnicodeValue((int) value)))) {
        PyErr_SetString(PyExc_OverflowError, "%c arg not in range(0x110000)");
        return NULL;
    }
    if (width <= 1) {
        return PyUnicode_FromOrdinal((int) value);
    }
    return __Pyx_PyUnicode_FromOrdinal_Padded((int) value, width, padding_char);
}
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char) {
    char digits[sizeof(int)*3+2];
    char *dpos, *end = digits + sizeof(int)*3+2;
    const char *hex_digits = DIGITS_HEX;
    Py_ssize_t length, ulength;
    int prepend_sign, last_one_off;
    int remaining;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (format_char == 'X') {
        hex_digits += 16;
        format_char = 'x';
    }
    remaining = value;
    last_one_off = 0;
    dpos = end;
    do {
        int digit_pos;
        switch (format_char) {
        case 'o':
            digit_pos = abs((int)(remaining % (8*8)));
            remaining = (int) (remaining / (8*8));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 8);
            break;
        case 'd':
            digit_pos = abs((int)(remaining % (10*10)));
            remaining = (int) (remaining / (10*10));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 10);
            break;
        case 'x':
            *(--dpos) = hex_digits[abs((int)(remaining % 16))];
            remaining = (int) (remaining / 16);
            break;
        default:
            assert(0);
            break;
        }
    } while (unlikely(remaining != 0));
    assert(!last_one_off || *dpos == '0');
    dpos += last_one_off;
    length = end - dpos;
    ulength = length;
    prepend_sign = 0;
    if (!is_unsigned && value <= neg_one) {
        if (padding_char == ' ' || width <= length + 1) {
            *(--dpos) = '-';
            ++length;
        } else {
            prepend_sign = 1;
        }
        ++ulength;
    }
    if (width > ulength) {
        ulength = width;
    }
    if (ulength == 1) {
        return PyUnicode_FromOrdinal(*dpos);
    }
    return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
}

/* CIntToPyUnicode */
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!(is_unsigned || value == 0 || value > 0) ||
                    !(sizeof(value) <= 2 || value & ~ (Py_ssize_t) 0x01fffff || __Pyx_CheckUnicodeValue((int) value)))) {
        PyErr_SetString(PyExc_OverflowError, "%c arg not in range(0x110000)");
        return NULL;
    }
    if (width <= 1) {
        return PyUnicode_FromOrdinal((int) value);
    }
    return __Pyx_PyUnicode_FromOrdinal_Padded((int) value, width, padding_char);
}
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char) {
    char digits[sizeof(Py_ssize_t)*3+2];
    char *dpos, *end = digits + sizeof(Py_ssize_t)*3+2;
    const char *hex_digits = DIGITS_HEX;
    Py_ssize_t length, ulength;
    int prepend_sign, last_one_off;
    Py_ssize_t remaining;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (format_char == 'X') {
        hex_digits += 16;
        format_char = 'x';
    }
    remaining = value;
    last_one_off = 0;
    dpos = end;
    do {
        int digit_pos;
        switch (format_char) {
        case 'o':
            digit_pos = abs((int)(remaining % (8*8)));
            remaining = (Py_ssize_t) (remaining / (8*8));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 8);
            break;
        case 'd':
            digit_pos = abs((int)(remaining % (10*10)));
            remaining = (Py_ssize_t) (remaining / (10*10));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 10);
            break;
        case 'x':
            *(--dpos) = hex_digits[abs((int)(remaining % 16))];
            remaining = (Py_ssize_t) (remaining / 16);
            break;
        default:
            assert(0);
            break;
        }
    } while (unlikely(remaining != 0));
    assert(!last_one_off || *dpos == '0');
    dpos += last_one_off;
    length = end - dpos;
    ulength = length;
    prepend_sign = 0;
    if (!is_unsigned && value <= neg_one) {
        if (padding_char == ' ' || width <= length + 1) {
            *(--dpos) = '-';
            ++length;
        } else {
            prepend_sign = 1;
        }
        ++ulength;
    }
    if (width > ulength) {
        ulength = width;
    }
    if (ulength == 1) {
        return PyUnicode_FromOrdinal(*dpos);
    }
    return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
}

/* JoinPyUnicode */
static PyObject* __Pyx_PyUnicode_Join(PyObject** values, Py_ssize_t value_count, Py_ssize_t result_ulength,
                                      Py_UCS4 max_char) {
#if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    PyObject *result_uval;
    int result_ukind, kind_shift;
    Py_ssize_t i, char_pos;
    void *result_udata;
    if (max_char > 1114111) max_char = 1114111;
    result_uval = PyUnicode_New(result_ulength, max_char);
    if (unlikely(!result_uval)) return NULL;
    result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND;
    kind_shift = (result_ukind == PyUnicode_4BYTE_KIND) ? 2 : result_ukind - 1;
    result_udata = PyUnicode_DATA(result_uval);
    assert(kind_shift == 2 || kind_shift == 1 || kind_shift == 0);
    if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - result_ulength < 0))
        goto overflow;
    char_pos = 0;
    for (i=0; i < value_count; i++) {
        int ukind;
        Py_ssize_t ulength;
        void *udata;
        PyObject *uval = values[i];
        #if !CYTHON_COMPILING_IN_LIMITED_API
        if (__Pyx_PyUnicode_READY(uval) == (-1))
            goto bad;
        #endif
        ulength = __Pyx_PyUnicode_GET_LENGTH(uval);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(ulength < 0)) goto bad;
        #endif
        if (unlikely(!ulength))
            continue;
        if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - ulength < char_pos))
            goto overflow;
        ukind = __Pyx_PyUnicode_KIND(uval);
        udata = __Pyx_PyUnicode_DATA(uval);
        if (ukind == result_ukind) {
            memcpy((char *)result_udata + (char_pos << kind_shift), udata, (size_t) (ulength << kind_shift));
        } else {
            #if PY_VERSION_HEX >= 0x030d0000
            if (unlikely(PyUnicode_CopyCharacters(result_uval, char_pos, uval, 0, ulength) < 0)) goto bad;
            #elif CYTHON_COMPILING_IN_CPYTHON || defined(_PyUnicode_FastCopyCharacters)
            _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength);
            #else
            Py_ssize_t j;
            for (j=0; j < ulength; j++) {
                Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j);
                __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar);
            }
            #endif
        }
        char_pos += ulength;
    }
    return result_uval;
overflow:
    PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string");
bad:
    Py_DECREF(result_uval);
    return NULL;
#else
    Py_ssize_t i;
    PyObject *result = NULL;
    PyObject *value_tuple = PyTuple_New(value_count);
    if (unlikely(!value_tuple)) return NULL;
    CYTHON_UNUSED_VAR(max_char);
    CYTHON_UNUSED_VAR(result_ulength);
    for (i=0; i<value_count; i++) {
        Py_INCREF(values[i]);
        if (__Pyx_PyTuple_SET_ITEM(value_tuple, i, values[i]) != (0)) goto bad;
    }
    result = PyUnicode_Join(__pyx_mstate_global->__pyx_empty_unicode, value_tuple);
bad:
    Py_DECREF(value_tuple);
    return result;
#endif
}

/* GetAttr */
static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
#if CYTHON_USE_TYPE_SLOTS
    if (likely(PyUnicode_Check(n)))
        return __Pyx_PyObject_GetAttrStr(o, n);
#endif
    return PyObject_GetAttr(o, n);
}

/* GetItemInt */
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (unlikely(!j)) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck, int unsafe_shared) {
    CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
#if CYTHON_ASSUME_SAFE_SIZE
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyList_GET_SIZE(o);
    }
    if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS)) {
        return __Pyx_PyList_GetItemRefFast(o, wrapped_i, unsafe_shared);
    } else
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
        return __Pyx_NewRef(PyList_GET_ITEM(o, wrapped_i));
    }
    return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
#else
    (void)wraparound;
    (void)boundscheck;
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck, int unsafe_shared) {
    CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
#if CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyTuple_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
        return __Pyx_NewRef(PyTuple_GET_ITEM(o, wrapped_i));
    }
    return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
#else
    (void)wraparound;
    (void)boundscheck;
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
                                                     int wraparound, int boundscheck, int unsafe_shared) {
    CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)) {
            return __Pyx_PyList_GetItemRefFast(o, n, unsafe_shared);
        } else if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
            return __Pyx_NewRef(PyList_GET_ITEM(o, n));
        }
    } else
    #if !CYTHON_AVOID_BORROWED_REFS
    if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
            return __Pyx_NewRef(PyTuple_GET_ITEM(o, n));
        }
    } else
    #endif
#endif
#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY
    {
        PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
        PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
        if (!is_list && mm && mm->mp_subscript) {
            PyObject *r, *key = PyLong_FromSsize_t(i);
            if (unlikely(!key)) return NULL;
            r = mm->mp_subscript(o, key);
            Py_DECREF(key);
            return r;
        }
        if (is_list || likely(sm && sm->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
                Py_ssize_t l = sm->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return NULL;
                    PyErr_Clear();
                }
            }
            return sm->sq_item(o, i);
        }
    }
#else
    if (is_list || !PyMapping_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    (void)wraparound;
    (void)boundscheck;
    return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
}

/* ObjectGetItem */
#if CYTHON_USE_TYPE_SLOTS
static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) {
    PyObject *runerr = NULL;
    Py_ssize_t key_value;
    key_value = __Pyx_PyIndex_AsSsize_t(index);
    if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
        return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1, 1);
    }
    if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
        __Pyx_TypeName index_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(index));
        PyErr_Clear();
        PyErr_Format(PyExc_IndexError,
            "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name);
        __Pyx_DECREF_TypeName(index_type_name);
    }
    return NULL;
}
static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) {
    __Pyx_TypeName obj_type_name;
    if (likely(PyType_Check(obj))) {
        PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_mstate_global->__pyx_n_u_class_getitem);
        if (!meth) {
            PyErr_Clear();
        } else {
            PyObject *result = __Pyx_PyObject_CallOneArg(meth, key);
            Py_DECREF(meth);
            return result;
        }
    }
    obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    PyErr_Format(PyExc_TypeError,
        "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
    return NULL;
}
static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) {
    PyTypeObject *tp = Py_TYPE(obj);
    PyMappingMethods *mm = tp->tp_as_mapping;
    PySequenceMethods *sm = tp->tp_as_sequence;
    if (likely(mm && mm->mp_subscript)) {
        return mm->mp_subscript(obj, key);
    }
    if (likely(sm && sm->sq_item)) {
        return __Pyx_PyObject_GetIndex(obj, key);
    }
    return __Pyx_PyObject_GetItem_Slow(obj, key);
}
#endif

/* RejectKeywords */
static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds) {
    PyObject *key = NULL;
    if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds))) {
        key = __Pyx_PySequence_ITEM(kwds, 0);
    } else {
#if CYTHON_AVOID_BORROWED_REFS
        PyObject *pos = NULL;
#else
        Py_ssize_t pos = 0;
#endif
#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments)
        if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return;
#endif
        __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL);
#if CYTHON_AVOID_BORROWED_REFS
        Py_XDECREF(pos);
#endif
    }
    if (likely(key)) {
        PyErr_Format(PyExc_TypeError,
            "%s() got an unexpected keyword argument '%U'",
            function_name, key);
        Py_DECREF(key);
    }
}

/* DivInt[Py_ssize_t] */
static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b, int b_is_constant) {
    Py_ssize_t q = a / b;
    Py_ssize_t r = a - q*b;
    Py_ssize_t adapt_python = (b_is_constant ?
        ((r != 0) & ((r < 0) ^ (b < 0))) :
        ((r != 0) & ((r ^ b) < 0))
    );
    return q - adapt_python;
}

/* GetAttr3 */
#if __PYX_LIMITED_VERSION_HEX < 0x030d0000
static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        return NULL;
    __Pyx_PyErr_Clear();
    Py_INCREF(d);
    return d;
}
#endif
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
    PyObject *r;
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
    int res = PyObject_GetOptionalAttr(o, n, &r);
    return (res != 0) ? r : __Pyx_NewRef(d);
#else
  #if CYTHON_USE_TYPE_SLOTS
    if (likely(PyUnicode_Check(n))) {
        r = __Pyx_PyObject_GetAttrStrNoError(o, n);
        if (unlikely(!r) && likely(!PyErr_Occurred())) {
            r = __Pyx_NewRef(d);
        }
        return r;
    }
  #endif
    r = PyObject_GetAttr(o, n);
    return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
#endif
}

/* PyDictVersioning (used by GetModuleGlobalName) */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
    PyObject **dictptr = NULL;
    Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
    if (offset) {
#if CYTHON_COMPILING_IN_CPYTHON
        dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
#else
        dictptr = _PyObject_GetDictPtr(obj);
#endif
    }
    return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
}
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
        return 0;
    return obj_dict_version == __Pyx_get_object_dict_version(obj);
}
#endif

/* GetModuleGlobalName */
#if CYTHON_USE_DICT_VERSIONS
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
#else
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
#endif
{
    PyObject *result;
#if CYTHON_COMPILING_IN_LIMITED_API
    if (unlikely(!__pyx_m)) {
        if (!PyErr_Occurred())
            PyErr_SetNone(PyExc_NameError);
        return NULL;
    }
    result = PyObject_GetAttr(__pyx_m, name);
    if (likely(result)) {
        return result;
    }
    PyErr_Clear();
#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
    if (unlikely(__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, name, &result) == -1)) PyErr_Clear();
    __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return result;
    }
#else
    result = _PyDict_GetItem_KnownHash(__pyx_mstate_global->__pyx_d, name, ((PyASCIIObject *) name)->hash);
    __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
    PyErr_Clear();
#endif
    return __Pyx_GetBuiltinName(name);
}

/* RaiseTooManyValuesToUnpack */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

/* RaiseNeedMoreValuesToUnpack */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
                 index, (index == 1) ? "" : "s");
}

/* RaiseNoneIterError */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

/* ExtTypeTest */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    __Pyx_TypeName obj_type_name;
    __Pyx_TypeName type_name;
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(__Pyx_TypeCheck(obj, type)))
        return 1;
    obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    type_name = __Pyx_PyType_GetFullyQualifiedName(type);
    PyErr_Format(PyExc_TypeError,
                 "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME,
                 obj_type_name, type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
    __Pyx_DECREF_TypeName(type_name);
    return 0;
}

/* GetException */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
#endif
{
    PyObject *local_type = NULL, *local_value, *local_tb = NULL;
#if CYTHON_FAST_THREAD_STATE
    PyObject *tmp_type, *tmp_value, *tmp_tb;
  #if PY_VERSION_HEX >= 0x030C0000
    local_value = tstate->current_exception;
    tstate->current_exception = 0;
  #else
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
  #endif
#elif __PYX_LIMITED_VERSION_HEX > 0x030C0000
    local_value = PyErr_GetRaisedException();
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
#if __PYX_LIMITED_VERSION_HEX > 0x030C0000
    if (likely(local_value)) {
        local_type = (PyObject*) Py_TYPE(local_value);
        Py_INCREF(local_type);
        local_tb = PyException_GetTraceback(local_value);
    }
#else
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_FAST_THREAD_STATE
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    if (local_tb) {
        if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
            goto bad;
    }
#endif // __PYX_LIMITED_VERSION_HEX > 0x030C0000
    Py_XINCREF(local_tb);
    Py_XINCREF(local_type);
    Py_XINCREF(local_value);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_FAST_THREAD_STATE
    #if CYTHON_USE_EXC_INFO_STACK
    {
        _PyErr_StackItem *exc_info = tstate->exc_info;
      #if PY_VERSION_HEX >= 0x030B00a4
        tmp_value = exc_info->exc_value;
        exc_info->exc_value = local_value;
        tmp_type = NULL;
        tmp_tb = NULL;
        Py_XDECREF(local_type);
        Py_XDECREF(local_tb);
      #else
        tmp_type = exc_info->exc_type;
        tmp_value = exc_info->exc_value;
        tmp_tb = exc_info->exc_traceback;
        exc_info->exc_type = local_type;
        exc_info->exc_value = local_value;
        exc_info->exc_traceback = local_tb;
      #endif
    }
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#elif __PYX_LIMITED_VERSION_HEX >= 0x030b0000
    PyErr_SetHandledException(local_value);
    Py_XDECREF(local_value);
    Py_XDECREF(local_type);
    Py_XDECREF(local_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
#if __PYX_LIMITED_VERSION_HEX <= 0x030C0000
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
#endif
}

/* SwapException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
  #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_value = exc_info->exc_value;
    exc_info->exc_value = *value;
    if (tmp_value == NULL || tmp_value == Py_None) {
        Py_XDECREF(tmp_value);
        tmp_value = NULL;
        tmp_type = NULL;
        tmp_tb = NULL;
    } else {
        tmp_type = (PyObject*) Py_TYPE(tmp_value);
        Py_INCREF(tmp_type);
        #if CYTHON_COMPILING_IN_CPYTHON
        tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback;
        Py_XINCREF(tmp_tb);
        #else
        tmp_tb = PyException_GetTraceback(tmp_value);
        #endif
    }
  #elif CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = *type;
    exc_info->exc_value = *value;
    exc_info->exc_traceback = *tb;
  #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = *type;
    tstate->exc_value = *value;
    tstate->exc_traceback = *tb;
  #endif
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
    PyErr_SetExcInfo(*type, *value, *tb);
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#endif

/* HasAttr (used by ImportImpl) */
#if __PYX_LIMITED_VERSION_HEX < 0x030d0000
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
    PyObject *r;
    if (unlikely(!PyUnicode_Check(n))) {
        PyErr_SetString(PyExc_TypeError,
                        "hasattr(): attribute name must be string");
        return -1;
    }
    r = __Pyx_PyObject_GetAttrStrNoError(o, n);
    if (!r) {
        return (unlikely(PyErr_Occurred())) ? -1 : 0;
    } else {
        Py_DECREF(r);
        return 1;
    }
}
#endif

/* ImportImpl (used by Import) */
static int __Pyx__Import_GetModule(PyObject *qualname, PyObject **module) {
    PyObject *imported_module = PyImport_GetModule(qualname);
    if (unlikely(!imported_module)) {
        *module = NULL;
        if (PyErr_Occurred()) {
            return -1;
        }
        return 0;
    }
    *module = imported_module;
    return 1;
}
static int __Pyx__Import_Lookup(PyObject *qualname, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject **module) {
    PyObject *imported_module;
    PyObject *top_level_package_name;
    Py_ssize_t i;
    int status, module_found;
    Py_ssize_t dot_index;
    module_found = __Pyx__Import_GetModule(qualname, &imported_module);
    if (unlikely(!module_found || module_found == -1)) {
        *module = NULL;
        return module_found;
    }
    if (imported_names) {
        for (i = 0; i < len_imported_names; i++) {
            PyObject *imported_name = imported_names[i];
#if __PYX_LIMITED_VERSION_HEX < 0x030d0000
            int has_imported_attribute = PyObject_HasAttr(imported_module, imported_name);
#else
            int has_imported_attribute = PyObject_HasAttrWithError(imported_module, imported_name);
            if (unlikely(has_imported_attribute == -1)) goto error;
#endif
            if (!has_imported_attribute) {
                goto not_found;
            }
        }
        *module = imported_module;
        return 1;
    }
    dot_index = PyUnicode_FindChar(qualname, '.', 0, PY_SSIZE_T_MAX, 1);
    if (dot_index == -1) {
        *module = imported_module;
        return 1;
    }
    if (unlikely(dot_index == -2)) goto error;
    top_level_package_name = PyUnicode_Substring(qualname, 0, dot_index);
    if (unlikely(!top_level_package_name)) goto error;
    Py_DECREF(imported_module);
    status = __Pyx__Import_GetModule(top_level_package_name, module);
    Py_DECREF(top_level_package_name);
    return status;
error:
    Py_DECREF(imported_module);
    *module = NULL;
    return -1;
not_found:
    Py_DECREF(imported_module);
    *module = NULL;
    return 0;
}
static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level) {
    PyObject *module = 0;
    PyObject *empty_dict = 0;
    PyObject *from_list = 0;
    int module_found;
    if (!qualname) {
        qualname = name;
    }
    module_found = __Pyx__Import_Lookup(qualname, imported_names, len_imported_names, &module);
    if (likely(module_found == 1)) {
        return module;
    } else if (unlikely(module_found == -1)) {
        return NULL;
    }
    empty_dict = PyDict_New();
    if (unlikely(!empty_dict))
        goto bad;
    if (imported_names) {
#if CYTHON_COMPILING_IN_CPYTHON
        from_list = __Pyx_PyList_FromArray(imported_names, len_imported_names);
        if (unlikely(!from_list))
            goto bad;
#else
        from_list = PyList_New(len_imported_names);
        if (unlikely(!from_list)) goto bad;
        for (Py_ssize_t i=0; i<len_imported_names; ++i) {
            if (PyList_SetItem(from_list, i, __Pyx_NewRef(imported_names[i])) < 0) goto bad;
        }
#endif
    }
    if (level == -1) {
        const char* package_sep = strchr(__Pyx_MODULE_NAME, '.');
        if (package_sep != (0)) {
            module = PyImport_ImportModuleLevelObject(
                name, moddict, empty_dict, from_list, 1);
            if (unlikely(!module)) {
                if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError)))
                    goto bad;
                PyErr_Clear();
            }
        }
        level = 0;
    }
    if (!module) {
        module = PyImport_ImportModuleLevelObject(
            name, moddict, empty_dict, from_list, level);
    }
bad:
    Py_XDECREF(from_list);
    Py_XDECREF(empty_dict);
    return module;
}

/* Import */
static PyObject *__Pyx_Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, int level) {
    return __Pyx__Import(name, imported_names, len_imported_names, qualname, __pyx_mstate_global->__pyx_d, level);
}

/* PySequenceMultiply */
#if CYTHON_USE_TYPE_SLOTS
static PyObject* __Pyx_PySequence_Multiply_Generic(PyObject *seq, Py_ssize_t mul) {
    PyObject *result, *pymul = PyLong_FromSsize_t(mul);
    if (unlikely(!pymul))
        return NULL;
    result = PyNumber_Multiply(seq, pymul);
    Py_DECREF(pymul);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PySequence_Multiply(PyObject *seq, Py_ssize_t mul) {
    PyTypeObject *type = Py_TYPE(seq);
    if (likely(type->tp_as_sequence && type->tp_as_sequence->sq_repeat)) {
        return type->tp_as_sequence->sq_repeat(seq, mul);
    } else {
        return __Pyx_PySequence_Multiply_Generic(seq, mul);
    }
}
#endif

/* PyObjectFormatAndDecref */
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f) {
    if (unlikely(!s)) return NULL;
    if (likely(PyUnicode_CheckExact(s))) return s;
    return __Pyx_PyObject_FormatAndDecref(s, f);
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f) {
    PyObject *result;
    if (unlikely(!s)) return NULL;
    result = PyObject_Format(s, f);
    Py_DECREF(s);
    return result;
}

/* PyObjectFormat */
#if CYTHON_USE_UNICODE_WRITER
static PyObject* __Pyx_PyObject_Format(PyObject* obj, PyObject* format_spec) {
    int ret;
    _PyUnicodeWriter writer;
    if (likely(PyFloat_CheckExact(obj))) {
        _PyUnicodeWriter_Init(&writer);
        ret = _PyFloat_FormatAdvancedWriter(
            &writer,
            obj,
            format_spec, 0, PyUnicode_GET_LENGTH(format_spec));
    } else if (likely(PyLong_CheckExact(obj))) {
        _PyUnicodeWriter_Init(&writer);
        ret = _PyLong_FormatAdvancedWriter(
            &writer,
            obj,
            format_spec, 0, PyUnicode_GET_LENGTH(format_spec));
    } else {
        return PyObject_Format(obj, format_spec);
    }
    if (unlikely(ret == -1)) {
        _PyUnicodeWriter_Dealloc(&writer);
        return NULL;
    }
    return _PyUnicodeWriter_Finish(&writer);
}
#endif

/* SetItemInt */
static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
    int r;
    if (unlikely(!j)) return -1;
    r = PyObject_SetItem(o, j, v);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
                                               int wraparound, int boundscheck, int unsafe_shared) {
    CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE && !CYTHON_AVOID_BORROWED_REFS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
        if ((CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared))) {
            Py_INCREF(v);
            return PyList_SetItem(o, n, v);
        } else if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) {
            PyObject* old;
            Py_INCREF(v);
            old = PyList_GET_ITEM(o, n);
            PyList_SET_ITEM(o, n, v);
            Py_DECREF(old);
            return 0;
        }
    } else
#endif
#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY
    {
        PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
        PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
        if (!is_list && mm && mm->mp_ass_subscript) {
            int r;
            PyObject *key = PyLong_FromSsize_t(i);
            if (unlikely(!key)) return -1;
            r = mm->mp_ass_subscript(o, key, v);
            Py_DECREF(key);
            return r;
        }
        if (is_list || likely(sm && sm->sq_ass_item)) {
            if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
                Py_ssize_t l = sm->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return -1;
                    PyErr_Clear();
                }
            }
            return sm->sq_ass_item(o, i, v);
        }
    }
#else
    if (is_list || !PyMapping_Check(o)) {
        return PySequence_SetItem(o, i, v);
    }
#endif
    (void)wraparound;
    (void)boundscheck;
    return __Pyx_SetItemInt_Generic(o, PyLong_FromSsize_t(i), v);
}

/* RaiseUnboundLocalError */
static void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}

/* DivInt[long] */
static CYTHON_INLINE long __Pyx_div_long(long a, long b, int b_is_constant) {
    long q = a / b;
    long r = a - q*b;
    long adapt_python = (b_is_constant ?
        ((r != 0) & ((r < 0) ^ (b < 0))) :
        ((r != 0) & ((r ^ b) < 0))
    );
    return q - adapt_python;
}

/* PyObjectVectorCallKwBuilder */
#if CYTHON_VECTORCALL
static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
    (void)__Pyx_PyObject_FastCallDict;
    Py_INCREF(key);
    if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1;
    args[n] = value;
    return 0;
}
CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
    (void)__Pyx_VectorcallBuilder_AddArgStr;
    if (unlikely(!PyUnicode_Check(key))) {
        PyErr_SetString(PyExc_TypeError, "keywords must be strings");
        return -1;
    }
    return __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n);
}
static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
    PyObject *pyKey = PyUnicode_FromString(key);
    if (!pyKey) return -1;
    return __Pyx_VectorcallBuilder_AddArg(pyKey, value, builder, args, n);
}
#else // CYTHON_VECTORCALL
CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, CYTHON_UNUSED PyObject **args, CYTHON_UNUSED int n) {
    if (unlikely(!PyUnicode_Check(key))) {
        PyErr_SetString(PyExc_TypeError, "keywords must be strings");
        return -1;
    }
    return PyDict_SetItem(builder, key, value);
}
#endif

/* KeywordStringCheck */
static int __Pyx_CheckKeywordStrings(
    const char* function_name,
    PyObject *kw)
{
#if CYTHON_COMPILING_IN_PYPY && !defined(PyArg_ValidateKeywordArguments)
    CYTHON_UNUSED_VAR(function_name);
    CYTHON_UNUSED_VAR(kw);
    return 0;
#else
    if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kw))) {
#if PY_VERSION_HEX >= 0x03090000
        CYTHON_UNUSED_VAR(function_name);
#else
        Py_ssize_t kwsize;
        #if CYTHON_ASSUME_SAFE_SIZE
        kwsize = PyTuple_GET_SIZE(kw);
        #else
        kwsize = PyTuple_Size(kw);
        if (unlikely(kwsize < 0)) return -1;
        #endif
        for (Py_ssize_t pos = 0; pos < kwsize; pos++) {
            PyObject* key = NULL;
            #if CYTHON_ASSUME_SAFE_MACROS
            key = PyTuple_GET_ITEM(kw, pos);
            #else
            key = PyTuple_GetItem(kw, pos);
            if (unlikely(!key)) return -1;
            #endif
            if (unlikely(!PyUnicode_Check(key))) {
                PyErr_Format(PyExc_TypeError,
                    "%.200s() keywords must be strings", function_name);
                return -1;
            }
        }
#endif
    } else {
        if (unlikely(!PyArg_ValidateKeywordArguments(kw))) return -1;
    }
    return 0;
#endif
}

/* IterFinish (used by dict_iter) */
static CYTHON_INLINE int __Pyx_IterFinish(void) {
    PyObject* exc_type;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    exc_type = __Pyx_PyErr_CurrentExceptionType();
    if (unlikely(exc_type)) {
        if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))
            return -1;
        __Pyx_PyErr_Clear();
        return 0;
    }
    return 0;
}

/* PyObjectCallNoArg (used by PyObjectCallMethod0) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
    PyObject *arg[2] = {NULL, NULL};
    return __Pyx_PyObject_FastCall(func, arg + 1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
}

/* PyObjectGetMethod (used by PyObjectCallMethod0) */
#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
    PyObject *attr;
#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
    __Pyx_TypeName type_name;
    PyTypeObject *tp = Py_TYPE(obj);
    PyObject *descr;
    descrgetfunc f = NULL;
    PyObject **dictptr, *dict;
    int meth_found = 0;
    assert (*method == NULL);
    if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
        attr = __Pyx_PyObject_GetAttrStr(obj, name);
        goto try_unpack;
    }
    if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
        return 0;
    }
    descr = _PyType_Lookup(tp, name);
    if (likely(descr != NULL)) {
        Py_INCREF(descr);
#if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR
        if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR))
#else
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type)))
        #endif
#endif
        {
            meth_found = 1;
        } else {
            f = Py_TYPE(descr)->tp_descr_get;
            if (f != NULL && PyDescr_IsData(descr)) {
                attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
                Py_DECREF(descr);
                goto try_unpack;
            }
        }
    }
    dictptr = _PyObject_GetDictPtr(obj);
    if (dictptr != NULL && (dict = *dictptr) != NULL) {
        Py_INCREF(dict);
        attr = __Pyx_PyDict_GetItemStr(dict, name);
        if (attr != NULL) {
            Py_INCREF(attr);
            Py_DECREF(dict);
            Py_XDECREF(descr);
            goto try_unpack;
        }
        Py_DECREF(dict);
    }
    if (meth_found) {
        *method = descr;
        return 1;
    }
    if (f != NULL) {
        attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
        Py_DECREF(descr);
        goto try_unpack;
    }
    if (likely(descr != NULL)) {
        *method = descr;
        return 0;
    }
    type_name = __Pyx_PyType_GetFullyQualifiedName(tp);
    PyErr_Format(PyExc_AttributeError,
                 "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'",
                 type_name, name);
    __Pyx_DECREF_TypeName(type_name);
    return 0;
#else
    attr = __Pyx_PyObject_GetAttrStr(obj, name);
    goto try_unpack;
#endif
try_unpack:
#if CYTHON_UNPACK_METHODS
    if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
        PyObject *function = PyMethod_GET_FUNCTION(attr);
        Py_INCREF(function);
        Py_DECREF(attr);
        *method = function;
        return 1;
    }
#endif
    *method = attr;
    return 0;
}
#endif

/* PyObjectCallMethod0 (used by dict_iter) */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
#if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
    PyObject *args[1] = {obj};
    (void) __Pyx_PyObject_CallOneArg;
    (void) __Pyx_PyObject_CallNoArg;
    return PyObject_VectorcallMethod(method_name, args, 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
#else
    PyObject *method = NULL, *result = NULL;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_CallOneArg(method, obj);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) goto bad;
    result = __Pyx_PyObject_CallNoArg(method);
    Py_DECREF(method);
bad:
    return result;
#endif
}

/* UnpackItemEndCheck (used by UnpackTuple2) */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    }
    return __Pyx_IterFinish();
}

/* UnpackTupleError (used by UnpackTuple2) */
static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
    if (t == Py_None) {
      __Pyx_RaiseNoneNotIterableError();
    } else {
      Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(t);
 #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely(size < 0)) return;
 #endif
      if (size < index) {
        __Pyx_RaiseNeedMoreValuesError(size);
      } else {
        __Pyx_RaiseTooManyValuesError(index);
      }
    }
}

/* UnpackTuple2 (used by dict_iter) */
static CYTHON_INLINE int __Pyx_unpack_tuple2(
        PyObject* tuple, PyObject** value1, PyObject** value2, int is_tuple, int has_known_size, int decref_tuple) {
    if (likely(is_tuple || PyTuple_Check(tuple))) {
        Py_ssize_t size;
        if (has_known_size) {
            return __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple);
        }
        size = __Pyx_PyTuple_GET_SIZE(tuple);
        if (likely(size == 2)) {
            return __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple);
        }
        if (size >= 0) {
            __Pyx_UnpackTupleError(tuple, 2);
        }
        return -1;
    } else {
        return __Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, decref_tuple);
    }
}
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
        PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) {
    PyObject *value1 = NULL, *value2 = NULL;
#if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS
    value1 = __Pyx_PySequence_ITEM(tuple, 0);  if (unlikely(!value1)) goto bad;
    value2 = __Pyx_PySequence_ITEM(tuple, 1);  if (unlikely(!value2)) goto bad;
#else
    value1 = PyTuple_GET_ITEM(tuple, 0);  Py_INCREF(value1);
    value2 = PyTuple_GET_ITEM(tuple, 1);  Py_INCREF(value2);
#endif
    if (decref_tuple) {
        Py_DECREF(tuple);
    }
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
#if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS
bad:
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
#endif
}
static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
                                       int has_known_size, int decref_tuple) {
    Py_ssize_t index;
    PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
    iternextfunc iternext;
    iter = PyObject_GetIter(tuple);
    if (unlikely(!iter)) goto bad;
    if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
    iternext = __Pyx_PyObject_GetIterNextFunc(iter);
    value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
    value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
    if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
    Py_DECREF(iter);
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
unpacking_failed:
    if (!has_known_size && __Pyx_IterFinish() == 0)
        __Pyx_RaiseNeedMoreValuesError(index);
bad:
    Py_XDECREF(iter);
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
}

/* dict_iter */
#if CYTHON_AVOID_BORROWED_REFS
#include <string.h>
#endif
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_source_is_dict) {
    is_dict = is_dict || likely(PyDict_CheckExact(iterable));
    *p_source_is_dict = is_dict;
    if (is_dict) {
#if !CYTHON_AVOID_BORROWED_REFS
        *p_orig_length = PyDict_Size(iterable);
        Py_INCREF(iterable);
        return iterable;
#else
        static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL;
        PyObject **pp = NULL;
        if (method_name) {
            const char *name = PyUnicode_AsUTF8(method_name);
            if (strcmp(name, "iteritems") == 0) pp = &py_items;
            else if (strcmp(name, "iterkeys") == 0) pp = &py_keys;
            else if (strcmp(name, "itervalues") == 0) pp = &py_values;
            if (pp) {
                if (!*pp) {
                    *pp = PyUnicode_FromString(name + 4);
                    if (!*pp)
                        return NULL;
                }
                method_name = *pp;
            }
        }
#endif
    }
    *p_orig_length = 0;
    if (method_name) {
        PyObject* iter;
        iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
        if (!iterable)
            return NULL;
#if !CYTHON_AVOID_BORROWED_REFS
        if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
            return iterable;
#endif
        iter = PyObject_GetIter(iterable);
        Py_DECREF(iterable);
        return iter;
    }
    return PyObject_GetIter(iterable);
}
#if !CYTHON_AVOID_BORROWED_REFS
static CYTHON_INLINE int __Pyx_dict_iter_next_source_is_dict(
        PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
        PyObject** pkey, PyObject** pvalue, PyObject** pitem) {
    PyObject *key, *value;
    if (unlikely(orig_length != PyDict_Size(iter_obj))) {
        PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
        return -1;
    }
    if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
        return 0;
    }
    if (pitem) {
        PyObject* tuple = PyTuple_New(2);
        if (unlikely(!tuple)) {
            return -1;
        }
        Py_INCREF(key);
        Py_INCREF(value);
        #if CYTHON_ASSUME_SAFE_MACROS
        PyTuple_SET_ITEM(tuple, 0, key);
        PyTuple_SET_ITEM(tuple, 1, value);
        #else
        if (unlikely(PyTuple_SetItem(tuple, 0, key) < 0)) {
            Py_DECREF(value);
            Py_DECREF(tuple);
            return -1;
        }
        if (unlikely(PyTuple_SetItem(tuple, 1, value) < 0)) {
            Py_DECREF(tuple);
            return -1;
        }
        #endif
        *pitem = tuple;
    } else {
        if (pkey) {
            Py_INCREF(key);
            *pkey = key;
        }
        if (pvalue) {
            Py_INCREF(value);
            *pvalue = value;
        }
    }
    return 1;
}
#endif
static CYTHON_INLINE int __Pyx_dict_iter_next(
        PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
        PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
    PyObject* next_item;
#if !CYTHON_AVOID_BORROWED_REFS
    if (source_is_dict) {
        int result;
#if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_BEGIN_CRITICAL_SECTION(iter_obj);
#endif
        result = __Pyx_dict_iter_next_source_is_dict(iter_obj, orig_length, ppos, pkey, pvalue, pitem);
#if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_END_CRITICAL_SECTION();
#endif
        return result;
    } else if (PyTuple_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        Py_ssize_t tuple_size = __Pyx_PyTuple_GET_SIZE(iter_obj);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(tuple_size < 0)) return -1;
        #endif
        if (unlikely(pos >= tuple_size)) return 0;
        *ppos = pos + 1;
        #if CYTHON_ASSUME_SAFE_MACROS
        next_item = PyTuple_GET_ITEM(iter_obj, pos);
        #else
        next_item = PyTuple_GetItem(iter_obj, pos);
        if (unlikely(!next_item)) return -1;
        #endif
        Py_INCREF(next_item);
    } else if (PyList_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        Py_ssize_t list_size = __Pyx_PyList_GET_SIZE(iter_obj);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(list_size < 0)) return -1;
        #endif
        if (unlikely(pos >= list_size)) return 0;
        *ppos = pos + 1;
        next_item = __Pyx_PyList_GetItemRef(iter_obj, pos);
        if (unlikely(!next_item)) return -1;
    } else
#endif
    {
        next_item = PyIter_Next(iter_obj);
        if (unlikely(!next_item)) {
            return __Pyx_IterFinish();
        }
    }
    if (pitem) {
        *pitem = next_item;
    } else if (pkey && pvalue) {
        if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
            return -1;
    } else if (pkey) {
        *pkey = next_item;
    } else {
        *pvalue = next_item;
    }
    return 1;
}

/* PyLongBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_Fallback___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, int inplace) {
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject* __Pyx_Unpacked___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(inplace);
    CYTHON_UNUSED_VAR(zerodivision_check);
    const long b = intval;
    long a;
    const PY_LONG_LONG llb = intval;
    PY_LONG_LONG lla;
    if (unlikely(__Pyx_PyLong_IsZero(op1))) {
        return __Pyx_NewRef(op2);
    }
    const int is_positive = __Pyx_PyLong_IsPos(op1);
    const digit* digits = __Pyx_PyLong_Digits(op1);
    const Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
    if (likely(size == 1)) {
        a = (long) digits[0];
        if (!is_positive) a *= -1;
    } else {
        switch (size) {
            case 2:
                if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                    a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                    lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
            case 3:
                if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                    a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                    lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
            case 4:
                if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                    a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                    lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
        }
        return PyLong_Type.tp_as_number->nb_add(op1, op2);
    }
    calculate_long:
        {
            long x;
            x = a + b;
            return PyLong_FromLong(x);
        }
    calculate_long_long:
        {
            PY_LONG_LONG llx;
            llx = lla + llb;
            return PyLong_FromLongLong(llx);
        }
    
}
#endif
static PyObject* __Pyx_Float___Pyx_PyLong_AddObjC(PyObject *float_val, long intval, int zerodivision_check) {
    CYTHON_UNUSED_VAR(zerodivision_check);
    const long b = intval;
    double a = __Pyx_PyFloat_AS_DOUBLE(float_val);
        double result;
        
        result = ((double)a) + (double)b;
        return PyFloat_FromDouble(result);
}
static CYTHON_INLINE PyObject* __Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_UNUSED_VAR(zerodivision_check);
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        return __Pyx_Unpacked___Pyx_PyLong_AddObjC(op1, op2, intval, inplace, zerodivision_check);
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        return __Pyx_Float___Pyx_PyLong_AddObjC(op1, intval, zerodivision_check);
    }
    return __Pyx_Fallback___Pyx_PyLong_AddObjC(op1, op2, inplace);
}
#endif

/* SliceObject */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
        Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
        int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
    __Pyx_TypeName obj_type_name;
#if CYTHON_USE_TYPE_SLOTS
    PyMappingMethods* mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_subscript))
#endif
    {
        PyObject* result;
        PyObject *py_slice, *py_start, *py_stop;
        if (_py_slice) {
            py_slice = *_py_slice;
        } else {
            PyObject* owned_start = NULL;
            PyObject* owned_stop = NULL;
            if (_py_start) {
                py_start = *_py_start;
            } else {
                if (has_cstart) {
                    owned_start = py_start = PyLong_FromSsize_t(cstart);
                    if (unlikely(!py_start)) goto bad;
                } else
                    py_start = Py_None;
            }
            if (_py_stop) {
                py_stop = *_py_stop;
            } else {
                if (has_cstop) {
                    owned_stop = py_stop = PyLong_FromSsize_t(cstop);
                    if (unlikely(!py_stop)) {
                        Py_XDECREF(owned_start);
                        goto bad;
                    }
                } else
                    py_stop = Py_None;
            }
            py_slice = PySlice_New(py_start, py_stop, Py_None);
            Py_XDECREF(owned_start);
            Py_XDECREF(owned_stop);
            if (unlikely(!py_slice)) goto bad;
        }
#if CYTHON_USE_TYPE_SLOTS
        result = mp->mp_subscript(obj, py_slice);
#else
        result = PyObject_GetItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    PyErr_Format(PyExc_TypeError,
        "'" __Pyx_FMT_TYPENAME "' object is unsliceable", obj_type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
bad:
    return NULL;
}

/* BufferIndexError (used by BufferIndexErrorNogil) */
static void __Pyx_RaiseBufferIndexError(int axis) {
  PyErr_Format(PyExc_IndexError,
     "Out of bounds on buffer access (axis %d)", axis);
}

/* BufferIndexErrorNogil */
static void __Pyx_RaiseBufferIndexErrorNogil(int axis) {
    PyGILState_STATE gilstate = PyGILState_Ensure();
    __Pyx_RaiseBufferIndexError(axis);
    PyGILState_Release(gilstate);
}

/* PyObjectVectorCallMethodKwBuilder */
#if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000
static PyObject *__Pyx_Object_VectorcallMethod_CallFromBuilder(PyObject *name, PyObject *const *args, size_t nargsf, PyObject *kwnames) {
    PyObject *result;
    PyObject *obj = PyObject_GetAttr(args[0], name);
    if (unlikely(!obj))
        return NULL;
    result = __Pyx_Object_Vectorcall_CallFromBuilder(obj, args+1, nargsf-1, kwnames);
    Py_DECREF(obj);
    return result;
}
#endif

/* WriteUnraisableException */
static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename,
                                  int full_traceback, int nogil) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_PyThreadState_declare
    PyGILState_STATE state;
    if (nogil)
        state = PyGILState_Ensure();
    else state = (PyGILState_STATE)0;
    CYTHON_UNUSED_VAR(clineno);
    CYTHON_UNUSED_VAR(lineno);
    CYTHON_UNUSED_VAR(filename);
    CYTHON_MAYBE_UNUSED_VAR(nogil);
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    if (full_traceback) {
        Py_XINCREF(old_exc);
        Py_XINCREF(old_val);
        Py_XINCREF(old_tb);
        __Pyx_ErrRestore(old_exc, old_val, old_tb);
        PyErr_PrintEx(0);
    }
    ctx = PyUnicode_FromString(name);
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
    if (nogil)
        PyGILState_Release(state);
}

/* tp_new */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
static PyObject* __Pyx_tp_new_fallback(PyObject* type_obj, PyObject* args, PyObject* kwargs) {
    PyObject *new_func = NULL, *new_args = NULL, *obj;
    Py_ssize_t i, nargs = PyTuple_Size(args);
    if (unlikely(nargs < 0)) goto bad;
    new_args = PyTuple_New(nargs + 1);
    if (unlikely(!new_args)) goto bad;
    for (i = 0; i < nargs + 1; i++) {
        PyObject *item = (i == 0) ? type_obj : PyTuple_GetItem(args, i - 1);
        if (unlikely(!item)) goto bad;
        Py_INCREF(item);
        if (unlikely(PyTuple_SetItem(new_args, i, item)) < 0) goto bad;
    }
    new_func = PyObject_GetAttrString(type_obj, "__new__");
    if (unlikely(!new_func)) goto bad;
    obj = PyObject_Call(new_func, new_args, kwargs);
    Py_DECREF(new_func);
    Py_DECREF(new_args);
    return obj;
 bad:
    Py_XDECREF(new_func);
    Py_XDECREF(new_args);
    return NULL;
}
#endif
static PyObject* __Pyx_tp_new_kwargs(PyObject* type_obj, PyObject* args, PyObject* kwargs) {
    newfunc tp_new = __Pyx_PyType_TryGetSlot((PyTypeObject*)type_obj, tp_new, newfunc);
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
    if (!tp_new) return __Pyx_tp_new_fallback(type_obj, args, kwargs);
#else
    assert(tp_new != NULL);
#endif
    return tp_new((PyTypeObject*)type_obj, args, kwargs);
}

/* SliceMemoryviewSlice */
static void __pyx_memoryview_slice_memviewslice_err_dim(PyObject *error, const char* msg, int dim) {
    PyGILState_STATE gilstate = PyGILState_Ensure();
    PyErr_Format(error, msg, dim);
    PyGILState_Release(gilstate);
}
static CYTHON_INLINE int __pyx_memoryview_slice_memviewslice(
        __Pyx_memviewslice *dst,
        Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
        int dim, int new_ndim, int *suboffset_dim,
        Py_ssize_t start, Py_ssize_t stop, Py_ssize_t step,
        int have_start, int have_stop, int have_step,
        int is_slice) {
    if (!is_slice) {
        if (start < 0) {
            start += shape;
        }
        if (unlikely(!(0 <= start && start < shape))) {
            __pyx_memoryview_slice_memviewslice_err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim);
            return -1;
        }
    } else {
        int negative_step;
        if (have_step) {
            negative_step = step < 0;
            if (unlikely(step == 0)) {
                __pyx_memoryview_slice_memviewslice_err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim);
                return -1;
            }
        } else {
            negative_step = 0;
            step = 1;
        }
        if (have_start) {
            if (start < 0) {
                start += shape;
                if (start < 0) {
                    start = 0;
                }
            } else if (start >= shape) {
                start = negative_step ? (shape - 1) : shape;
            }
        } else {
            start = negative_step ? (shape - 1) : 0;
        }
        if (have_stop) {
            if (stop < 0) {
                stop += shape;
                if (stop < 0) {
                    stop = 0;
                }
            } else if (stop > shape) {
                stop = shape;
            }
        } else {
            stop = negative_step ? -1 : shape;
        }
        Py_ssize_t new_shape = (stop - start) / step;
        if ((stop - start) - step * new_shape) {
            ++new_shape;
        }
        if (new_shape < 0) {
            new_shape = 0;
        }
        dst->strides[new_ndim] = stride * step;
        dst->shape[new_ndim] = new_shape;
        dst->suboffsets[new_ndim] = suboffset;
    }
    if (suboffset_dim[0] < 0) {
        dst->data += start * stride;
    } else {
        dst->suboffsets[suboffset_dim[0]] += start * stride;
    }
    if (suboffset >= 0) {
        if (!is_slice) {
            if (likely(new_ndim == 0)) {
                dst->data = ((char **)(dst->data))[0] + suboffset;
            } else {
                __pyx_memoryview_slice_memviewslice_err_dim(
                    PyExc_IndexError,
                    "All dimensions preceding dimension %d must be indexed and not sliced",
                    dim);
                return -1;
            }
        } else {
            suboffset_dim[0] = new_ndim;
        }
    }
    return 0;
}

/* ErrOccurredWithGIL */
static CYTHON_INLINE int __Pyx_ErrOccurredWithGIL(void) {
  int err;
  PyGILState_STATE _save = PyGILState_Ensure();
  err = !!PyErr_Occurred();
  PyGILState_Release(_save);
  return err;
}

/* pep479 */
static void __Pyx_Generator_Replace_StopIteration(int in_async_gen) {
    PyObject *exc, *val, *tb, *cur_exc, *new_exc;
    __Pyx_PyThreadState_declare
    int is_async_stopiteration = 0;
    CYTHON_MAYBE_UNUSED_VAR(in_async_gen);
    __Pyx_PyThreadState_assign
    cur_exc = __Pyx_PyErr_CurrentExceptionType();
    if (likely(!__Pyx_PyErr_GivenExceptionMatches(cur_exc, PyExc_StopIteration))) {
        if (in_async_gen && unlikely(__Pyx_PyErr_GivenExceptionMatches(cur_exc, PyExc_StopAsyncIteration))) {
            is_async_stopiteration = 1;
        } else {
            return;
        }
    }
    __Pyx_GetException(&exc, &val, &tb);
    Py_XDECREF(exc);
    Py_XDECREF(tb);
    new_exc = PyObject_CallFunction(PyExc_RuntimeError, "s",
        is_async_stopiteration ? "async generator raised StopAsyncIteration" :
        in_async_gen ? "async generator raised StopIteration" :
        "generator raised StopIteration");
    if (!new_exc) {
        Py_XDECREF(val);
        return;
    }
    PyException_SetCause(new_exc, val); // steals ref to val
    PyErr_SetObject(PyExc_RuntimeError, new_exc);
    Py_DECREF(new_exc);
}

/* PyObjectLookupSpecial */
#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error) {
    PyObject *res;
    PyTypeObject *tp = Py_TYPE(obj);
    res = _PyType_Lookup(tp, attr_name);
    if (likely(res)) {
        descrgetfunc f = Py_TYPE(res)->tp_descr_get;
        if (!f) {
            Py_INCREF(res);
        } else {
            res = f(res, obj, (PyObject *)tp);
        }
    } else if (with_error) {
        PyErr_SetObject(PyExc_AttributeError, attr_name);
    }
    return res;
}
#endif

/* CoroutineSetYieldFrom (used by GeneratorYieldFrom) */
static void
__Pyx_Coroutine_Set_Owned_Yield_From(__pyx_CoroutineObject *gen, PyObject *yf) {
    assert (!gen->yieldfrom);
#if CYTHON_USE_AM_SEND
    assert (!gen->yieldfrom_am_send);
    #if PY_VERSION_HEX < 0x030A00F0
    if (__Pyx_PyType_HasFeature(Py_TYPE(yf), __Pyx_TPFLAGS_HAVE_AM_SEND))
    #endif
    {
        __Pyx_pyiter_sendfunc am_send;
        #if __PYX_LIMITED_VERSION_HEX >= 0x030A0000
        am_send = __Pyx_PyObject_TryGetSubSlot(yf, tp_as_async, am_send, __Pyx_pyiter_sendfunc);
        #else
        __Pyx_PyAsyncMethodsStruct* tp_as_async = (__Pyx_PyAsyncMethodsStruct*) Py_TYPE(yf)->tp_as_async;
        am_send = tp_as_async ? tp_as_async->am_send : NULL;
        #endif
        if (likely(am_send)) {
            gen->yieldfrom_am_send = am_send;
        }
    }
#endif
    gen->yieldfrom = yf;
}

/* dict_setdefault (used by FetchCommonType) */
static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value) {
    PyObject* value;
#if __PYX_LIMITED_VERSION_HEX >= 0x030F0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4)
    PyDict_SetDefaultRef(d, key, default_value, &value);
#elif CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX >= 0x030C0000
    PyObject *args[] = {d, key, default_value};
    value = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_n_u_setdefault, args, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
#elif CYTHON_COMPILING_IN_LIMITED_API
    value = PyObject_CallMethodObjArgs(d, __pyx_mstate_global->__pyx_n_u_setdefault, key, default_value, NULL);
#else
    value = PyDict_SetDefault(d, key, default_value);
    if (unlikely(!value)) return NULL;
    Py_INCREF(value);
#endif
    return value;
}

/* LimitedApiGetTypeDict (used by SetItemOnTypeDict) */
#if CYTHON_COMPILING_IN_LIMITED_API
static Py_ssize_t __Pyx_GetTypeDictOffset(void) {
    PyObject *tp_dictoffset_o;
    Py_ssize_t tp_dictoffset;
    tp_dictoffset_o = PyObject_GetAttrString((PyObject*)(&PyType_Type), "__dictoffset__");
    if (unlikely(!tp_dictoffset_o)) return -1;
    tp_dictoffset = PyLong_AsSsize_t(tp_dictoffset_o);
    Py_DECREF(tp_dictoffset_o);
    if (unlikely(tp_dictoffset == 0)) {
        PyErr_SetString(
            PyExc_TypeError,
            "'type' doesn't have a dictoffset");
        return -1;
    } else if (unlikely(tp_dictoffset < 0)) {
        PyErr_SetString(
            PyExc_TypeError,
            "'type' has an unexpected negative dictoffset. "
            "Please report this as Cython bug");
        return -1;
    }
    return tp_dictoffset;
}
static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp) {
    static Py_ssize_t tp_dictoffset = 0;
    if (unlikely(tp_dictoffset == 0)) {
        tp_dictoffset = __Pyx_GetTypeDictOffset();
        if (unlikely(tp_dictoffset == -1 && PyErr_Occurred())) {
            tp_dictoffset = 0; // try again next time?
            return NULL;
        }
    }
    return *(PyObject**)((char*)tp + tp_dictoffset);
}
#endif

/* SetItemOnTypeDict (used by FixUpExtensionType) */
static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v) {
    int result;
    PyObject *tp_dict;
#if CYTHON_COMPILING_IN_LIMITED_API
    tp_dict = __Pyx_GetTypeDict(tp);
    if (unlikely(!tp_dict)) return -1;
#else
    tp_dict = tp->tp_dict;
#endif
    result = PyDict_SetItem(tp_dict, k, v);
    if (likely(!result)) {
        PyType_Modified(tp);
        if (unlikely(PyObject_HasAttr(v, __pyx_mstate_global->__pyx_n_u_set_name))) {
            PyObject *setNameResult = PyObject_CallMethodObjArgs(v, __pyx_mstate_global->__pyx_n_u_set_name,  (PyObject *) tp, k, NULL);
            if (!setNameResult) return -1;
            Py_DECREF(setNameResult);
        }
    }
    return result;
}

/* FixUpExtensionType (used by FetchCommonType) */
static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) {
#if __PYX_LIMITED_VERSION_HEX > 0x030900B1
    CYTHON_UNUSED_VAR(spec);
    CYTHON_UNUSED_VAR(type);
    CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict);
#else
    const PyType_Slot *slot = spec->slots;
    int changed = 0;
#if !CYTHON_COMPILING_IN_LIMITED_API
    while (slot && slot->slot && slot->slot != Py_tp_members)
        slot++;
    if (slot && slot->slot == Py_tp_members) {
#if !CYTHON_COMPILING_IN_CPYTHON
        const
#endif  // !CYTHON_COMPILING_IN_CPYTHON)
            PyMemberDef *memb = (PyMemberDef*) slot->pfunc;
        while (memb && memb->name) {
            if (memb->name[0] == '_' && memb->name[1] == '_') {
                if (strcmp(memb->name, "__weaklistoffset__") == 0) {
                    assert(memb->type == T_PYSSIZET);
                    assert(memb->flags == READONLY);
                    type->tp_weaklistoffset = memb->offset;
                    changed = 1;
                }
                else if (strcmp(memb->name, "__dictoffset__") == 0) {
                    assert(memb->type == T_PYSSIZET);
                    assert(memb->flags == READONLY);
                    type->tp_dictoffset = memb->offset;
                    changed = 1;
                }
#if CYTHON_METH_FASTCALL
                else if (strcmp(memb->name, "__vectorcalloffset__") == 0) {
                    assert(memb->type == T_PYSSIZET);
                    assert(memb->flags == READONLY);
                    type->tp_vectorcall_offset = memb->offset;
                    changed = 1;
                }
#endif  // CYTHON_METH_FASTCALL
#if !CYTHON_COMPILING_IN_PYPY
                else if (strcmp(memb->name, "__module__") == 0) {
                    PyObject *descr;
                    assert(memb->type == T_OBJECT);
                    assert(memb->flags == 0 || memb->flags == READONLY);
                    descr = PyDescr_NewMember(type, memb);
                    if (unlikely(!descr))
                        return -1;
                    int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr);
                    Py_DECREF(descr);
                    if (unlikely(set_item_result < 0)) {
                        return -1;
                    }
                    changed = 1;
                }
#endif  // !CYTHON_COMPILING_IN_PYPY
            }
            memb++;
        }
    }
#endif  // !CYTHON_COMPILING_IN_LIMITED_API
#if !CYTHON_COMPILING_IN_PYPY
    slot = spec->slots;
    while (slot && slot->slot && slot->slot != Py_tp_getset)
        slot++;
    if (slot && slot->slot == Py_tp_getset) {
        PyGetSetDef *getset = (PyGetSetDef*) slot->pfunc;
        while (getset && getset->name) {
            if (getset->name[0] == '_' && getset->name[1] == '_' && strcmp(getset->name, "__module__") == 0) {
                PyObject *descr = PyDescr_NewGetSet(type, getset);
                if (unlikely(!descr))
                    return -1;
                #if CYTHON_COMPILING_IN_LIMITED_API
                PyObject *pyname = PyUnicode_FromString(getset->name);
                if (unlikely(!pyname)) {
                    Py_DECREF(descr);
                    return -1;
                }
                int set_item_result = __Pyx_SetItemOnTypeDict(type, pyname, descr);
                Py_DECREF(pyname);
                #else
                CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict);
                int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr);
                #endif
                Py_DECREF(descr);
                if (unlikely(set_item_result < 0)) {
                    return -1;
                }
                changed = 1;
            }
            ++getset;
        }
    }
#else
    CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict);
#endif  // !CYTHON_COMPILING_IN_PYPY
    if (changed)
        PyType_Modified(type);
#endif  // PY_VERSION_HEX > 0x030900B1
    return 0;
}

/* AddModuleRef (used by FetchSharedCythonModule) */
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  static PyObject *__Pyx_PyImport_AddModuleObjectRef(PyObject *name) {
      PyObject *module_dict = PyImport_GetModuleDict();
      PyObject *m;
      if (PyMapping_GetOptionalItem(module_dict, name, &m) < 0) {
          return NULL;
      }
      if (m != NULL && PyModule_Check(m)) {
          return m;
      }
      Py_XDECREF(m);
      m = PyModule_NewObject(name);
      if (m == NULL)
          return NULL;
      if (PyDict_CheckExact(module_dict)) {
          PyObject *new_m;
          (void)PyDict_SetDefaultRef(module_dict, name, m, &new_m);
          Py_DECREF(m);
          return new_m;
      } else {
           if (PyObject_SetItem(module_dict, name, m) != 0) {
                Py_DECREF(m);
                return NULL;
            }
            return m;
      }
  }
  static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
      PyObject *py_name = PyUnicode_FromString(name);
      if (!py_name) return NULL;
      PyObject *module = __Pyx_PyImport_AddModuleObjectRef(py_name);
      Py_DECREF(py_name);
      return module;
  }
#elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
#else
  static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
      PyObject *module = PyImport_AddModule(name);
      Py_XINCREF(module);
      return module;
  }
#endif

/* FetchSharedCythonModule (used by FetchCommonType) */
static PyObject *__Pyx_FetchSharedCythonABIModule(void) {
    return __Pyx_PyImport_AddModuleRef(__PYX_ABI_MODULE_NAME);
}

/* FetchCommonType (used by CommonTypesMetaclass) */
#if __PYX_LIMITED_VERSION_HEX < 0x030C0000
static PyObject* __Pyx_PyType_FromMetaclass(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) {
    PyObject *result = __Pyx_PyType_FromModuleAndSpec(module, spec, bases);
    if (result && metaclass) {
        PyObject *old_tp = (PyObject*)Py_TYPE(result);
    Py_INCREF((PyObject*)metaclass);
#if __PYX_LIMITED_VERSION_HEX >= 0x03090000
        Py_SET_TYPE(result, metaclass);
#else
        result->ob_type = metaclass;
#endif
        Py_DECREF(old_tp);
    }
    return result;
}
#else
#define __Pyx_PyType_FromMetaclass(me, mo, s, b) PyType_FromMetaclass(me, mo, s, b)
#endif
static int __Pyx_VerifyCachedType(PyObject *cached_type,
                               const char *name,
                               Py_ssize_t expected_basicsize) {
    Py_ssize_t basicsize;
    if (!PyType_Check(cached_type)) {
        PyErr_Format(PyExc_TypeError,
            "Shared Cython type %.200s is not a type object", name);
        return -1;
    }
    if (expected_basicsize == 0) {
        return 0; // size is inherited, nothing useful to check
    }
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *py_basicsize;
    py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__");
    if (unlikely(!py_basicsize)) return -1;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = NULL;
    if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) return -1;
#else
    basicsize = ((PyTypeObject*) cached_type)->tp_basicsize;
#endif
    if (basicsize != expected_basicsize) {
        PyErr_Format(PyExc_TypeError,
            "Shared Cython type %.200s has the wrong size, try recompiling",
            name);
        return -1;
    }
    return 0;
}
static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) {
    PyObject *abi_module = NULL, *cached_type = NULL, *abi_module_dict, *new_cached_type, *py_object_name;
    int get_item_ref_result;
    const char* object_name = strrchr(spec->name, '.');
    object_name = object_name ? object_name+1 : spec->name;
    py_object_name = PyUnicode_FromString(object_name);
    if (!py_object_name) return NULL;
    abi_module = __Pyx_FetchSharedCythonABIModule();
    if (!abi_module) goto done;
    abi_module_dict = PyModule_GetDict(abi_module);
    if (!abi_module_dict) goto done;
    get_item_ref_result = __Pyx_PyDict_GetItemRef(abi_module_dict, py_object_name, &cached_type);
    if (get_item_ref_result == 1) {
        if (__Pyx_VerifyCachedType(
              cached_type,
              object_name,
              spec->basicsize) < 0) {
            goto bad;
        }
        goto done;
    } else if (unlikely(get_item_ref_result == -1)) {
        goto bad;
    }
    cached_type = __Pyx_PyType_FromMetaclass(
        metaclass,
        CYTHON_USE_MODULE_STATE ? module : abi_module,
        spec, bases);
    if (unlikely(!cached_type)) goto bad;
    if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad;
    new_cached_type = __Pyx_PyDict_SetDefault(abi_module_dict, py_object_name, cached_type);
    if (unlikely(new_cached_type != cached_type)) {
        if (unlikely(!new_cached_type)) goto bad;
        Py_DECREF(cached_type);
        cached_type = new_cached_type;
        if (__Pyx_VerifyCachedType(
                cached_type,
                object_name,
                spec->basicsize) < 0) {
            goto bad;
        }
        goto done;
    } else {
        Py_DECREF(new_cached_type);
    }
done:
    Py_XDECREF(abi_module);
    Py_DECREF(py_object_name);
    assert(cached_type == NULL || PyType_Check(cached_type));
    return (PyTypeObject *) cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}

/* CommonTypesMetaclass (used by CoroutineBase) */
static PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) {
    return PyUnicode_FromString(__PYX_ABI_MODULE_NAME);
}
#if __PYX_LIMITED_VERSION_HEX < 0x030A0000
static PyObject* __pyx_CommonTypesMetaclass_call(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *args, CYTHON_UNUSED PyObject *kwds) {
    PyErr_SetString(PyExc_TypeError, "Cannot instantiate Cython internal types");
    return NULL;
}
static int __pyx_CommonTypesMetaclass_setattr(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *attr, CYTHON_UNUSED PyObject *value) {
    PyErr_SetString(PyExc_TypeError, "Cython internal types are immutable");
    return -1;
}
#endif
static PyGetSetDef __pyx_CommonTypesMetaclass_getset[] = {
    {"__module__", __pyx_CommonTypesMetaclass_get_module, NULL, NULL, NULL},
    {0, 0, 0, 0, 0}
};
static PyType_Slot __pyx_CommonTypesMetaclass_slots[] = {
    {Py_tp_getset, (void *)__pyx_CommonTypesMetaclass_getset},
    #if __PYX_LIMITED_VERSION_HEX < 0x030A0000
    {Py_tp_call, (void*)__pyx_CommonTypesMetaclass_call},
    {Py_tp_new, (void*)__pyx_CommonTypesMetaclass_call},
    {Py_tp_setattro, (void*)__pyx_CommonTypesMetaclass_setattr},
    #endif
    {0, 0}
};
static PyType_Spec __pyx_CommonTypesMetaclass_spec = {
    __PYX_TYPE_MODULE_PREFIX "_common_types_metatype",
    0,
    0,
    Py_TPFLAGS_IMMUTABLETYPE |
    Py_TPFLAGS_DISALLOW_INSTANTIATION |
    Py_TPFLAGS_DEFAULT,
    __pyx_CommonTypesMetaclass_slots
};
static int __pyx_CommonTypesMetaclass_init(PyObject *module) {
    __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module);
    PyObject *bases = PyTuple_Pack(1, &PyType_Type);
    if (unlikely(!bases)) {
        return -1;
    }
    mstate->__pyx_CommonTypesMetaclassType = __Pyx_FetchCommonTypeFromSpec(NULL, module, &__pyx_CommonTypesMetaclass_spec, bases);
    Py_DECREF(bases);
    if (unlikely(mstate->__pyx_CommonTypesMetaclassType == NULL)) {
        return -1;
    }
    return 0;
}

/* CallTypeTraverse (used by CoroutineBase) */
#if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000)
#else
static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg) {
    #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x03090000
    if (__Pyx_get_runtime_version() < 0x03090000) return 0;
    #endif
    if (!always_call) {
        PyTypeObject *base = __Pyx_PyObject_GetSlot(o, tp_base, PyTypeObject*);
        unsigned long flags = PyType_GetFlags(base);
        if (flags & Py_TPFLAGS_HEAPTYPE) {
            return 0;
        }
    }
    Py_VISIT((PyObject*)Py_TYPE(o));
    return 0;
}
#endif

/* IterNextPlain (used by CoroutineBase) */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void) {
    if (unlikely(!__pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache))
        __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache = __Pyx_GetBuiltinName(__pyx_mstate_global->__pyx_n_u_next);
    return __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache;
}
#endif
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator) {
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
    PyObject *result;
    PyObject *next = __Pyx_GetBuiltinNext_LimitedAPI();
    if (unlikely(!next)) return NULL;
    result = PyObject_CallFunctionObjArgs(next, iterator, NULL);
    return result;
#else
    (void)__Pyx_GetBuiltinName; // only for early limited API
    iternextfunc iternext = __Pyx_PyObject_GetIterNextFunc(iterator);
    assert(iternext);
    return iternext(iterator);
#endif
}

/* PyObjectCall2Args (used by PyObjectCallMethod1) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
    PyObject *args[3] = {NULL, arg1, arg2};
    return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
}

/* PyObjectCallMethod1 (used by CoroutineBase) */
#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
    PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
    Py_DECREF(method);
    return result;
}
#endif
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
#if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
    PyObject *args[2] = {obj, arg};
    (void) __Pyx_PyObject_CallOneArg;
    (void) __Pyx_PyObject_Call2Args;
    return PyObject_VectorcallMethod(method_name, args, 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
#else
    PyObject *method = NULL, *result;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_Call2Args(method, obj, arg);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) return NULL;
    return __Pyx__PyObject_CallMethod1(method, arg);
#endif
}

/* ReturnWithStopIteration (used by CoroutineBase) */
static void __Pyx__ReturnWithStopIteration(PyObject* value, int async);
static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext) {
    if (value == Py_None) {
        if (async || !iternext)
            PyErr_SetNone(async ? PyExc_StopAsyncIteration : PyExc_StopIteration);
        return;
    }
    __Pyx__ReturnWithStopIteration(value, async);
}
static void __Pyx__ReturnWithStopIteration(PyObject* value, int async) {
#if CYTHON_COMPILING_IN_CPYTHON
    __Pyx_PyThreadState_declare
#endif
    PyObject *exc;
    PyObject *exc_type = async ? PyExc_StopAsyncIteration : PyExc_StopIteration;
#if CYTHON_COMPILING_IN_CPYTHON
    if ((PY_VERSION_HEX >= (0x030C00A6)) || unlikely(PyTuple_Check(value) || PyExceptionInstance_Check(value))) {
        if (PY_VERSION_HEX >= (0x030e00A1)) {
            exc = __Pyx_PyObject_CallOneArg(exc_type, value);
        } else {
            PyObject *args_tuple = PyTuple_New(1);
            if (unlikely(!args_tuple)) return;
            Py_INCREF(value);
            PyTuple_SET_ITEM(args_tuple, 0, value);
            exc = PyObject_Call(exc_type, args_tuple, NULL);
            Py_DECREF(args_tuple);
        }
        if (unlikely(!exc)) return;
    } else {
        Py_INCREF(value);
        exc = value;
    }
    #if CYTHON_FAST_THREAD_STATE
    __Pyx_PyThreadState_assign
    #if CYTHON_USE_EXC_INFO_STACK
    if (!__pyx_tstate->exc_info->exc_value)
    #else
    if (!__pyx_tstate->exc_type)
    #endif
    {
        Py_INCREF(exc_type);
        __Pyx_ErrRestore(exc_type, exc, NULL);
        return;
    }
    #endif
#else
    exc = __Pyx_PyObject_CallOneArg(exc_type, value);
    if (unlikely(!exc)) return;
#endif
    PyErr_SetObject(exc_type, exc);
    Py_DECREF(exc);
}

/* CoroutineBase (used by Generator) */
#if !CYTHON_COMPILING_IN_LIMITED_API
#include <frameobject.h>
#if PY_VERSION_HEX >= 0x030b00a6 && !defined(PYPY_VERSION)
  #ifndef Py_BUILD_CORE
    #define Py_BUILD_CORE 1
  #endif
  #include "internal/pycore_frame.h"
#endif
#endif // CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE void
__Pyx_Coroutine_Undelegate(__pyx_CoroutineObject *gen) {
#if CYTHON_USE_AM_SEND
    gen->yieldfrom_am_send = NULL;
#endif
    Py_CLEAR(gen->yieldfrom);
}
static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *__pyx_tstate, PyObject **pvalue) {
    PyObject *et, *ev, *tb;
    PyObject *value = NULL;
    CYTHON_UNUSED_VAR(__pyx_tstate);
    __Pyx_ErrFetch(&et, &ev, &tb);
    if (!et) {
        Py_XDECREF(tb);
        Py_XDECREF(ev);
        Py_INCREF(Py_None);
        *pvalue = Py_None;
        return 0;
    }
    if (likely(et == PyExc_StopIteration)) {
        if (!ev) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
        else if (likely(__Pyx_IS_TYPE(ev, (PyTypeObject*)PyExc_StopIteration))) {
            #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL
            value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value);
            if (unlikely(!value)) goto limited_api_failure;
            #else
            value = ((PyStopIterationObject *)ev)->value;
            Py_INCREF(value);
            #endif
            Py_DECREF(ev);
        }
        else if (unlikely(PyTuple_Check(ev))) {
            Py_ssize_t tuple_size = __Pyx_PyTuple_GET_SIZE(ev);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely(tuple_size < 0)) {
                Py_XDECREF(tb);
                Py_DECREF(ev);
                Py_DECREF(et);
                return -1;
            }
            #endif
            if (tuple_size >= 1) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                value = PyTuple_GET_ITEM(ev, 0);
                Py_INCREF(value);
#elif CYTHON_ASSUME_SAFE_MACROS
                value = PySequence_ITEM(ev, 0);
#else
                value = PySequence_GetItem(ev, 0);
                if (!value) goto limited_api_failure;
#endif
            } else {
                Py_INCREF(Py_None);
                value = Py_None;
            }
            Py_DECREF(ev);
        }
        else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
            value = ev;
        }
        if (likely(value)) {
            Py_XDECREF(tb);
            Py_DECREF(et);
            *pvalue = value;
            return 0;
        }
    } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    PyErr_NormalizeException(&et, &ev, &tb);
    if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    Py_XDECREF(tb);
    Py_DECREF(et);
#if CYTHON_COMPILING_IN_LIMITED_API
    value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value);
#else
    value = ((PyStopIterationObject *)ev)->value;
    Py_INCREF(value);
#endif
    Py_DECREF(ev);
#if CYTHON_COMPILING_IN_LIMITED_API
    if (unlikely(!value)) return -1;
#endif
    *pvalue = value;
    return 0;
#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL || !CYTHON_ASSUME_SAFE_MACROS
  limited_api_failure:
    Py_XDECREF(et);
    Py_XDECREF(tb);
    Py_XDECREF(ev);
    return -1;
#endif
}
static CYTHON_INLINE
__Pyx_PySendResult __Pyx_Coroutine_status_from_result(PyObject **retval) {
    if (*retval) {
        return PYGEN_NEXT;
    } else if (likely(__Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, retval) == 0)) {
        return PYGEN_RETURN;
    } else {
        return PYGEN_ERROR;
    }
}
static CYTHON_INLINE
void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) {
#if PY_VERSION_HEX >= 0x030B00a4
    Py_CLEAR(exc_state->exc_value);
#else
    PyObject *t, *v, *tb;
    t = exc_state->exc_type;
    v = exc_state->exc_value;
    tb = exc_state->exc_traceback;
    exc_state->exc_type = NULL;
    exc_state->exc_value = NULL;
    exc_state->exc_traceback = NULL;
    Py_XDECREF(t);
    Py_XDECREF(v);
    Py_XDECREF(tb);
#endif
}
#define __Pyx_Coroutine_AlreadyRunningError(gen)  (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL)
static void __Pyx__Coroutine_AlreadyRunningError(__pyx_CoroutineObject *gen) {
    const char *msg;
    CYTHON_MAYBE_UNUSED_VAR(gen);
    if ((0)) {
    #ifdef __Pyx_Coroutine_USED
    } else if (__Pyx_Coroutine_Check((PyObject*)gen)) {
        msg = "coroutine already executing";
    #endif
    #ifdef __Pyx_AsyncGen_USED
    } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) {
        msg = "async generator already executing";
    #endif
    } else {
        msg = "generator already executing";
    }
    PyErr_SetString(PyExc_ValueError, msg);
}
static void __Pyx_Coroutine_AlreadyTerminatedError(PyObject *gen, PyObject *value, int closing) {
    CYTHON_MAYBE_UNUSED_VAR(gen);
    CYTHON_MAYBE_UNUSED_VAR(closing);
    #ifdef __Pyx_Coroutine_USED
    if (!closing && __Pyx_Coroutine_Check(gen)) {
        PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine");
    } else
    #endif
    if (value) {
        #ifdef __Pyx_AsyncGen_USED
        if (__Pyx_AsyncGen_CheckExact(gen))
            PyErr_SetNone(PyExc_StopAsyncIteration);
        else
        #endif
        PyErr_SetNone(PyExc_StopIteration);
    }
}
static
__Pyx_PySendResult __Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, PyObject **result, int closing) {
    __Pyx_PyThreadState_declare
    PyThreadState *tstate;
    __Pyx_ExcInfoStruct *exc_state;
    PyObject *retval;
    assert(__Pyx_Coroutine_get_is_running(self));  // Callers should ensure is_running
    if (unlikely(self->resume_label == -1)) {
        __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
        return PYGEN_ERROR;
    }
#if CYTHON_FAST_THREAD_STATE
    __Pyx_PyThreadState_assign
    tstate = __pyx_tstate;
#else
    tstate = __Pyx_PyThreadState_Current;
#endif
    exc_state = &self->gi_exc_state;
    if (exc_state->exc_value) {
        #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
        #else
        PyObject *exc_tb;
        #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON
        exc_tb = PyException_GetTraceback(exc_state->exc_value);
        #elif PY_VERSION_HEX >= 0x030B00a4
        exc_tb = ((PyBaseExceptionObject*) exc_state->exc_value)->traceback;
        #else
        exc_tb = exc_state->exc_traceback;
        #endif
        if (exc_tb) {
            PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
            PyFrameObject *f = tb->tb_frame;
            assert(f->f_back == NULL);
            #if PY_VERSION_HEX >= 0x030B00A1
            f->f_back = PyThreadState_GetFrame(tstate);
            #else
            Py_XINCREF(tstate->frame);
            f->f_back = tstate->frame;
            #endif
            #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON
            Py_DECREF(exc_tb);
            #endif
        }
        #endif
    }
#if CYTHON_USE_EXC_INFO_STACK
    exc_state->previous_item = tstate->exc_info;
    tstate->exc_info = exc_state;
#else
    if (exc_state->exc_type) {
        __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
    } else {
        __Pyx_Coroutine_ExceptionClear(exc_state);
        __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
    }
#endif
    retval = self->body(self, tstate, value);
#if CYTHON_USE_EXC_INFO_STACK
    exc_state = &self->gi_exc_state;
    tstate->exc_info = exc_state->previous_item;
    exc_state->previous_item = NULL;
    __Pyx_Coroutine_ResetFrameBackpointer(exc_state);
#endif
    *result = retval;
    if (self->resume_label == -1) {
        return likely(retval) ? PYGEN_RETURN : PYGEN_ERROR;
    }
    return PYGEN_NEXT;
}
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
    CYTHON_UNUSED_VAR(exc_state);
#else
    PyObject *exc_tb;
    #if PY_VERSION_HEX >= 0x030B00a4
    if (!exc_state->exc_value) return;
    exc_tb = PyException_GetTraceback(exc_state->exc_value);
    #else
    exc_tb = exc_state->exc_traceback;
    #endif
    if (likely(exc_tb)) {
        PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
        PyFrameObject *f = tb->tb_frame;
        Py_CLEAR(f->f_back);
        #if PY_VERSION_HEX >= 0x030B00a4
        Py_DECREF(exc_tb);
        #endif
    }
#endif
}
#define __Pyx_Coroutine_MethodReturnFromResult(gen, result, retval, iternext)\
    ((result) == PYGEN_NEXT ? (retval) : __Pyx__Coroutine_MethodReturnFromResult(gen, result, retval, iternext))
static PyObject *
__Pyx__Coroutine_MethodReturnFromResult(PyObject* gen, __Pyx_PySendResult result, PyObject *retval, int iternext) {
    CYTHON_MAYBE_UNUSED_VAR(gen);
    if (likely(result == PYGEN_RETURN)) {
        int is_async = 0;
        #ifdef __Pyx_AsyncGen_USED
        is_async = __Pyx_AsyncGen_CheckExact(gen);
        #endif
        __Pyx_ReturnWithStopIteration(retval, is_async, iternext);
        Py_XDECREF(retval);
    }
    return NULL;
}
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE
PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) {
#if PY_VERSION_HEX <= 0x030A00A1
    return _PyGen_Send(gen, arg);
#else
    PyObject *result;
    if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) {
        if (PyAsyncGen_CheckExact(gen)) {
            assert(result == Py_None);
            PyErr_SetNone(PyExc_StopAsyncIteration);
        }
        else if (result == Py_None) {
            PyErr_SetNone(PyExc_StopIteration);
        }
        else {
#if PY_VERSION_HEX < 0x030d00A1
            _PyGen_SetStopIterationValue(result);
#else
            if (!PyTuple_Check(result) && !PyExceptionInstance_Check(result)) {
                PyErr_SetObject(PyExc_StopIteration, result);
            } else {
                PyObject *exc = __Pyx_PyObject_CallOneArg(PyExc_StopIteration, result);
                if (likely(exc != NULL)) {
                    PyErr_SetObject(PyExc_StopIteration, exc);
                    Py_DECREF(exc);
                }
            }
#endif
        }
        Py_DECREF(result);
        result = NULL;
    }
    return result;
#endif
}
#endif
static CYTHON_INLINE __Pyx_PySendResult
__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen, PyObject** retval) {
    __Pyx_PySendResult result;
    PyObject *val = NULL;
    assert(__Pyx_Coroutine_get_is_running(gen));
    __Pyx_Coroutine_Undelegate(gen);
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val);
    result = __Pyx_Coroutine_SendEx(gen, val, retval, 0);
    Py_XDECREF(val);
    return result;
}
#if CYTHON_USE_AM_SEND
static __Pyx_PySendResult
__Pyx_Coroutine_SendToDelegate(__pyx_CoroutineObject *gen, __Pyx_pyiter_sendfunc gen_am_send, PyObject *value, PyObject **retval) {
    PyObject *ret = NULL;
    __Pyx_PySendResult delegate_result, result;
    assert(__Pyx_Coroutine_get_is_running(gen));
    delegate_result = gen_am_send(gen->yieldfrom, value, &ret);
    if (delegate_result == PYGEN_NEXT) {
        assert (ret != NULL);
        *retval = ret;
        return PYGEN_NEXT;
    }
    assert (delegate_result != PYGEN_ERROR || ret == NULL);
    __Pyx_Coroutine_Undelegate(gen);
    result = __Pyx_Coroutine_SendEx(gen, ret, retval, 0);
    Py_XDECREF(ret);
    return result;
}
#endif
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
    PyObject *retval = NULL;
    __Pyx_PySendResult result = __Pyx_Coroutine_AmSend(self, value, &retval);
    return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0);
}
static __Pyx_PySendResult
__Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval) {
    __Pyx_PySendResult result;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
        *retval = __Pyx_Coroutine_AlreadyRunningError(gen);
        return PYGEN_ERROR;
    }
    #if CYTHON_USE_AM_SEND
    if (gen->yieldfrom_am_send) {
        result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, value, retval);
    } else
    #endif
    if (gen->yieldfrom) {
        PyObject *yf = gen->yieldfrom;
        PyObject *ret;
      #if !CYTHON_USE_AM_SEND
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_Check(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_AsyncGen_USED
        if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
            ret = __Pyx_async_gen_asend_send(yf, value);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON
        if (PyGen_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        if (PyCoro_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        #endif
      #endif
        {
            #if !CYTHON_COMPILING_IN_LIMITED_API || __PYX_LIMITED_VERSION_HEX >= 0x03080000
            if (value == Py_None && PyIter_Check(yf))
                ret = __Pyx_PyIter_Next_Plain(yf);
            else
            #endif
                ret = __Pyx_PyObject_CallMethod1(yf, __pyx_mstate_global->__pyx_n_u_send, value);
        }
        if (likely(ret)) {
            __Pyx_Coroutine_unset_is_running(gen);
            *retval = ret;
            return PYGEN_NEXT;
        }
        result = __Pyx_Coroutine_FinishDelegation(gen, retval);
    } else {
        result = __Pyx_Coroutine_SendEx(gen, value, retval, 0);
    }
    __Pyx_Coroutine_unset_is_running(gen);
    return result;
}
static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
    __Pyx_PySendResult result;
    PyObject *retval = NULL;
    CYTHON_UNUSED_VAR(gen);
    assert(__Pyx_Coroutine_get_is_running(gen));
    #ifdef __Pyx_Generator_USED
    if (__Pyx_Generator_CheckExact(yf)) {
        result = __Pyx_Coroutine_Close(yf, &retval);
    } else
    #endif
    #ifdef __Pyx_Coroutine_USED
    if (__Pyx_Coroutine_Check(yf)) {
        result = __Pyx_Coroutine_Close(yf, &retval);
    } else
    if (__Pyx_CoroutineAwait_CheckExact(yf)) {
        result = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf);
    } else
    #endif
    #ifdef __Pyx_AsyncGen_USED
    if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
        retval = __Pyx_async_gen_asend_close(yf, NULL);
        result = PYGEN_RETURN;
    } else
    if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
        retval = __Pyx_async_gen_athrow_close(yf, NULL);
        result = PYGEN_RETURN;
    } else
    #endif
    {
        PyObject *meth;
        result = PYGEN_RETURN;
        meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_close);
        if (unlikely(!meth)) {
            if (unlikely(PyErr_Occurred())) {
                PyErr_WriteUnraisable(yf);
            }
        } else {
            retval = __Pyx_PyObject_CallNoArg(meth);
            Py_DECREF(meth);
            if (unlikely(!retval)) {
                result = PYGEN_ERROR;
            }
        }
    }
    Py_XDECREF(retval);
    return result == PYGEN_ERROR ? -1 : 0;
}
static PyObject *__Pyx_Generator_Next(PyObject *self) {
    __Pyx_PySendResult result;
    PyObject *retval = NULL;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    }
    #if CYTHON_USE_AM_SEND
    if (gen->yieldfrom_am_send) {
        result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, Py_None, &retval);
    } else
    #endif
    if (gen->yieldfrom) {
        PyObject *yf = gen->yieldfrom;
        PyObject *ret;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Generator_Next(yf);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Send(yf, Py_None);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && (PY_VERSION_HEX < 0x030A00A3 || !CYTHON_USE_AM_SEND)
        if (PyGen_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL);
        } else
        #endif
            ret = __Pyx_PyIter_Next_Plain(yf);
        if (likely(ret)) {
            __Pyx_Coroutine_unset_is_running(gen);
            return ret;
        }
        result = __Pyx_Coroutine_FinishDelegation(gen, &retval);
    } else {
        result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0);
    }
    __Pyx_Coroutine_unset_is_running(gen);
    return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 1);
}
static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, PyObject *arg) {
    PyObject *retval = NULL;
    __Pyx_PySendResult result;
    CYTHON_UNUSED_VAR(arg);
    result = __Pyx_Coroutine_Close(self, &retval);
    if (unlikely(result == PYGEN_ERROR))
        return NULL;
    Py_XDECREF(retval);
    Py_RETURN_NONE;
}
static __Pyx_PySendResult
__Pyx_Coroutine_Close(PyObject *self, PyObject **retval) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    __Pyx_PySendResult result;
    PyObject *yf;
    int err = 0;
    if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
        *retval = __Pyx_Coroutine_AlreadyRunningError(gen);
        return PYGEN_ERROR;
    }
    yf = gen->yieldfrom;
    if (yf) {
        Py_INCREF(yf);
        err = __Pyx_Coroutine_CloseIter(gen, yf);
        __Pyx_Coroutine_Undelegate(gen);
        Py_DECREF(yf);
    }
    if (err == 0)
        PyErr_SetNone(PyExc_GeneratorExit);
    result = __Pyx_Coroutine_SendEx(gen, NULL, retval, 1);
    if (result == PYGEN_ERROR) {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_Coroutine_unset_is_running(gen);
        if (!__Pyx_PyErr_Occurred()) {
            return PYGEN_RETURN;
        } else if (likely(__Pyx_PyErr_ExceptionMatches2(PyExc_GeneratorExit, PyExc_StopIteration))) {
            __Pyx_PyErr_Clear();
            return PYGEN_RETURN;
        }
        return PYGEN_ERROR;
    } else if (likely(result == PYGEN_RETURN && *retval == Py_None)) {
        __Pyx_Coroutine_unset_is_running(gen);
        return PYGEN_RETURN;
    } else {
        const char *msg;
        Py_DECREF(*retval);
        *retval = NULL;
        if ((0)) {
        #ifdef __Pyx_Coroutine_USED
        } else if (__Pyx_Coroutine_Check(self)) {
            msg = "coroutine ignored GeneratorExit";
        #endif
        #ifdef __Pyx_AsyncGen_USED
        } else if (__Pyx_AsyncGen_CheckExact(self)) {
            msg = "async generator ignored GeneratorExit";
        #endif
        } else {
            msg = "generator ignored GeneratorExit";
        }
        PyErr_SetString(PyExc_RuntimeError, msg);
        __Pyx_Coroutine_unset_is_running(gen);
        return PYGEN_ERROR;
    }
}
static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb,
                                        PyObject *args, int close_on_genexit) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *yf;
    if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen)))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    yf = gen->yieldfrom;
    if (yf) {
        __Pyx_PySendResult result;
        PyObject *ret;
        Py_INCREF(yf);
        if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) {
            int err = __Pyx_Coroutine_CloseIter(gen, yf);
            Py_DECREF(yf);
            __Pyx_Coroutine_Undelegate(gen);
            if (err < 0)
                goto propagate_exception;
            goto throw_here;
        }
        if (0
        #ifdef __Pyx_Generator_USED
            || __Pyx_Generator_CheckExact(yf)
        #endif
        #ifdef __Pyx_Coroutine_USED
            || __Pyx_Coroutine_Check(yf)
        #endif
            ) {
            ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit);
        #ifdef __Pyx_Coroutine_USED
        } else if (__Pyx_CoroutineAwait_CheckExact(yf)) {
            ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit);
        #endif
        } else {
            PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_throw);
            if (unlikely(!meth)) {
                Py_DECREF(yf);
                if (unlikely(PyErr_Occurred())) {
                    __Pyx_Coroutine_unset_is_running(gen);
                    return NULL;
                }
                __Pyx_Coroutine_Undelegate(gen);
                goto throw_here;
            }
            if (likely(args)) {
                ret = __Pyx_PyObject_Call(meth, args, NULL);
            } else {
                PyObject *cargs[4] = {NULL, typ, val, tb};
                size_t nargs = 1U + (val != NULL) + (tb != NULL);
                ret = __Pyx_PyObject_FastCall(meth, cargs+1, nargs | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
            }
            Py_DECREF(meth);
        }
        Py_DECREF(yf);
        if (ret) {
            __Pyx_Coroutine_unset_is_running(gen);
            return ret;
        }
        result = __Pyx_Coroutine_FinishDelegation(gen, &ret);
        __Pyx_Coroutine_unset_is_running(gen);
        return __Pyx_Coroutine_MethodReturnFromResult(self, result, ret, 0);
    }
throw_here:
    __Pyx_Raise(typ, val, tb, NULL);
propagate_exception:
    {
        PyObject *retval = NULL;
        __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, NULL, &retval, 0);
        __Pyx_Coroutine_unset_is_running(gen);
        return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0);
    }
}
static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
    PyObject *typ;
    PyObject *val = NULL;
    PyObject *tb = NULL;
    if (unlikely(!PyArg_UnpackTuple(args, "throw", 1, 3, &typ, &val, &tb)))
        return NULL;
    return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1);
}
static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) {
#if PY_VERSION_HEX >= 0x030B00a4
    Py_VISIT(exc_state->exc_value);
#else
    Py_VISIT(exc_state->exc_type);
    Py_VISIT(exc_state->exc_value);
    Py_VISIT(exc_state->exc_traceback);
#endif
    return 0;
}
static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) {
    {
        int e = __Pyx_call_type_traverse((PyObject*)gen, 1, visit, arg);
        if (e) return e;
    }
    Py_VISIT(gen->closure);
    Py_VISIT(gen->classobj);
    Py_VISIT(gen->yieldfrom);
    return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg);
}
static int __Pyx_Coroutine_clear(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    Py_CLEAR(gen->closure);
    Py_CLEAR(gen->classobj);
    __Pyx_Coroutine_Undelegate(gen);
    __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state);
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer);
    }
#endif
    Py_CLEAR(gen->gi_code);
    Py_CLEAR(gen->gi_frame);
    Py_CLEAR(gen->gi_name);
    Py_CLEAR(gen->gi_qualname);
    Py_CLEAR(gen->gi_modulename);
    return 0;
}
static void __Pyx_Coroutine_dealloc(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject_GC_UnTrack(gen);
    #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    if (gen->gi_weakreflist != NULL)
    #endif
        PyObject_ClearWeakRefs(self);
    if (gen->resume_label >= 0) {
        PyObject_GC_Track(self);
#if CYTHON_USE_TP_FINALIZE
        if (unlikely(PyObject_CallFinalizerFromDealloc(self)))
#else
        {
            destructor del = __Pyx_PyObject_GetSlot(gen, tp_del, destructor);
            if (del) del(self);
        }
        if (unlikely(Py_REFCNT(self) > 0))
#endif
        {
            return;
        }
        PyObject_GC_UnTrack(self);
    }
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        /* We have to handle this case for asynchronous generators
           right here, because this code has to be between UNTRACK
           and GC_Del. */
        Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer);
    }
#endif
    __Pyx_Coroutine_clear(self);
    __Pyx_PyHeapTypeObject_GC_Del(gen);
}
#if CYTHON_USE_TP_FINALIZE
static void __Pyx_Coroutine_del(PyObject *self) {
    PyObject *error_type, *error_value, *error_traceback;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    __Pyx_PyThreadState_declare
    if (gen->resume_label < 0) {
        return;
    }
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self;
        PyObject *finalizer = agen->ag_finalizer;
        if (finalizer && !agen->ag_closed) {
            PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self);
            if (unlikely(!res)) {
                PyErr_WriteUnraisable(self);
            } else {
                Py_DECREF(res);
            }
            __Pyx_ErrRestore(error_type, error_value, error_traceback);
            return;
        }
    }
#endif
    if (unlikely(gen->resume_label == 0 && !error_value)) {
#ifdef __Pyx_Coroutine_USED
#ifdef __Pyx_Generator_USED
    if (!__Pyx_Generator_CheckExact(self))
#endif
        {
        PyObject_GC_UnTrack(self);
        if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
            PyErr_WriteUnraisable(self);
        PyObject_GC_Track(self);
        }
#endif
    } else {
        PyObject *retval = NULL;
        __Pyx_PySendResult result = __Pyx_Coroutine_Close(self, &retval);
        if (result == PYGEN_ERROR) {
            PyErr_WriteUnraisable(self);
        } else {
            Py_XDECREF(retval);
        }
    }
    __Pyx_ErrRestore(error_type, error_value, error_traceback);
}
#endif
static PyObject *
__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, void *context)
{
    PyObject *name = self->gi_name;
    CYTHON_UNUSED_VAR(context);
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    Py_INCREF(value);
    __Pyx_Py_XDECREF_SET(self->gi_name, value);
    return 0;
}
static PyObject *
__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, void *context)
{
    PyObject *name = self->gi_qualname;
    CYTHON_UNUSED_VAR(context);
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    Py_INCREF(value);
    __Pyx_Py_XDECREF_SET(self->gi_qualname, value);
    return 0;
}
#if !CYTHON_COMPILING_IN_LIMITED_API
static PyObject *
__Pyx__Coroutine_get_frame_locked(__pyx_CoroutineObject *self) {
    PyObject *frame;
    frame = self->gi_frame;
    if (!frame) {
        if (unlikely(!self->gi_code)) {
            Py_RETURN_NONE;
        }
        PyObject *globals = PyDict_New();
        if (unlikely(!globals)) return NULL;
        frame = (PyObject *) PyFrame_New(
            PyThreadState_Get(),            /*PyThreadState *tstate,*/
            (PyCodeObject*) self->gi_code,  /*PyCodeObject *code,*/
            globals,                        /*PyObject *globals,*/
            0                               /*PyObject *locals*/
        );
        Py_DECREF(globals);
        if (unlikely(!frame))
            return NULL;
        if (unlikely(self->gi_frame)) {
            Py_DECREF(frame);
            frame = self->gi_frame;
        } else {
            self->gi_frame = frame;
        }
    }
    Py_INCREF(frame);
    return frame;
}
#endif
static PyObject *
__Pyx__Coroutine_get_frame(__pyx_CoroutineObject *self)
{
#if !CYTHON_COMPILING_IN_LIMITED_API
    PyObject *frame;
    __Pyx_BEGIN_CRITICAL_SECTION((PyObject*)self);
    frame = __Pyx__Coroutine_get_frame_locked(self);
    __Pyx_END_CRITICAL_SECTION();
    return frame;
#else
    CYTHON_UNUSED_VAR(self);
    Py_RETURN_NONE;
#endif
}
static PyObject *
__Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, void *context) {
    CYTHON_UNUSED_VAR(context);
    PyObject *frame = self->gi_frame;
    if (frame)
        return __Pyx_NewRef(frame);
    return __Pyx__Coroutine_get_frame(self);
}
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
            PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
    if (unlikely(!gen))
        return NULL;
    return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name);
}
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
            __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    gen->body = body;
    gen->closure = closure;
    Py_XINCREF(closure);
    gen->is_running = 0;
    gen->resume_label = 0;
    gen->classobj = NULL;
    gen->yieldfrom = NULL;
    gen->yieldfrom_am_send = NULL;
    #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_LIMITED_API
    gen->gi_exc_state.exc_value = NULL;
    #else
    gen->gi_exc_state.exc_type = NULL;
    gen->gi_exc_state.exc_value = NULL;
    gen->gi_exc_state.exc_traceback = NULL;
    #endif
#if CYTHON_USE_EXC_INFO_STACK
    gen->gi_exc_state.previous_item = NULL;
#endif
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    gen->gi_weakreflist = NULL;
#endif
    Py_XINCREF(qualname);
    gen->gi_qualname = qualname;
    Py_XINCREF(name);
    gen->gi_name = name;
    Py_XINCREF(module_name);
    gen->gi_modulename = module_name;
    Py_XINCREF(code);
    gen->gi_code = code;
    gen->gi_frame = NULL;
#if CYTHON_USE_SYS_MONITORING && (CYTHON_PROFILE || CYTHON_TRACE)
    memset(gen->__pyx_pymonitoring_state, 0, sizeof(gen->__pyx_pymonitoring_state));
    gen->__pyx_pymonitoring_version = 0;
#endif
    PyObject_GC_Track(gen);
    return gen;
}
static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen) {
    char result;
    __Pyx_BEGIN_CRITICAL_SECTION((PyObject*)gen);
    result = gen->is_running;
    gen->is_running = 1;
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen) {
    __Pyx_BEGIN_CRITICAL_SECTION((PyObject*)gen);
    assert(gen->is_running);
    gen->is_running = 0;
    __Pyx_END_CRITICAL_SECTION();
}
static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen) {
    char result;
    __Pyx_BEGIN_CRITICAL_SECTION((PyObject*)gen);
    result = gen->is_running;
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure) {
    CYTHON_UNUSED_VAR(closure);
    char result = __Pyx_Coroutine_get_is_running((__pyx_CoroutineObject*)gen);
    if (result) Py_RETURN_TRUE;
    else Py_RETURN_FALSE;
}
#if __PYX_HAS_PY_AM_SEND == 2
static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send) {
    Py_ssize_t ptr_offset = (char*)(type->tp_as_async) - (char*)type;
    if (ptr_offset < 0 || ptr_offset > type->tp_basicsize) {
        return;
    }
    memcpy((void*)static_amsend_methods, (void*)(type->tp_as_async), sizeof(*type->tp_as_async));
    static_amsend_methods->am_send = am_send;
    type->tp_as_async = __Pyx_SlotTpAsAsync(static_amsend_methods);
}
#endif
static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg) {
    CYTHON_UNUSED_VAR(arg);
    __Pyx_TypeName self_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE((PyObject*)self));
    PyErr_Format(PyExc_TypeError, "cannot pickle '" __Pyx_FMT_TYPENAME "' object",
                         self_type_name);
    __Pyx_DECREF_TypeName(self_type_name);
    return NULL;
}

/* Generator (used by GeneratorYieldFrom) */
static PyMethodDef __pyx_Generator_methods[] = {
    {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
     PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
    {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
     PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
    {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
     PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
    {"__reduce_ex__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_O, 0},
    {"__reduce__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_NOARGS, 0},
    {0, 0, 0, 0}
};
static PyMemberDef __pyx_Generator_memberlist[] = {
    {"gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
     PyDoc_STR("object being iterated by 'yield from', or None")},
    {"gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
    {"__module__", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_modulename), 0, 0},
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CoroutineObject, gi_weakreflist), READONLY, 0},
#endif
    {0, 0, 0, 0, 0}
};
static PyGetSetDef __pyx_Generator_getsets[] = {
    {"__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
     PyDoc_STR("name of the generator"), 0},
    {"__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
     PyDoc_STR("qualified name of the generator"), 0},
    {"gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL,
     PyDoc_STR("Frame of the generator"), 0},
    {"gi_running", __Pyx_Coroutine_get_is_running_getter, NULL, NULL, NULL},
    {0, 0, 0, 0, 0}
};
static PyType_Slot __pyx_GeneratorType_slots[] = {
    {Py_tp_dealloc, (void *)__Pyx_Coroutine_dealloc},
    {Py_tp_traverse, (void *)__Pyx_Coroutine_traverse},
    {Py_tp_iter, (void *)PyObject_SelfIter},
    {Py_tp_iternext, (void *)__Pyx_Generator_Next},
    {Py_tp_methods, (void *)__pyx_Generator_methods},
    {Py_tp_members, (void *)__pyx_Generator_memberlist},
    {Py_tp_getset, (void *)__pyx_Generator_getsets},
    {Py_tp_getattro, (void *) PyObject_GenericGetAttr},
#if CYTHON_USE_TP_FINALIZE
    {Py_tp_finalize, (void *)__Pyx_Coroutine_del},
#endif
#if __PYX_HAS_PY_AM_SEND == 1
    {Py_am_send, (void *)__Pyx_Coroutine_AmSend},
#endif
    {0, 0},
};
static PyType_Spec __pyx_GeneratorType_spec = {
    __PYX_TYPE_MODULE_PREFIX "generator",
    sizeof(__pyx_CoroutineObject),
    0,
#if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_TPFLAGS_MANAGED_WEAKREF |
#endif
    Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION |
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | __Pyx_TPFLAGS_HAVE_AM_SEND,
    __pyx_GeneratorType_slots
};
#if __PYX_HAS_PY_AM_SEND == 2
static __Pyx_PyAsyncMethodsStruct __pyx_Generator_as_async;
#endif
static int __pyx_Generator_init(PyObject *module) {
    __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module);
    mstate->__pyx_GeneratorType = __Pyx_FetchCommonTypeFromSpec(
        mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_GeneratorType_spec, NULL);
    if (unlikely(!mstate->__pyx_GeneratorType)) {
        return -1;
    }
#if __PYX_HAS_PY_AM_SEND == 2
    __Pyx_SetBackportTypeAmSend(mstate->__pyx_GeneratorType, &__pyx_Generator_as_async, &__Pyx_Coroutine_AmSend);
#endif
    return 0;
}
static PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *retval = NULL;
    if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    }
    __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0);
    __Pyx_Coroutine_unset_is_running(gen);
    (void) result;
    assert (result == PYGEN_RETURN || result == PYGEN_ERROR);
    assert ((result == PYGEN_RETURN && retval != NULL) || (result == PYGEN_ERROR && retval == NULL));
    return retval;
}

/* GeneratorYieldFrom */
#if CYTHON_USE_TYPE_SLOTS
static void __Pyx_PyIter_CheckErrorAndDecref(PyObject *source) {
    __Pyx_TypeName source_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(source));
    PyErr_Format(PyExc_TypeError,
        "iter() returned non-iterator of type '" __Pyx_FMT_TYPENAME "'", source_type_name);
    __Pyx_DECREF_TypeName(source_type_name);
    Py_DECREF(source);
}
#endif
static CYTHON_INLINE __Pyx_PySendResult __Pyx_Generator_Yield_From(__pyx_CoroutineObject *gen, PyObject *source, PyObject **retval) {
    PyObject *source_gen;
    __Pyx_PySendResult result;
#ifdef __Pyx_Coroutine_USED
    if (__Pyx_Coroutine_Check(source)) {
        Py_INCREF(source);
        source_gen = source;
        result = __Pyx_Coroutine_AmSend(source, Py_None, retval);
    } else
#endif
    {
#if CYTHON_USE_TYPE_SLOTS
        if (likely(Py_TYPE(source)->tp_iter)) {
            source_gen = Py_TYPE(source)->tp_iter(source);
            if (unlikely(!source_gen)) {
                *retval = NULL;
                return PYGEN_ERROR;
            }
            if (unlikely(!PyIter_Check(source_gen))) {
                __Pyx_PyIter_CheckErrorAndDecref(source_gen);
                *retval = NULL;
                return PYGEN_ERROR;
            }
        } else
#endif
        {
            source_gen = PyObject_GetIter(source);
            if (unlikely(!source_gen)) {
                *retval = NULL;
                return PYGEN_ERROR;
            }
        }
        *retval = __Pyx_PyIter_Next_Plain(source_gen);
        result = __Pyx_Coroutine_status_from_result(retval);
    }
    if (likely(result == PYGEN_NEXT)) {
        __Pyx_Coroutine_Set_Owned_Yield_From(gen, source_gen);
        return PYGEN_NEXT;
    }
    Py_DECREF(source_gen);
    return result;
}

/* PyLongBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_Fallback___Pyx_PyLong_FloorDivideObjC(PyObject *op1, PyObject *op2, int inplace) {
    return (inplace ? PyNumber_InPlaceFloorDivide : PyNumber_FloorDivide)(op1, op2);
}
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject* __Pyx_Unpacked___Pyx_PyLong_FloorDivideObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(inplace);
    CYTHON_UNUSED_VAR(zerodivision_check);
    const long b = intval;
    long a;
    const PY_LONG_LONG llb = intval;
    PY_LONG_LONG lla;
    if (unlikely(__Pyx_PyLong_IsZero(op1))) {
        return __Pyx_NewRef(op1);
    }
    const int is_positive = __Pyx_PyLong_IsPos(op1);
    const digit* digits = __Pyx_PyLong_Digits(op1);
    const Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
    if (likely(size == 1)) {
        a = (long) digits[0];
        if (!is_positive) a *= -1;
    } else {
        switch (size) {
            case 2:
                if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                    a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                    lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
            case 3:
                if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                    a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                    lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
            case 4:
                if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                    a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                    lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
        }
        return PyLong_Type.tp_as_number->nb_floor_divide(op1, op2);
    }
    calculate_long:
        {
            long q, r;
            q = a / b;
            r = a - q*b;
            q -= ((r != 0) & ((r ^ b) < 0));
            return PyLong_FromLong(q);
        }
    calculate_long_long:
        {
            PY_LONG_LONG q, r;
            q = lla / llb;
            r = lla - q*llb;
            q -= ((r != 0) & ((r ^ llb) < 0));
            return PyLong_FromLongLong(q);
        }
    
}
#endif
static CYTHON_INLINE PyObject* __Pyx_PyLong_FloorDivideObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_UNUSED_VAR(zerodivision_check);
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        return __Pyx_Unpacked___Pyx_PyLong_FloorDivideObjC(op1, op2, intval, inplace, zerodivision_check);
    }
    #endif
    return __Pyx_Fallback___Pyx_PyLong_FloorDivideObjC(op1, op2, inplace);
}
#endif

/* PyObjectSetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_setattro))
        return tp->tp_setattro(obj, attr_name, value);
    return PyObject_SetAttr(obj, attr_name, value);
}
#endif

/* PyUnicode_Unicode */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj) {
    if (unlikely(obj == Py_None))
        obj = __pyx_mstate_global->__pyx_kp_u_None;
    return __Pyx_NewRef(obj);
}

/* IterNext */
static PyObject *__Pyx_PyIter_Next2Default(PyObject* defval) {
    PyObject* exc_type;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    exc_type = __Pyx_PyErr_CurrentExceptionType();
    if (unlikely(exc_type)) {
        if (!defval || unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))
            return NULL;
        __Pyx_PyErr_Clear();
        Py_INCREF(defval);
        return defval;
    }
    if (defval) {
        Py_INCREF(defval);
        return defval;
    }
    __Pyx_PyErr_SetNone(PyExc_StopIteration);
    return NULL;
}
static void __Pyx_PyIter_Next_ErrorNoIterator(PyObject *iterator) {
    __Pyx_TypeName iterator_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(iterator));
    PyErr_Format(PyExc_TypeError,
        __Pyx_FMT_TYPENAME " object is not an iterator", iterator_type_name);
    __Pyx_DECREF_TypeName(iterator_type_name);
}
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* defval) {
    PyObject* next;
#if !CYTHON_COMPILING_IN_LIMITED_API
    iternextfunc iternext = __Pyx_PyObject_TryGetSlot(iterator, tp_iternext, iternextfunc);
    if (likely(iternext)) {
        next = iternext(iterator);
        if (likely(next))
            return next;
    #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
        if (unlikely(iternext == &_PyObject_NextNotImplemented))
            return NULL;
    #endif
    } else if (CYTHON_USE_TYPE_SLOTS) {
        __Pyx_PyIter_Next_ErrorNoIterator(iterator);
        return NULL;
    } else
#endif
    if (unlikely(!PyIter_Check(iterator))) {
        __Pyx_PyIter_Next_ErrorNoIterator(iterator);
        return NULL;
    } else {
        next = defval ? PyIter_Next(iterator) : __Pyx_PyIter_Next_Plain(iterator);
        if (likely(next))
            return next;
    }
    return __Pyx_PyIter_Next2Default(defval);
}

/* AllocateExtensionType */
static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final) {
    if (is_final || likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
        allocfunc alloc_func = __Pyx_PyType_GetSlot(t, tp_alloc, allocfunc);
        return alloc_func(t, 0);
    } else {
        newfunc tp_new = __Pyx_PyType_TryGetSlot(&PyBaseObject_Type, tp_new, newfunc);
    #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
        if (!tp_new) {
            PyObject *new_str = PyUnicode_FromString("__new__");
            if (likely(new_str)) {
                PyObject *o = PyObject_CallMethodObjArgs((PyObject *)&PyBaseObject_Type, new_str, t, NULL);
                Py_DECREF(new_str);
                return o;
            } else
                return NULL;
        } else
    #endif
        return tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
    }
}

/* CallNextTpTraverse */
static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse) {
    PyTypeObject* type = Py_TYPE(obj);
    traverseproc tp_traverse = NULL;
    while (type && __Pyx_PyType_GetSlot(type, tp_traverse, traverseproc) != current_tp_traverse)
        type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
    while (type && (tp_traverse = __Pyx_PyType_GetSlot(type, tp_traverse, traverseproc)) == current_tp_traverse)
        type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
    if (type && tp_traverse)
        return tp_traverse(obj, v, a);
    return 0;
}

/* CallNextTpClear */
static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_clear) {
    PyTypeObject* type = Py_TYPE(obj);
    inquiry tp_clear = NULL;
    while (type && __Pyx_PyType_GetSlot(type, tp_clear, inquiry) != current_tp_clear)
        type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
    while (type && (tp_clear = __Pyx_PyType_GetSlot(type, tp_clear, inquiry)) == current_tp_clear)
        type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
    if (type && tp_clear)
        tp_clear(obj);
}

/* ValidateBasesTuple (used by PyType_Ready) */
#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) {
    Py_ssize_t i, n;
#if CYTHON_ASSUME_SAFE_SIZE
    n = PyTuple_GET_SIZE(bases);
#else
    n = PyTuple_Size(bases);
    if (unlikely(n < 0)) return -1;
#endif
    for (i = 1; i < n; i++)
    {
        PyTypeObject *b;
#if CYTHON_AVOID_BORROWED_REFS
        PyObject *b0 = PySequence_GetItem(bases, i);
        if (!b0) return -1;
#elif CYTHON_ASSUME_SAFE_MACROS
        PyObject *b0 = PyTuple_GET_ITEM(bases, i);
#else
        PyObject *b0 = PyTuple_GetItem(bases, i);
        if (!b0) return -1;
#endif
        b = (PyTypeObject*) b0;
        if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE))
        {
            __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b);
            PyErr_Format(PyExc_TypeError,
                "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name);
            __Pyx_DECREF_TypeName(b_name);
#if CYTHON_AVOID_BORROWED_REFS
            Py_DECREF(b0);
#endif
            return -1;
        }
        if (dictoffset == 0)
        {
            Py_ssize_t b_dictoffset = 0;
#if CYTHON_USE_TYPE_SLOTS
            b_dictoffset = b->tp_dictoffset;
#else
            PyObject *py_b_dictoffset = PyObject_GetAttrString((PyObject*)b, "__dictoffset__");
            if (!py_b_dictoffset) goto dictoffset_return;
            b_dictoffset = PyLong_AsSsize_t(py_b_dictoffset);
            Py_DECREF(py_b_dictoffset);
            if (b_dictoffset == -1 && PyErr_Occurred()) goto dictoffset_return;
#endif
            if (b_dictoffset) {
                {
                    __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b);
                    PyErr_Format(PyExc_TypeError,
                        "extension type '%.200s' has no __dict__ slot, "
                        "but base type '" __Pyx_FMT_TYPENAME "' has: "
                        "either add 'cdef dict __dict__' to the extension type "
                        "or add '__slots__ = [...]' to the base type",
                        type_name, b_name);
                    __Pyx_DECREF_TypeName(b_name);
                }
#if !CYTHON_USE_TYPE_SLOTS
              dictoffset_return:
#endif
#if CYTHON_AVOID_BORROWED_REFS
                Py_DECREF(b0);
#endif
                return -1;
            }
        }
#if CYTHON_AVOID_BORROWED_REFS
        Py_DECREF(b0);
#endif
    }
    return 0;
}
#endif

/* PyType_Ready */
CYTHON_UNUSED static int __Pyx_PyType_HasMultipleInheritance(PyTypeObject *t) {
    while (t) {
        PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*);
        if (bases) {
            return 1;
        }
        t = __Pyx_PyType_GetSlot(t, tp_base, PyTypeObject*);
    }
    return 0;
}
static int __Pyx_PyType_Ready(PyTypeObject *t) {
#if CYTHON_USE_TYPE_SPECS || !CYTHON_COMPILING_IN_CPYTHON || defined(PYSTON_MAJOR_VERSION)
    (void)__Pyx_PyObject_CallMethod0;
#if CYTHON_USE_TYPE_SPECS
    (void)__Pyx_validate_bases_tuple;
#endif
    return PyType_Ready(t);
#else
    int r;
    if (!__Pyx_PyType_HasMultipleInheritance(t)) {
        return PyType_Ready(t);
    }
    PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*);
    if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1))
        return -1;
#if !defined(PYSTON_MAJOR_VERSION)
    {
        int gc_was_enabled;
    #if PY_VERSION_HEX >= 0x030A00b1
        gc_was_enabled = PyGC_Disable();
        (void)__Pyx_PyObject_CallMethod0;
    #else
        PyObject *ret, *py_status;
        PyObject *gc = NULL;
        #if (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) &&\
                !CYTHON_COMPILING_IN_GRAAL
        gc = PyImport_GetModule(__pyx_mstate_global->__pyx_kp_u_gc);
        #endif
        if (unlikely(!gc)) gc = PyImport_Import(__pyx_mstate_global->__pyx_kp_u_gc);
        if (unlikely(!gc)) return -1;
        py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_isenabled);
        if (unlikely(!py_status)) {
            Py_DECREF(gc);
            return -1;
        }
        gc_was_enabled = __Pyx_PyObject_IsTrue(py_status);
        Py_DECREF(py_status);
        if (gc_was_enabled > 0) {
            ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_disable);
            if (unlikely(!ret)) {
                Py_DECREF(gc);
                return -1;
            }
            Py_DECREF(ret);
        } else if (unlikely(gc_was_enabled == -1)) {
            Py_DECREF(gc);
            return -1;
        }
    #endif
        t->tp_flags |= Py_TPFLAGS_HEAPTYPE;
#if PY_VERSION_HEX >= 0x030A0000
        t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE;
#endif
#else
        (void)__Pyx_PyObject_CallMethod0;
#endif
    r = PyType_Ready(t);
#if !defined(PYSTON_MAJOR_VERSION)
        t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE;
    #if PY_VERSION_HEX >= 0x030A00b1
        if (gc_was_enabled)
            PyGC_Enable();
    #else
        if (gc_was_enabled) {
            PyObject *tp, *v, *tb;
            PyErr_Fetch(&tp, &v, &tb);
            ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_enable);
            if (likely(ret || r == -1)) {
                Py_XDECREF(ret);
                PyErr_Restore(tp, v, tb);
            } else {
                Py_XDECREF(tp);
                Py_XDECREF(v);
                Py_XDECREF(tb);
                r = -1;
            }
        }
        Py_DECREF(gc);
    #endif
    }
#endif
    return r;
#endif
}

/* DelItemOnTypeDict (used by SetupReduce) */
static int __Pyx__DelItemOnTypeDict(PyTypeObject *tp, PyObject *k) {
    int result;
    PyObject *tp_dict;
#if CYTHON_COMPILING_IN_LIMITED_API
    tp_dict = __Pyx_GetTypeDict(tp);
    if (unlikely(!tp_dict)) return -1;
#else
    tp_dict = tp->tp_dict;
#endif
    result = PyDict_DelItem(tp_dict, k);
    if (likely(!result)) PyType_Modified(tp);
    return result;
}

/* SetupReduce */
static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
  int ret;
  PyObject *name_attr;
  name_attr = __Pyx_PyObject_GetAttrStrNoError(meth, __pyx_mstate_global->__pyx_n_u_name_2);
  if (likely(name_attr)) {
      ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
  } else {
      ret = -1;
  }
  if (unlikely(ret < 0)) {
      PyErr_Clear();
      ret = 0;
  }
  Py_XDECREF(name_attr);
  return ret;
}
static int __Pyx_setup_reduce(PyObject* type_obj) {
    int ret = 0;
    PyObject *object_reduce = NULL;
    PyObject *object_getstate = NULL;
    PyObject *object_reduce_ex = NULL;
    PyObject *reduce = NULL;
    PyObject *reduce_ex = NULL;
    PyObject *reduce_cython = NULL;
    PyObject *setstate = NULL;
    PyObject *setstate_cython = NULL;
    PyObject *getstate = NULL;
#if CYTHON_USE_PYTYPE_LOOKUP
    getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_getstate);
#else
    getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_getstate);
    if (!getstate && PyErr_Occurred()) {
        goto __PYX_BAD;
    }
#endif
    if (getstate) {
#if CYTHON_USE_PYTYPE_LOOKUP
        object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_getstate);
#else
        object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_getstate);
        if (!object_getstate && PyErr_Occurred()) {
            goto __PYX_BAD;
        }
#endif
        if (object_getstate != getstate) {
            goto __PYX_GOOD;
        }
    }
#if CYTHON_USE_PYTYPE_LOOKUP
    object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
#else
    object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
#endif
    reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
    if (reduce_ex == object_reduce_ex) {
#if CYTHON_USE_PYTYPE_LOOKUP
        object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce); if (!object_reduce) goto __PYX_BAD;
#else
        object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce); if (!object_reduce) goto __PYX_BAD;
#endif
        reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_mstate_global->__pyx_n_u_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
        if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_mstate_global->__pyx_n_u_reduce_cython)) {
            reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_reduce_cython);
            if (likely(reduce_cython)) {
                ret = __Pyx_SetItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                ret = __Pyx_DelItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
            } else if (reduce == object_reduce || PyErr_Occurred()) {
                goto __PYX_BAD;
            }
            setstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_setstate);
            if (!setstate) PyErr_Clear();
            if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_mstate_global->__pyx_n_u_setstate_cython)) {
                setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_setstate_cython);
                if (likely(setstate_cython)) {
                    ret = __Pyx_SetItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                    ret = __Pyx_DelItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                } else if (!setstate || PyErr_Occurred()) {
                    goto __PYX_BAD;
                }
            }
            PyType_Modified((PyTypeObject*)type_obj);
        }
    }
    goto __PYX_GOOD;
__PYX_BAD:
    if (!PyErr_Occurred()) {
        __Pyx_TypeName type_obj_name =
            __Pyx_PyType_GetFullyQualifiedName((PyTypeObject*)type_obj);
        PyErr_Format(PyExc_RuntimeError,
            "Unable to initialize pickling for " __Pyx_FMT_TYPENAME, type_obj_name);
        __Pyx_DECREF_TypeName(type_obj_name);
    }
    ret = -1;
__PYX_GOOD:
#if !CYTHON_USE_PYTYPE_LOOKUP
    Py_XDECREF(object_reduce);
    Py_XDECREF(object_reduce_ex);
    Py_XDECREF(object_getstate);
    Py_XDECREF(getstate);
#endif
    Py_XDECREF(reduce);
    Py_XDECREF(reduce_ex);
    Py_XDECREF(reduce_cython);
    Py_XDECREF(setstate);
    Py_XDECREF(setstate_cython);
    return ret;
}

/* SetVTable */
static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) {
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
    if (unlikely(!ob))
        goto bad;
#if CYTHON_COMPILING_IN_LIMITED_API
    if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0))
#else
    if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0))
#endif
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

/* GetVTable (used by MergeVTables) */
static void* __Pyx_GetVtable(PyTypeObject *type) {
    void* ptr;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_mstate_global->__pyx_n_u_pyx_vtable);
#else
    PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable);
#endif
    if (!ob)
        goto bad;
    ptr = PyCapsule_GetPointer(ob, 0);
    if (!ptr && !PyErr_Occurred())
        PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
    Py_DECREF(ob);
    return ptr;
bad:
    Py_XDECREF(ob);
    return NULL;
}

/* MergeVTables */
static int __Pyx_MergeVtables(PyTypeObject *type) {
    int i=0;
    Py_ssize_t size;
    void** base_vtables;
    __Pyx_TypeName tp_base_name = NULL;
    __Pyx_TypeName base_name = NULL;
    void* unknown = (void*)-1;
    PyObject* bases = __Pyx_PyType_GetSlot(type, tp_bases, PyObject*);
    int base_depth = 0;
    {
        PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
        while (base) {
            base_depth += 1;
            base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*);
        }
    }
    base_vtables = (void**) PyMem_Malloc(sizeof(void*) * (size_t)(base_depth + 1));
    base_vtables[0] = unknown;
#if CYTHON_COMPILING_IN_LIMITED_API
    size = PyTuple_Size(bases);
    if (size < 0) goto other_failure;
#else
    size = PyTuple_GET_SIZE(bases);
#endif
    for (i = 1; i < size; i++) {
        PyObject *basei;
        void* base_vtable;
#if CYTHON_AVOID_BORROWED_REFS
        basei = PySequence_GetItem(bases, i);
        if (unlikely(!basei)) goto other_failure;
#elif !CYTHON_ASSUME_SAFE_MACROS
        basei = PyTuple_GetItem(bases, i);
        if (unlikely(!basei)) goto other_failure;
#else
        basei = PyTuple_GET_ITEM(bases, i);
#endif
        base_vtable = __Pyx_GetVtable((PyTypeObject*)basei);
#if CYTHON_AVOID_BORROWED_REFS
        Py_DECREF(basei);
#endif
        if (base_vtable != NULL) {
            int j;
            PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
            for (j = 0; j < base_depth; j++) {
                if (base_vtables[j] == unknown) {
                    base_vtables[j] = __Pyx_GetVtable(base);
                    base_vtables[j + 1] = unknown;
                }
                if (base_vtables[j] == base_vtable) {
                    break;
                } else if (base_vtables[j] == NULL) {
                    goto bad;
                }
                base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*);
            }
        }
    }
    PyErr_Clear();
    PyMem_Free(base_vtables);
    return 0;
bad:
    {
        PyTypeObject* basei = NULL;
        PyTypeObject* tp_base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
        tp_base_name = __Pyx_PyType_GetFullyQualifiedName(tp_base);
#if CYTHON_AVOID_BORROWED_REFS
        basei = (PyTypeObject*)PySequence_GetItem(bases, i);
        if (unlikely(!basei)) goto really_bad;
#elif !CYTHON_ASSUME_SAFE_MACROS
        basei = (PyTypeObject*)PyTuple_GetItem(bases, i);
        if (unlikely(!basei)) goto really_bad;
#else
        basei = (PyTypeObject*)PyTuple_GET_ITEM(bases, i);
#endif
        base_name = __Pyx_PyType_GetFullyQualifiedName(basei);
#if CYTHON_AVOID_BORROWED_REFS
        Py_DECREF(basei);
#endif
    }
    PyErr_Format(PyExc_TypeError,
        "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name);
#if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS
really_bad: // bad has failed!
#endif
    __Pyx_DECREF_TypeName(tp_base_name);
    __Pyx_DECREF_TypeName(base_name);
#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS
other_failure:
#endif
    PyMem_Free(base_vtables);
    return -1;
}

/* TypeImport */
#ifndef __PYX_HAVE_RT_ImportType_3_2_8
#define __PYX_HAVE_RT_ImportType_3_2_8
static PyTypeObject *__Pyx_ImportType_3_2_8(PyObject *module, const char *module_name, const char *class_name,
    size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_8 check_size)
{
    PyObject *result = 0;
    Py_ssize_t basicsize;
    Py_ssize_t itemsize;
#if defined(Py_LIMITED_API) || (defined(CYTHON_COMPILING_IN_LIMITED_API) && CYTHON_COMPILING_IN_LIMITED_API)
    PyObject *py_basicsize;
    PyObject *py_itemsize;
#endif
    result = PyObject_GetAttrString(module, class_name);
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s.%.200s is not a type object",
            module_name, class_name);
        goto bad;
    }
#if !( defined(Py_LIMITED_API) || (defined(CYTHON_COMPILING_IN_LIMITED_API) && CYTHON_COMPILING_IN_LIMITED_API) )
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
    itemsize = ((PyTypeObject *)result)->tp_itemsize;
#else
    if (size == 0) {
        return (PyTypeObject *)result;
    }
    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
    if (!py_basicsize)
        goto bad;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = 0;
    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
    py_itemsize = PyObject_GetAttrString(result, "__itemsize__");
    if (!py_itemsize)
        goto bad;
    itemsize = PyLong_AsSsize_t(py_itemsize);
    Py_DECREF(py_itemsize);
    py_itemsize = 0;
    if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if (itemsize) {
        if (size % alignment) {
            alignment = size % alignment;
        }
        if (itemsize < (Py_ssize_t)alignment)
            itemsize = (Py_ssize_t)alignment;
    }
    if ((size_t)(basicsize + itemsize) < size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize+itemsize);
        goto bad;
    }
    if (check_size == __Pyx_ImportType_CheckSize_Error_3_2_8 &&
            ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd-%zd from PyObject",
            module_name, class_name, size, basicsize, basicsize+itemsize);
        goto bad;
    }
    else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_2_8 && (size_t)basicsize > size) {
        if (PyErr_WarnFormat(NULL, 0,
                "%.200s.%.200s size changed, may indicate binary incompatibility. "
                "Expected %zd from C header, got %zd from PyObject",
                module_name, class_name, size, basicsize) < 0) {
            goto bad;
        }
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(result);
    return NULL;
}
#endif

/* ImportFrom */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        const char* module_name_str = 0;
        PyObject* module_name = 0;
        PyObject* module_dot = 0;
        PyObject* full_name = 0;
        PyErr_Clear();
        module_name_str = PyModule_GetName(module);
        if (unlikely(!module_name_str)) { goto modbad; }
        module_name = PyUnicode_FromString(module_name_str);
        if (unlikely(!module_name)) { goto modbad; }
        module_dot = PyUnicode_Concat(module_name, __pyx_mstate_global->__pyx_kp_u__2);
        if (unlikely(!module_dot)) { goto modbad; }
        full_name = PyUnicode_Concat(module_dot, name);
        if (unlikely(!full_name)) { goto modbad; }
        #if (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM  < 0x07030400) ||\
                CYTHON_COMPILING_IN_GRAAL
        {
            PyObject *modules = PyImport_GetModuleDict();
            if (unlikely(!modules))
                goto modbad;
            value = PyObject_GetItem(modules, full_name);
        }
        #else
        value = PyImport_GetModule(full_name);
        #endif
      modbad:
        Py_XDECREF(full_name);
        Py_XDECREF(module_dot);
        Py_XDECREF(module_name);
    }
    if (unlikely(!value)) {
        PyErr_Format(PyExc_ImportError, "cannot import name %S", name);
    }
    return value;
}

/* PyMethodNew (used by CythonFunctionShared) */
#if CYTHON_COMPILING_IN_LIMITED_API
static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
    PyObject *result;
    CYTHON_UNUSED_VAR(typ);
    if (!self)
        return __Pyx_NewRef(func);
    #if __PYX_LIMITED_VERSION_HEX >= 0x030C0000
    {
        PyObject *args[] = {func, self};
        result = PyObject_Vectorcall(__pyx_mstate_global->__Pyx_CachedMethodType, args, 2, NULL);
    }
    #else
    result = PyObject_CallFunctionObjArgs(__pyx_mstate_global->__Pyx_CachedMethodType, func, self, NULL);
    #endif
    return result;
}
#else
static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
    CYTHON_UNUSED_VAR(typ);
    if (!self)
        return __Pyx_NewRef(func);
    return PyMethod_New(func, self);
}
#endif

/* PyVectorcallFastCallDict (used by CythonFunctionShared) */
#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
{
    PyObject *res = NULL;
    PyObject *kwnames;
    PyObject **newargs;
    PyObject **kwvalues;
    Py_ssize_t i;
    #if CYTHON_AVOID_BORROWED_REFS
    PyObject *pos;
    #else
    Py_ssize_t pos;
    #endif
    size_t j;
    PyObject *key, *value;
    unsigned long keys_are_strings;
    #if !CYTHON_ASSUME_SAFE_SIZE
    Py_ssize_t nkw = PyDict_Size(kw);
    if (unlikely(nkw == -1)) return NULL;
    #else
    Py_ssize_t nkw = PyDict_GET_SIZE(kw);
    #endif
    newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0]));
    if (unlikely(newargs == NULL)) {
        PyErr_NoMemory();
        return NULL;
    }
    for (j = 0; j < nargs; j++) newargs[j] = args[j];
    kwnames = PyTuple_New(nkw);
    if (unlikely(kwnames == NULL)) {
        PyMem_Free(newargs);
        return NULL;
    }
    kwvalues = newargs + nargs;
    pos = 0;
    i = 0;
    keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS;
    while (__Pyx_PyDict_NextRef(kw, &pos, &key, &value)) {
        keys_are_strings &=
        #if CYTHON_COMPILING_IN_LIMITED_API
            PyType_GetFlags(Py_TYPE(key));
        #else
            Py_TYPE(key)->tp_flags;
        #endif
        #if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely(PyTuple_SetItem(kwnames, i, key) < 0)) goto cleanup;
        #else
        PyTuple_SET_ITEM(kwnames, i, key);
        #endif
        kwvalues[i] = value;
        i++;
    }
    if (unlikely(!keys_are_strings)) {
        PyErr_SetString(PyExc_TypeError, "keywords must be strings");
        goto cleanup;
    }
    res = vc(func, newargs, nargs, kwnames);
cleanup:
    #if CYTHON_AVOID_BORROWED_REFS
    Py_DECREF(pos);
    #endif
    Py_DECREF(kwnames);
    for (i = 0; i < nkw; i++)
        Py_DECREF(kwvalues[i]);
    PyMem_Free(newargs);
    return res;
}
static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
{
    Py_ssize_t kw_size =
        likely(kw == NULL) ?
        0 :
#if !CYTHON_ASSUME_SAFE_SIZE
        PyDict_Size(kw);
#else
        PyDict_GET_SIZE(kw);
#endif
    if (kw_size == 0) {
        return vc(func, args, nargs, NULL);
    }
#if !CYTHON_ASSUME_SAFE_SIZE
    else if (unlikely(kw_size == -1)) {
        return NULL;
    }
#endif
    return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw);
}
#endif

/* CythonFunctionShared (used by CythonFunction) */
#if CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE int __Pyx__IsSameCyOrCFunctionNoMethod(PyObject *func, void (*cfunc)(void)) {
    if (__Pyx_CyFunction_Check(func)) {
        return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc;
    } else if (PyCFunction_Check(func)) {
        return PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
    }
    return 0;
}
static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) {
    if ((PyObject*)Py_TYPE(func) == __pyx_mstate_global->__Pyx_CachedMethodType) {
        int result;
        PyObject *newFunc = PyObject_GetAttr(func, __pyx_mstate_global->__pyx_n_u_func);
        if (unlikely(!newFunc)) {
            PyErr_Clear(); // It's only an optimization, so don't throw an error
            return 0;
        }
        result = __Pyx__IsSameCyOrCFunctionNoMethod(newFunc, cfunc);
        Py_DECREF(newFunc);
        return result;
    }
    return __Pyx__IsSameCyOrCFunctionNoMethod(func, cfunc);
}
#else
static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) {
    if (PyMethod_Check(func)) {
        func = PyMethod_GET_FUNCTION(func);
    }
    return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
}
#endif
static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) {
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
    __Pyx_Py_XDECREF_SET(
        __Pyx_CyFunction_GetClassObj(f),
            ((classobj) ? __Pyx_NewRef(classobj) : NULL));
#else
    __Pyx_Py_XDECREF_SET(
        ((PyCMethodObject *) (f))->mm_class,
        (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL));
#endif
}
static PyObject *
__Pyx_CyFunction_get_doc_locked(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_doc == NULL)) {
#if CYTHON_COMPILING_IN_LIMITED_API
        op->func_doc = PyObject_GetAttrString(op->func, "__doc__");
        if (unlikely(!op->func_doc)) return NULL;
#else
        if (((PyCFunctionObject*)op)->m_ml->ml_doc) {
            op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc);
            if (unlikely(op->func_doc == NULL))
                return NULL;
        } else {
            Py_INCREF(Py_None);
            return Py_None;
        }
#endif
    }
    Py_INCREF(op->func_doc);
    return op->func_doc;
}
static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) {
    PyObject *result;
    CYTHON_UNUSED_VAR(closure);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    result = __Pyx_CyFunction_get_doc_locked(op);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (value == NULL) {
        value = Py_None;
    }
    Py_INCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->func_doc, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_name_locked(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_name == NULL)) {
#if CYTHON_COMPILING_IN_LIMITED_API
        op->func_name = PyObject_GetAttrString(op->func, "__name__");
#else
        op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name);
#endif
        if (unlikely(op->func_name == NULL))
            return NULL;
    }
    Py_INCREF(op->func_name);
    return op->func_name;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context)
{
    PyObject *result = NULL;
    CYTHON_UNUSED_VAR(context);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    result = __Pyx_CyFunction_get_name_locked(op);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    Py_INCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->func_name, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(context);
    PyObject *result;
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    Py_INCREF(op->func_qualname);
    result = op->func_qualname;
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    Py_INCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->func_qualname, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (unlikely(op->func_dict == NULL)) {
        op->func_dict = PyDict_New();
        if (unlikely(op->func_dict == NULL))
            return NULL;
    }
    Py_INCREF(op->func_dict);
    return op->func_dict;
}
#endif
static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(context);
    Py_INCREF(op->func_globals);
    return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(op);
    CYTHON_UNUSED_VAR(context);
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context)
{
    PyObject* result = (op->func_code) ? op->func_code : Py_None;
    CYTHON_UNUSED_VAR(context);
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
    int result = 0;
    PyObject *res = op->defaults_getter((PyObject *) op);
    if (unlikely(!res))
        return -1;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
    Py_INCREF(op->defaults_tuple);
    op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
    Py_INCREF(op->defaults_kwdict);
    #else
    op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0);
    if (unlikely(!op->defaults_tuple)) result = -1;
    else {
        op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1);
        if (unlikely(!op->defaults_kwdict)) result = -1;
    }
    #endif
    Py_DECREF(res);
    return result;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
    CYTHON_UNUSED_VAR(context);
    if (!value) {
        value = Py_None;
    } else if (unlikely(value != Py_None && !PyTuple_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__defaults__ must be set to a tuple object");
        return -1;
    }
    PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not "
                 "currently affect the values used in function calls", 1);
    Py_INCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->defaults_tuple, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults_locked(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_tuple;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
            result = op->defaults_tuple;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) {
    PyObject* result = NULL;
    CYTHON_UNUSED_VAR(context);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    result = __Pyx_CyFunction_get_defaults_locked(op);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
    CYTHON_UNUSED_VAR(context);
    if (!value) {
        value = Py_None;
    } else if (unlikely(value != Py_None && !PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__kwdefaults__ must be set to a dict object");
        return -1;
    }
    PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not "
                 "currently affect the values used in function calls", 1);
    Py_INCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults_locked(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_kwdict;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
            result = op->defaults_kwdict;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) {
    PyObject* result;
    CYTHON_UNUSED_VAR(context);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    result = __Pyx_CyFunction_get_kwdefaults_locked(op);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static int __Pyx_CyFunction_set_annotate_in_dict_if_exists(PyObject *op_in, PyObject *value);
static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
    CYTHON_UNUSED_VAR(context);
    if (!value || value == Py_None) {
        value = NULL;
    } else if (unlikely(!PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__annotations__ must be set to a dict object");
        return -1;
    }
    Py_XINCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->func_annotations, value);
    __Pyx_END_CRITICAL_SECTION();
    if (unlikely(__Pyx_CyFunction_set_annotate_in_dict_if_exists((PyObject*) op, Py_None) < 0)) return -1;
    return 0;
}
static int
__Pyx_CyFunction_get_dict_if_exists(PyObject *op_in, PyObject **dict) {
    /* Return 1 if the function dict exists, 0 otherwise.  This cannot fail:
     * _PyObject_GetDictPtr() may clear errors internally, but never reports them. */
#if CYTHON_COMPILING_IN_PYPY
    *dict = PyObject_GenericGetDict(op_in, NULL);
#elif CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX < 0x030C0000
    *dict = ((__pyx_CyFunctionObject*) op_in)->func_dict;
#else
    PyObject **dictptr = _PyObject_GetDictPtr(op_in);
    *dict = likely(dictptr) ? *dictptr : NULL;
#endif
    return *dict ? 1 : 0;
}
static int
__Pyx_CyFunction_get_annotate_from_dict_if_exists(PyObject *op_in, PyObject **annotate) {
    PyObject *dict;
    int dict_found;
    *annotate = NULL;
    dict_found = __Pyx_CyFunction_get_dict_if_exists(op_in, &dict);
    if (!dict_found) return 0;
    return __Pyx_PyDict_GetItemRef(dict, __pyx_mstate_global->__pyx_n_u_annotate, annotate);
}
static int
__Pyx_CyFunction_set_annotate_in_dict_if_exists(PyObject *op_in, PyObject *value) {
    PyObject *dict;
    int dict_found;
    dict_found = __Pyx_CyFunction_get_dict_if_exists(op_in, &dict);
    if (!dict_found) return 0;
    return PyDict_SetItem(dict, __pyx_mstate_global->__pyx_n_u_annotate, value);
}
static int
__Pyx_CyFunction_set_annotate_in_dict(PyObject *op_in, PyObject *value) {
    PyObject *dict;
    int result;
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
    dict = __Pyx_CyFunction_get_dict((__pyx_CyFunctionObject*) op_in, NULL);
#else
    dict = PyObject_GenericGetDict(op_in, NULL);
#endif
    if (unlikely(!dict)) return -1;
    result = PyDict_SetItem(dict, __pyx_mstate_global->__pyx_n_u_annotate, value);
    Py_DECREF(dict);
    return result;
}
static PyObject *
__Pyx_CyFunction_get_annotations_locked(__pyx_CyFunctionObject *op) {
    PyObject* result = op->func_annotations;
    if (unlikely(!result)) {
        result = PyDict_New();
        if (unlikely(!result)) return NULL;
        op->func_annotations = result;
    }
    Py_INCREF(result);
    return result;
}
static PyObject *
__Pyx_CyFunction_get_annotations(PyObject *op_in, void *context) {
    PyObject *annotate = NULL;
    PyObject *result = NULL;
    __pyx_CyFunctionObject *op = (__pyx_CyFunctionObject*) op_in;
    CYTHON_UNUSED_VAR(context);
    __Pyx_BEGIN_CRITICAL_SECTION(op_in);
    result = __Pyx_XNewRef(op->func_annotations);
    __Pyx_END_CRITICAL_SECTION();
    if (result) return result;
    if (unlikely(__Pyx_CyFunction_get_annotate_from_dict_if_exists(op_in, &annotate) < 0)) return NULL;
    if (!annotate || annotate == Py_None) {
        Py_XDECREF(annotate);
        __Pyx_BEGIN_CRITICAL_SECTION(op_in);
        result = __Pyx_CyFunction_get_annotations_locked(op);
        __Pyx_END_CRITICAL_SECTION();
        return result;
    }
    PyObject *format = PyLong_FromLong(1L);  // annotationlib.Format.VALUE
    if (likely(format)) {
        result = __Pyx_PyObject_CallOneArg(annotate, format);
        Py_DECREF(format);
    }
    Py_DECREF(annotate);
    if (unlikely(!result)) return NULL;
    if (unlikely(!PyDict_Check(result))) {
        PyErr_SetString(PyExc_TypeError, "__annotate__ must return a dict");
        Py_DECREF(result);
        return NULL;
    }
    __Pyx_BEGIN_CRITICAL_SECTION(op_in);
    __Pyx_Py_XDECREF_SET(op->func_annotations, __Pyx_NewRef(result));
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static PyObject *__Pyx_CyFunction_annotate_impl(PyObject *self, PyObject *args) {
    CYTHON_UNUSED_VAR(args);
    if (unlikely(!self)) {
        PyErr_SetString(PyExc_SystemError, "cython __annotate__ called without 'self' argument");
    }
    Py_XINCREF(self);
    return self;
}
static PyMethodDef __Pyx_CyFunction_annotate_method = {
    "__annotate__",
    (PyCFunction)(void (*)(void))__Pyx_CyFunction_annotate_impl,
    METH_VARARGS,
    "Placeholder __annotate__ function to allow 'functools.wraps' to work "
    "on Cython functions."
};
static PyObject *
__Pyx_CyFunction_get_annotate(PyObject *op_in, void *context) {
    PyObject *annotate = NULL;
    CYTHON_UNUSED_VAR(context);
    if (unlikely(__Pyx_CyFunction_get_annotate_from_dict_if_exists(op_in, &annotate) < 0)) return NULL;
    if (annotate) return annotate;
    PyObject *annotations = __Pyx_CyFunction_get_annotations(op_in, NULL);
    if (unlikely(!annotations)) return NULL;
    PyObject *method = PyCFunction_New(
        &__Pyx_CyFunction_annotate_method,
        annotations);
    Py_DECREF(annotations);
    return method;
}
static int
__Pyx_CyFunction_set_annotate(PyObject *op_in, PyObject* value, void *context) {
    CYTHON_UNUSED_VAR(context);
    if (value == NULL) {
        PyErr_SetString(PyExc_TypeError, "__annotate__ cannot be deleted");
        return -1;
    }
    if (unlikely(value != Py_None && !PyCallable_Check(value))) {
        PyErr_SetString(PyExc_TypeError, "__annotate__ must be callable or None");
        return -1;
    }
    if (value != Py_None) {
        __pyx_CyFunctionObject *op = (__pyx_CyFunctionObject*) op_in;
        __Pyx_BEGIN_CRITICAL_SECTION(op_in);
        Py_CLEAR(op->func_annotations);
        __Pyx_END_CRITICAL_SECTION();
    }
    return __Pyx_CyFunction_set_annotate_in_dict(op_in, value);
}
static PyObject *
__Pyx_CyFunction_get_is_coroutine_value(__pyx_CyFunctionObject *op) {
    int is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE;
    if (is_coroutine) {
        PyObject *is_coroutine_value, *module, *fromlist, *marker = __pyx_mstate_global->__pyx_n_u_is_coroutine;
        fromlist = PyList_New(1);
        if (unlikely(!fromlist)) return NULL;
        Py_INCREF(marker);
#if CYTHON_ASSUME_SAFE_MACROS
        PyList_SET_ITEM(fromlist, 0, marker);
#else
        if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) {
            Py_DECREF(fromlist);
            return NULL;
        }
#endif
        module = PyImport_ImportModuleLevelObject(__pyx_mstate_global->__pyx_n_u_asyncio_coroutines, NULL, NULL, fromlist, 0);
        Py_DECREF(fromlist);
        if (unlikely(!module)) goto ignore;
        is_coroutine_value = __Pyx_PyObject_GetAttrStr(module, marker);
        Py_DECREF(module);
        if (likely(is_coroutine_value)) {
            return is_coroutine_value;
        }
ignore:
        PyErr_Clear();
    }
    return __Pyx_PyBool_FromLong(is_coroutine);
}
static PyObject *
__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) {
    PyObject *result;
    CYTHON_UNUSED_VAR(context);
    if (op->func_is_coroutine) {
        return __Pyx_NewRef(op->func_is_coroutine);
    }
    result = __Pyx_CyFunction_get_is_coroutine_value(op);
    if (unlikely(!result))
        return NULL;
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    if (op->func_is_coroutine) {
        Py_DECREF(result);
        result = __Pyx_NewRef(op->func_is_coroutine);
    } else {
        op->func_is_coroutine = __Pyx_NewRef(result);
    }
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static void __Pyx_CyFunction_raise_argument_count_error(__pyx_CyFunctionObject *func, const char* message, Py_ssize_t size) {
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL);
    if (!py_name) return;
    PyErr_Format(PyExc_TypeError,
        "%.200S() %s (%" CYTHON_FORMAT_SSIZE_T "d given)",
        py_name, message, size);
    Py_DECREF(py_name);
#else
    const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name;
    PyErr_Format(PyExc_TypeError,
        "%.200s() %s (%" CYTHON_FORMAT_SSIZE_T "d given)",
        name, message, size);
#endif
}
static void __Pyx_CyFunction_raise_type_error(__pyx_CyFunctionObject *func, const char* message) {
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL);
    if (!py_name) return;
    PyErr_Format(PyExc_TypeError,
        "%.200S() %s",
        py_name, message);
    Py_DECREF(py_name);
#else
    const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name;
    PyErr_Format(PyExc_TypeError,
        "%.200s() %s",
        name, message);
#endif
}
#if CYTHON_COMPILING_IN_LIMITED_API
static PyObject *
__Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) {
    CYTHON_UNUSED_VAR(context);
    return PyObject_GetAttrString(op->func, "__module__");
}
static int
__Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
    CYTHON_UNUSED_VAR(context);
    return PyObject_SetAttrString(op->func, "__module__", value);
}
#endif
static PyGetSetDef __pyx_CyFunction_getsets[] = {
    {"func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {"__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {"func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {"__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {"__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
    {"func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0},
    {"__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0},
#else
    {"func_dict", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0},
    {"__dict__", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0},
#endif
    {"func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {"__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {"func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {"__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {"func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {"__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {"func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {"__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {"__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
    {"__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
    {"__annotate__", (getter)__Pyx_CyFunction_get_annotate, (setter)__Pyx_CyFunction_set_annotate, 0, 0},
    {"_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0},
#if CYTHON_COMPILING_IN_LIMITED_API
    {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0},
#endif
    {0, 0, 0, 0, 0}
};
static PyMemberDef __pyx_CyFunction_members[] = {
#if !CYTHON_COMPILING_IN_LIMITED_API
    {"__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0},
#endif
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    {"__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0},
#endif
#if CYTHON_METH_FASTCALL
#if CYTHON_COMPILING_IN_LIMITED_API
    {"__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0},
#else
    {"__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0},
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
    {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0},
#else
    {"__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0},
#endif
#endif
    {0, 0, 0,  0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args)
{
    PyObject *result = NULL;
    CYTHON_UNUSED_VAR(args);
    __Pyx_BEGIN_CRITICAL_SECTION(m);
    Py_INCREF(m->func_qualname);
    result = m->func_qualname;
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
#if CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
#else
#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist)
#endif
static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
                                       PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
#if !CYTHON_COMPILING_IN_LIMITED_API
    PyCFunctionObject *cf = (PyCFunctionObject*) op;
#endif
    if (unlikely(op == NULL))
        return NULL;
#if CYTHON_COMPILING_IN_LIMITED_API
    op->func = PyCFunction_NewEx(ml, (PyObject*)op, module);
    if (unlikely(!op->func)) return NULL;
#endif
    op->flags = flags;
    __Pyx_CyFunction_weakreflist(op) = NULL;
#if !CYTHON_COMPILING_IN_LIMITED_API
    cf->m_ml = ml;
    cf->m_self = (PyObject *) op;
#endif
    Py_XINCREF(closure);
    op->func_closure = closure;
#if !CYTHON_COMPILING_IN_LIMITED_API
    Py_XINCREF(module);
    cf->m_module = module;
#endif
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    op->func_dict = NULL;
#endif
    op->func_name = NULL;
    Py_INCREF(qualname);
    op->func_qualname = qualname;
    op->func_doc = NULL;
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
    op->func_classobj = NULL;
#else
    ((PyCMethodObject*)op)->mm_class = NULL;
#endif
    op->func_globals = globals;
    Py_INCREF(op->func_globals);
    Py_XINCREF(code);
    op->func_code = code;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    op->func_is_coroutine = NULL;
#if CYTHON_METH_FASTCALL
    switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) {
    case METH_NOARGS:
        __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS;
        break;
    case METH_O:
        __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O;
        break;
    case METH_METHOD | METH_FASTCALL | METH_KEYWORDS:
        __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD;
        break;
    case METH_FASTCALL | METH_KEYWORDS:
        __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS;
        break;
    case METH_VARARGS | METH_KEYWORDS:
        __Pyx_CyFunction_func_vectorcall(op) = NULL;
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
        Py_DECREF(op);
        return NULL;
    }
#endif
    return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
    Py_CLEAR(m->func_closure);
#if CYTHON_COMPILING_IN_LIMITED_API
    Py_CLEAR(m->func);
#else
    Py_CLEAR(((PyCFunctionObject*)m)->m_module);
#endif
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    Py_CLEAR(m->func_dict);
#elif PY_VERSION_HEX < 0x030d0000
    _PyObject_ClearManagedDict((PyObject*)m);
#else
    PyObject_ClearManagedDict((PyObject*)m);
#endif
    Py_CLEAR(m->func_name);
    Py_CLEAR(m->func_qualname);
    Py_CLEAR(m->func_doc);
    Py_CLEAR(m->func_globals);
    Py_CLEAR(m->func_code);
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
    Py_CLEAR(__Pyx_CyFunction_GetClassObj(m));
#else
    {
        PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class;
        ((PyCMethodObject *) (m))->mm_class = NULL;
        Py_XDECREF(cls);
    }
#endif
    Py_CLEAR(m->defaults_tuple);
    Py_CLEAR(m->defaults_kwdict);
    Py_CLEAR(m->func_annotations);
    Py_CLEAR(m->func_is_coroutine);
    Py_CLEAR(m->defaults);
    return 0;
}
static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    if (__Pyx_CyFunction_weakreflist(m) != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    __Pyx_PyHeapTypeObject_GC_Del(m);
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    __Pyx__CyFunction_dealloc(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
    {
        int e = __Pyx_call_type_traverse((PyObject*)m, 1, visit, arg);
        if (e) return e;
    }
    Py_VISIT(m->func_closure);
#if CYTHON_COMPILING_IN_LIMITED_API
    Py_VISIT(m->func);
#else
    Py_VISIT(((PyCFunctionObject*)m)->m_module);
#endif
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    Py_VISIT(m->func_dict);
#else
    {
        int e =
#if PY_VERSION_HEX < 0x030d0000
            _PyObject_VisitManagedDict
#else
            PyObject_VisitManagedDict
#endif
                ((PyObject*)m, visit, arg);
        if (e != 0) return e;
    }
#endif
    __Pyx_VISIT_CONST(m->func_name);
    __Pyx_VISIT_CONST(m->func_qualname);
    Py_VISIT(m->func_doc);
    Py_VISIT(m->func_globals);
    __Pyx_VISIT_CONST(m->func_code);
    Py_VISIT(__Pyx_CyFunction_GetClassObj(m));
    Py_VISIT(m->defaults_tuple);
    Py_VISIT(m->defaults_kwdict);
    Py_VISIT(m->func_annotations);
    Py_VISIT(m->func_is_coroutine);
    Py_VISIT(m->defaults);
    return 0;
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
    PyObject *repr;
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    repr = PyUnicode_FromFormat("<cyfunction %U at %p>",
                                op->func_qualname, (void *)op);
    __Pyx_END_CRITICAL_SECTION();
    return repr;
}
static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *f = ((__pyx_CyFunctionObject*)func)->func;
    PyCFunction meth;
    int flags;
    meth = PyCFunction_GetFunction(f);
    if (unlikely(!meth)) return NULL;
    flags = PyCFunction_GetFlags(f);
    if (unlikely(flags < 0)) return NULL;
#else
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = f->m_ml->ml_meth;
    int flags = f->m_ml->ml_flags;
#endif
    Py_ssize_t size;
    switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
    case METH_VARARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0))
            return (*meth)(self, arg);
        break;
    case METH_VARARGS | METH_KEYWORDS:
        return (*(PyCFunctionWithKeywords)(void(*)(void))meth)(self, arg, kw);
    case METH_NOARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
#if CYTHON_ASSUME_SAFE_SIZE
            size = PyTuple_GET_SIZE(arg);
#else
            size = PyTuple_Size(arg);
            if (unlikely(size < 0)) return NULL;
#endif
            if (likely(size == 0))
                return (*meth)(self, NULL);
            __Pyx_CyFunction_raise_argument_count_error(
                (__pyx_CyFunctionObject*)func,
                "takes no arguments", size);
            return NULL;
        }
        break;
    case METH_O:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
#if CYTHON_ASSUME_SAFE_SIZE
            size = PyTuple_GET_SIZE(arg);
#else
            size = PyTuple_Size(arg);
            if (unlikely(size < 0)) return NULL;
#endif
            if (likely(size == 1)) {
                PyObject *result, *arg0;
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                arg0 = PyTuple_GET_ITEM(arg, 0);
                #else
                arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
                #endif
                result = (*meth)(self, arg0);
                #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
                Py_DECREF(arg0);
                #endif
                return result;
            }
            __Pyx_CyFunction_raise_argument_count_error(
                (__pyx_CyFunctionObject*)func,
                "takes exactly one argument", size);
            return NULL;
        }
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
        return NULL;
    }
    __Pyx_CyFunction_raise_type_error(
        (__pyx_CyFunctionObject*)func, "takes no keyword arguments");
    return NULL;
}
static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *self, *result;
#if CYTHON_COMPILING_IN_LIMITED_API
    self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func);
    if (unlikely(!self) && PyErr_Occurred()) return NULL;
#else
    self = ((PyCFunctionObject*)func)->m_self;
#endif
    result = __Pyx_CyFunction_CallMethod(func, self, arg, kw);
    return result;
}
static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
    PyObject *result;
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
     __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc);
    if (vc) {
#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE
        return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw);
#else
        (void) &__Pyx_PyVectorcall_FastCallDict;
        return PyVectorcall_Call(func, args, kw);
#endif
    }
#endif
    if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
        Py_ssize_t argc;
        PyObject *new_args;
        PyObject *self;
#if CYTHON_ASSUME_SAFE_SIZE
        argc = PyTuple_GET_SIZE(args);
#else
        argc = PyTuple_Size(args);
        if (unlikely(argc < 0)) return NULL;
#endif
        new_args = PyTuple_GetSlice(args, 1, argc);
        if (unlikely(!new_args))
            return NULL;
        self = PyTuple_GetItem(args, 0);
        if (unlikely(!self)) {
            Py_DECREF(new_args);
            PyErr_Format(PyExc_TypeError,
                         "unbound method %.200S() needs an argument",
                         cyfunc->func_qualname);
            return NULL;
        }
        result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
        Py_DECREF(new_args);
    } else {
        result = __Pyx_CyFunction_Call(func, args, kw);
    }
    return result;
}
#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames)
{
    int ret = 0;
    if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
        if (unlikely(nargs < 1)) {
            __Pyx_CyFunction_raise_type_error(
                cyfunc, "needs an argument");
            return -1;
        }
        ret = 1;
    }
    if (unlikely(kwnames) && unlikely(__Pyx_PyTuple_GET_SIZE(kwnames))) {
        __Pyx_CyFunction_raise_type_error(
            cyfunc, "takes no keyword arguments");
        return -1;
    }
    return ret;
}
static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
{
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
    PyObject *self;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
    if (unlikely(!meth)) return NULL;
#else
    PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
#endif
    switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
    case 1:
        self = args[0];
        args += 1;
        nargs -= 1;
        break;
    case 0:
#if CYTHON_COMPILING_IN_LIMITED_API
        self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
        if (unlikely(!self) && PyErr_Occurred()) return NULL;
#else
        self = ((PyCFunctionObject*)cyfunc)->m_self;
#endif
        break;
    default:
        return NULL;
    }
    if (unlikely(nargs != 0)) {
        __Pyx_CyFunction_raise_argument_count_error(
            cyfunc, "takes no arguments", nargs);
        return NULL;
    }
    return meth(self, NULL);
}
static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
{
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
    PyObject *self;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
    if (unlikely(!meth)) return NULL;
#else
    PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
#endif
    switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
    case 1:
        self = args[0];
        args += 1;
        nargs -= 1;
        break;
    case 0:
#if CYTHON_COMPILING_IN_LIMITED_API
        self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
        if (unlikely(!self) && PyErr_Occurred()) return NULL;
#else
        self = ((PyCFunctionObject*)cyfunc)->m_self;
#endif
        break;
    default:
        return NULL;
    }
    if (unlikely(nargs != 1)) {
        __Pyx_CyFunction_raise_argument_count_error(
            cyfunc, "takes exactly one argument", nargs);
        return NULL;
    }
    return meth(self, args[0]);
}
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
{
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
    PyObject *self;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
    if (unlikely(!meth)) return NULL;
#else
    PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
#endif
    switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
    case 1:
        self = args[0];
        args += 1;
        nargs -= 1;
        break;
    case 0:
#if CYTHON_COMPILING_IN_LIMITED_API
        self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
        if (unlikely(!self) && PyErr_Occurred()) return NULL;
#else
        self = ((PyCFunctionObject*)cyfunc)->m_self;
#endif
        break;
    default:
        return NULL;
    }
    return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))meth)(self, args, nargs, kwnames);
}
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
{
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
    PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc);
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
    PyObject *self;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
    if (unlikely(!meth)) return NULL;
#else
    PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
#endif
    switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
    case 1:
        self = args[0];
        args += 1;
        nargs -= 1;
        break;
    case 0:
#if CYTHON_COMPILING_IN_LIMITED_API
        self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
        if (unlikely(!self) && PyErr_Occurred()) return NULL;
#else
        self = ((PyCFunctionObject*)cyfunc)->m_self;
#endif
        break;
    default:
        return NULL;
    }
    #if PY_VERSION_HEX < 0x030e00A6
    size_t nargs_value = (size_t) nargs;
    #else
    Py_ssize_t nargs_value = nargs;
    #endif
    return ((__Pyx_PyCMethod)(void(*)(void))meth)(self, cls, args, nargs_value, kwnames);
}
#endif
static PyType_Slot __pyx_CyFunctionType_slots[] = {
    {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc},
    {Py_tp_repr, (void *)__Pyx_CyFunction_repr},
    {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod},
    {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse},
    {Py_tp_clear, (void *)__Pyx_CyFunction_clear},
    {Py_tp_methods, (void *)__pyx_CyFunction_methods},
    {Py_tp_members, (void *)__pyx_CyFunction_members},
    {Py_tp_getset, (void *)__pyx_CyFunction_getsets},
    {Py_tp_descr_get, (void *)__Pyx_PyMethod_New},
    {0, 0},
};
static PyType_Spec __pyx_CyFunctionType_spec = {
    __PYX_TYPE_MODULE_PREFIX "cython_function_or_method",
    sizeof(__pyx_CyFunctionObject),
    0,
#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR
    Py_TPFLAGS_METHOD_DESCRIPTOR |
#endif
#if CYTHON_METH_FASTCALL
#if defined(Py_TPFLAGS_HAVE_VECTORCALL)
    Py_TPFLAGS_HAVE_VECTORCALL |
#elif defined(_Py_TPFLAGS_HAVE_VECTORCALL)
    _Py_TPFLAGS_HAVE_VECTORCALL |
#endif
#endif // CYTHON_METH_FASTCALL
#if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_TPFLAGS_MANAGED_DICT |
#endif
    Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION |
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
    __pyx_CyFunctionType_slots
};
static int __pyx_CyFunction_init(PyObject *module) {
    __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module);
    mstate->__pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(
        mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_CyFunctionType_spec, NULL);
    if (unlikely(mstate->__pyx_CyFunctionType == NULL)) {
        return -1;
    }
    return 0;
}
static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, PyTypeObject *defaults_type) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults = PyObject_CallObject((PyObject*)defaults_type, NULL); // _PyObject_New(defaults_type);
    if (unlikely(!m->defaults))
        return NULL;
    return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_tuple = tuple;
    Py_INCREF(tuple);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_kwdict = dict;
    Py_INCREF(dict);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->func_annotations = dict;
    Py_INCREF(dict);
}

/* CythonFunction */
static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    PyObject *op = __Pyx_CyFunction_Init(
        PyObject_GC_New(__pyx_CyFunctionObject, __pyx_mstate_global->__pyx_CyFunctionType),
        ml, flags, qualname, closure, module, globals, code
    );
    if (likely(op)) {
        PyObject_GC_Track(op);
    }
    return op;
}

/* Py3UpdateBases */
static PyObject*
__Pyx_PEP560_update_bases(PyObject *bases)
{
    Py_ssize_t i, j, size_bases;
    PyObject *base = NULL, *meth, *new_base, *result, *new_bases = NULL;
#if CYTHON_ASSUME_SAFE_SIZE
    size_bases = PyTuple_GET_SIZE(bases);
#else
    size_bases = PyTuple_Size(bases);
    if (size_bases < 0) return NULL;
#endif
    for (i = 0; i < size_bases; i++) {
#if CYTHON_AVOID_BORROWED_REFS
        Py_CLEAR(base);
#endif
#if CYTHON_ASSUME_SAFE_MACROS
        base = PyTuple_GET_ITEM(bases, i);
#else
        base = PyTuple_GetItem(bases, i);
        if (!base) goto error;
#endif
#if CYTHON_AVOID_BORROWED_REFS
        Py_INCREF(base);
#endif
        if (PyType_Check(base)) {
            if (new_bases) {
                if (PyList_Append(new_bases, base) < 0) {
                    goto error;
                }
            }
            continue;
        }
        meth = __Pyx_PyObject_GetAttrStrNoError(base, __pyx_mstate_global->__pyx_n_u_mro_entries);
        if (!meth && PyErr_Occurred()) {
            goto error;
        }
        if (!meth) {
            if (new_bases) {
                if (PyList_Append(new_bases, base) < 0) {
                    goto error;
                }
            }
            continue;
        }
        new_base = __Pyx_PyObject_CallOneArg(meth, bases);
        Py_DECREF(meth);
        if (!new_base) {
            goto error;
        }
        if (!PyTuple_Check(new_base)) {
            PyErr_SetString(PyExc_TypeError,
                            "__mro_entries__ must return a tuple");
            Py_DECREF(new_base);
            goto error;
        }
        if (!new_bases) {
            if (!(new_bases = PyList_New(i))) {
                goto error;
            }
            for (j = 0; j < i; j++) {
                PyObject *base_from_list;
#if CYTHON_ASSUME_SAFE_MACROS
                base_from_list = PyTuple_GET_ITEM(bases, j);
                PyList_SET_ITEM(new_bases, j, base_from_list);
                Py_INCREF(base_from_list);
#else
                base_from_list = PyTuple_GetItem(bases, j);
                if (!base_from_list) goto error;
                Py_INCREF(base_from_list);
                if (PyList_SetItem(new_bases, j, base_from_list) < 0) goto error;
#endif
            }
        }
#if CYTHON_ASSUME_SAFE_SIZE
        j = PyList_GET_SIZE(new_bases);
#else
        j = PyList_Size(new_bases);
        if (j < 0) goto error;
#endif
        if (PyList_SetSlice(new_bases, j, j, new_base) < 0) {
            goto error;
        }
        Py_DECREF(new_base);
    }
    if (!new_bases) {
        Py_INCREF(bases);
        return bases;
    }
    result = PyList_AsTuple(new_bases);
    Py_DECREF(new_bases);
#if CYTHON_AVOID_BORROWED_REFS
    Py_XDECREF(base);
#endif
    return result;
error:
    Py_XDECREF(new_bases);
#if CYTHON_AVOID_BORROWED_REFS
    Py_XDECREF(base);
#endif
    return NULL;
}

/* CalculateMetaclass */
static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
    Py_ssize_t i, nbases;
#if CYTHON_ASSUME_SAFE_SIZE
    nbases = PyTuple_GET_SIZE(bases);
#else
    nbases = PyTuple_Size(bases);
    if (nbases < 0) return NULL;
#endif
    for (i=0; i < nbases; i++) {
        PyTypeObject *tmptype;
#if CYTHON_ASSUME_SAFE_MACROS
        PyObject *tmp = PyTuple_GET_ITEM(bases, i);
#else
        PyObject *tmp = PyTuple_GetItem(bases, i);
        if (!tmp) return NULL;
#endif
        tmptype = Py_TYPE(tmp);
        if (!metaclass) {
            metaclass = tmptype;
            continue;
        }
        if (PyType_IsSubtype(metaclass, tmptype))
            continue;
        if (PyType_IsSubtype(tmptype, metaclass)) {
            metaclass = tmptype;
            continue;
        }
        PyErr_SetString(PyExc_TypeError,
                        "metaclass conflict: "
                        "the metaclass of a derived class "
                        "must be a (non-strict) subclass "
                        "of the metaclasses of all its bases");
        return NULL;
    }
    if (!metaclass) {
        metaclass = &PyType_Type;
    }
    Py_INCREF((PyObject*) metaclass);
    return (PyObject*) metaclass;
}

/* Py3ClassCreate */
static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
                                           PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
    PyObject *ns;
    if (metaclass) {
        PyObject *prep = __Pyx_PyObject_GetAttrStrNoError(metaclass, __pyx_mstate_global->__pyx_n_u_prepare);
        if (prep) {
            PyObject *pargs[3] = {NULL, name, bases};
            ns = __Pyx_PyObject_FastCallDict(prep, pargs+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, mkw);
            Py_DECREF(prep);
        } else {
            if (unlikely(PyErr_Occurred()))
                return NULL;
            ns = PyDict_New();
        }
    } else {
        ns = PyDict_New();
    }
    if (unlikely(!ns))
        return NULL;
    if (unlikely(PyObject_SetItem(ns, __pyx_mstate_global->__pyx_n_u_module, modname) < 0)) goto bad;
    if (unlikely(PyObject_SetItem(ns, __pyx_mstate_global->__pyx_n_u_qualname, qualname) < 0)) goto bad;
    if (unlikely(doc && PyObject_SetItem(ns, __pyx_mstate_global->__pyx_n_u_doc, doc) < 0)) goto bad;
    return ns;
bad:
    Py_DECREF(ns);
    return NULL;
}
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
                                      PyObject *dict, PyObject *mkw,
                                      int calculate_metaclass, int allow_py2_metaclass) {
    PyObject *result;
    PyObject *owned_metaclass = NULL;
    PyObject *margs[4] = {NULL, name, bases, dict};
    if (allow_py2_metaclass) {
        owned_metaclass = PyObject_GetItem(dict, __pyx_mstate_global->__pyx_n_u_metaclass);
        if (owned_metaclass) {
            metaclass = owned_metaclass;
        } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
            PyErr_Clear();
        } else {
            return NULL;
        }
    }
    if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
        metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
        Py_XDECREF(owned_metaclass);
        if (unlikely(!metaclass))
            return NULL;
        owned_metaclass = metaclass;
    }
    result = __Pyx_PyObject_FastCallDict(metaclass, margs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, mkw);
    Py_XDECREF(owned_metaclass);
    return result;
}

/* CLineInTraceback (used by AddTraceback) */
#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
#define __Pyx_PyProbablyModule_GetDict(o) __Pyx_XNewRef(PyModule_GetDict(o))
#elif !CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#define __Pyx_PyProbablyModule_GetDict(o) PyObject_GenericGetDict(o, NULL);
#else
PyObject* __Pyx_PyProbablyModule_GetDict(PyObject *o) {
    PyObject **dict_ptr = _PyObject_GetDictPtr(o);
    return dict_ptr ? __Pyx_XNewRef(*dict_ptr) : NULL;
}
#endif
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
    PyObject *use_cline = NULL;
    PyObject *ptype, *pvalue, *ptraceback;
    PyObject *cython_runtime_dict;
    CYTHON_MAYBE_UNUSED_VAR(tstate);
    if (unlikely(!__pyx_mstate_global->__pyx_cython_runtime)) {
        return c_line;
    }
    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
    cython_runtime_dict = __Pyx_PyProbablyModule_GetDict(__pyx_mstate_global->__pyx_cython_runtime);
    if (likely(cython_runtime_dict)) {
        __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
            use_cline, cython_runtime_dict,
            __Pyx_PyDict_SetDefault(cython_runtime_dict, __pyx_mstate_global->__pyx_n_u_cline_in_traceback, Py_False))
    }
    if (use_cline == NULL || use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
        c_line = 0;
    }
    Py_XDECREF(use_cline);
    Py_XDECREF(cython_runtime_dict);
    __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
    return c_line;
}
#endif

/* CodeObjectCache (used by AddTraceback) */
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = start + (end - start) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static __Pyx_CachedCodeObjectType *__pyx__find_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line) {
    __Pyx_CachedCodeObjectType* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!code_cache->entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line);
    if (unlikely(pos >= code_cache->count) || unlikely(code_cache->entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = code_cache->entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line) {
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS
    (void)__pyx__find_code_object;
    return NULL; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just miss.
#else
    struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache;
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    __pyx_nonatomic_int_type old_count = __pyx_atomic_incr_acq_rel(&code_cache->accessor_count);
    if (old_count < 0) {
        __pyx_atomic_decr_acq_rel(&code_cache->accessor_count);
        return NULL;
    }
#endif
    __Pyx_CachedCodeObjectType *result = __pyx__find_code_object(code_cache, code_line);
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    __pyx_atomic_decr_acq_rel(&code_cache->accessor_count);
#endif
    return result;
#endif
}
static void __pyx__insert_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line, __Pyx_CachedCodeObjectType* code_object)
{
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = code_cache->entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            code_cache->entries = entries;
            code_cache->max_count = 64;
            code_cache->count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line);
    if ((pos < code_cache->count) && unlikely(code_cache->entries[pos].code_line == code_line)) {
        __Pyx_CachedCodeObjectType* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_INCREF(code_object);
        Py_DECREF(tmp);
        return;
    }
    if (code_cache->count == code_cache->max_count) {
        int new_max = code_cache->max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            code_cache->entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        code_cache->entries = entries;
        code_cache->max_count = new_max;
    }
    for (i=code_cache->count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    code_cache->count++;
    Py_INCREF(code_object);
}
static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object) {
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS
    (void)__pyx__insert_code_object;
    return; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just fail.
#else
    struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache;
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    __pyx_nonatomic_int_type expected = 0;
    if (!__pyx_atomic_int_cmp_exchange(&code_cache->accessor_count, &expected, INT_MIN)) {
        return;
    }
#endif
    __pyx__insert_code_object(code_cache, code_line, code_object);
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    __pyx_atomic_sub(&code_cache->accessor_count, INT_MIN);
#endif
#endif
}

/* AddTraceback */
#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION)
  #ifndef Py_BUILD_CORE
    #define Py_BUILD_CORE 1
  #endif
  #include "internal/pycore_frame.h"
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict,
                                                       PyObject *firstlineno, PyObject *name) {
    PyObject *replace = NULL;
    if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL;
    if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL;
    replace = PyObject_GetAttrString(code, "replace");
    if (likely(replace)) {
        PyObject *result = PyObject_Call(replace, __pyx_mstate_global->__pyx_empty_tuple, scratch_dict);
        Py_DECREF(replace);
        return result;
    }
    PyErr_Clear();
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL;
    PyObject *replace = NULL, *getframe = NULL, *frame = NULL;
    PyObject *exc_type, *exc_value, *exc_traceback;
    int success = 0;
    if (c_line) {
        c_line = __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line);
    }
    PyErr_Fetch(&exc_type, &exc_value, &exc_traceback);
    code_object = __pyx_find_code_object(c_line ? -c_line : py_line);
    if (!code_object) {
        code_object = Py_CompileString("_getframe()", filename, Py_eval_input);
        if (unlikely(!code_object)) goto bad;
        py_py_line = PyLong_FromLong(py_line);
        if (unlikely(!py_py_line)) goto bad;
        if (c_line) {
            py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        } else {
            py_funcname = PyUnicode_FromString(funcname);
        }
        if (unlikely(!py_funcname)) goto bad;
        dict = PyDict_New();
        if (unlikely(!dict)) goto bad;
        {
            PyObject *old_code_object = code_object;
            code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname);
            Py_DECREF(old_code_object);
        }
        if (unlikely(!code_object)) goto bad;
        __pyx_insert_code_object(c_line ? -c_line : py_line, code_object);
    } else {
        dict = PyDict_New();
    }
    getframe = PySys_GetObject("_getframe");
    if (unlikely(!getframe)) goto bad;
    if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad;
    frame = PyEval_EvalCode(code_object, dict, dict);
    if (unlikely(!frame) || frame == Py_None) goto bad;
    success = 1;
  bad:
    PyErr_Restore(exc_type, exc_value, exc_traceback);
    Py_XDECREF(code_object);
    Py_XDECREF(py_py_line);
    Py_XDECREF(py_funcname);
    Py_XDECREF(dict);
    Py_XDECREF(replace);
    if (success) {
        PyTraceBack_Here(
            (struct _frame*)frame);
    }
    Py_XDECREF(frame);
}
#else
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = NULL;
    PyObject *py_funcname = NULL;
    if (c_line) {
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        if (!py_funcname) goto bad;
        funcname = PyUnicode_AsUTF8(py_funcname);
        if (!funcname) goto bad;
    }
    py_code = PyCode_NewEmpty(filename, funcname, py_line);
    Py_XDECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject *ptype, *pvalue, *ptraceback;
    if (c_line) {
        c_line = __Pyx_CLineForTraceback(tstate, c_line);
    }
    py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
    if (!py_code) {
        __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) {
            /* If the code object creation fails, then we should clear the
               fetched exception references and propagate the new exception */
            Py_XDECREF(ptype);
            Py_XDECREF(pvalue);
            Py_XDECREF(ptraceback);
            goto bad;
        }
        __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
        __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
    }
    py_frame = PyFrame_New(
        tstate,            /*PyThreadState *tstate,*/
        py_code,           /*PyCodeObject *code,*/
        __pyx_mstate_global->__pyx_d,    /*PyObject *globals,*/
        0                  /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}
#endif

/* MemviewRefcount */
#include <stdio.h>
#ifndef _Py_NO_RETURN
#define _Py_NO_RETURN
#endif
_Py_NO_RETURN
static void __pyx_fatalerror(const char *fmt, ...) {
    va_list vargs;
    char msg[200];
#if PY_VERSION_HEX >= 0x030A0000 || defined(HAVE_STDARG_PROTOTYPES)
    va_start(vargs, fmt);
#else
    va_start(vargs);
#endif
    vsnprintf(msg, 200, fmt, vargs);
    va_end(vargs);
    Py_FatalError(msg);
}
static CYTHON_INLINE int
__pyx_add_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count,
                                   PyThread_type_lock lock)
{
    int result;
    PyThread_acquire_lock(lock, 1);
    result = (*acquisition_count)++;
    PyThread_release_lock(lock);
    return result;
}
static CYTHON_INLINE int
__pyx_sub_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count,
                                   PyThread_type_lock lock)
{
    int result;
    PyThread_acquire_lock(lock, 1);
    result = (*acquisition_count)--;
    PyThread_release_lock(lock);
    return result;
}
static CYTHON_INLINE void
__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno)
{
    __pyx_nonatomic_int_type old_acquisition_count;
    struct __pyx_memoryview_obj *memview = memslice->memview;
    if (unlikely(!memview || (PyObject *) memview == Py_None)) {
        return;
    }
    old_acquisition_count = __pyx_add_acquisition_count(memview);
    if (unlikely(old_acquisition_count <= 0)) {
        if (likely(old_acquisition_count == 0)) {
            if (have_gil) {
                Py_INCREF((PyObject *) memview);
            } else {
                PyGILState_STATE _gilstate = PyGILState_Ensure();
                Py_INCREF((PyObject *) memview);
                PyGILState_Release(_gilstate);
            }
        } else {
            __pyx_fatalerror("Acquisition count is %d (line %d)",
                             old_acquisition_count+1, lineno);
        }
    }
}
static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice,
                                             int have_gil, int lineno) {
    __pyx_nonatomic_int_type old_acquisition_count;
    struct __pyx_memoryview_obj *memview = memslice->memview;
    if (unlikely(!memview || (PyObject *) memview == Py_None)) {
        memslice->memview = NULL;
        return;
    }
    old_acquisition_count = __pyx_sub_acquisition_count(memview);
    memslice->data = NULL;
    if (likely(old_acquisition_count > 1)) {
        memslice->memview = NULL;
    } else if (likely(old_acquisition_count == 1)) {
        if (have_gil) {
            Py_CLEAR(memslice->memview);
        } else {
            PyGILState_STATE _gilstate = PyGILState_Ensure();
            Py_CLEAR(memslice->memview);
            PyGILState_Release(_gilstate);
        }
    } else {
        __pyx_fatalerror("Acquisition count is %d (line %d)",
                         old_acquisition_count-1, lineno);
    }
}

/* MemviewSliceIsContig */
static int
__pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim)
{
    int i, index, step, start;
    Py_ssize_t itemsize = mvs.memview->view.itemsize;
    if (order == 'F') {
        step = 1;
        start = 0;
    } else {
        step = -1;
        start = ndim - 1;
    }
    for (i = 0; i < ndim; i++) {
        index = start + step * i;
        if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
            return 0;
        itemsize *= mvs.shape[index];
    }
    return 1;
}

/* OverlappingSlices */
static void
__pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
                               void **out_start, void **out_end,
                               int ndim, size_t itemsize)
{
    char *start, *end;
    int i;
    start = end = slice->data;
    for (i = 0; i < ndim; i++) {
        Py_ssize_t stride = slice->strides[i];
        Py_ssize_t extent = slice->shape[i];
        if (extent == 0) {
            *out_start = *out_end = start;
            return;
        } else {
            if (stride > 0)
                end += stride * (extent - 1);
            else
                start += stride * (extent - 1);
        }
    }
    *out_start = start;
    *out_end = end + itemsize;
}
static int
__pyx_slices_overlap(__Pyx_memviewslice *slice1,
                     __Pyx_memviewslice *slice2,
                     int ndim, size_t itemsize)
{
    void *start1, *end1, *start2, *end2;
    __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
    __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
    return (start1 < end2) && (start2 < end1);
}

/* MemviewSliceInit */
static int
__Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
                        int ndim,
                        __Pyx_memviewslice *memviewslice,
                        int memview_is_new_reference)
{
    __Pyx_RefNannyDeclarations
    int i, retval=-1;
    Py_buffer *buf = &memview->view;
    __Pyx_RefNannySetupContext("init_memviewslice", 0);
    if (unlikely(memviewslice->memview || memviewslice->data)) {
        PyErr_SetString(PyExc_ValueError,
            "memviewslice is already initialized!");
        goto fail;
    }
    if (buf->strides) {
        for (i = 0; i < ndim; i++) {
            memviewslice->strides[i] = buf->strides[i];
        }
    } else {
        Py_ssize_t stride = buf->itemsize;
        for (i = ndim - 1; i >= 0; i--) {
            memviewslice->strides[i] = stride;
            stride *= buf->shape[i];
        }
    }
    for (i = 0; i < ndim; i++) {
        memviewslice->shape[i]   = buf->shape[i];
        if (buf->suboffsets) {
            memviewslice->suboffsets[i] = buf->suboffsets[i];
        } else {
            memviewslice->suboffsets[i] = -1;
        }
    }
    memviewslice->memview = memview;
    memviewslice->data = (char *)buf->buf;
    if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
        Py_INCREF((PyObject*)memview);
    }
    retval = 0;
    goto no_fail;
fail:
    memviewslice->memview = 0;
    memviewslice->data = 0;
    retval = -1;
no_fail:
    __Pyx_RefNannyFinishContext();
    return retval;
}

/* CIntFromPyVerify */
#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
    {\
        func_type value = func_value;\
        if (sizeof(target_type) < sizeof(func_type)) {\
            if (unlikely(value != (func_type) (target_type) value)) {\
                func_type zero = 0;\
                if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
                    return (target_type) -1;\
                if (is_unsigned && unlikely(value < zero))\
                    goto raise_neg_overflow;\
                else\
                    goto raise_overflow;\
            }\
        }\
        return (target_type) value;\
    }

static PyObject* __pyx_convert__to_py_CK_VERSION(CK_VERSION s) {
  PyObject* res;
  PyObject* member;
  res = __Pyx_PyDict_NewPresized(2); if (unlikely(!res)) return NULL;
  member = __Pyx_PyLong_From_CK_BYTE(s.major); if (unlikely(!member)) goto bad;
  if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_major, member) < 0)) goto bad;
  Py_DECREF(member);
  member = __Pyx_PyLong_From_CK_BYTE(s.minor); if (unlikely(!member)) goto bad;
  if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_minor, member) < 0)) goto bad;
  Py_DECREF(member);
  return res;
  bad:
  Py_XDECREF(member);
  Py_DECREF(res);
  return NULL;
}
/* IsLittleEndian (used by BufferFormatCheck) */
static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
{
  union {
    uint32_t u32;
    uint8_t u8[4];
  } S;
  S.u32 = 0x01020304;
  return S.u8[0] == 4;
}

/* BufferFormatCheck (used by MemviewSliceValidateAndInit) */
static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
                              __Pyx_BufFmt_StackElem* stack,
                              const __Pyx_TypeInfo* type) {
  stack[0].field = &ctx->root;
  stack[0].parent_offset = 0;
  ctx->root.type = type;
  ctx->root.name = "buffer dtype";
  ctx->root.offset = 0;
  ctx->head = stack;
  ctx->head->field = &ctx->root;
  ctx->fmt_offset = 0;
  ctx->head->parent_offset = 0;
  ctx->new_packmode = '@';
  ctx->enc_packmode = '@';
  ctx->new_count = 1;
  ctx->enc_count = 0;
  ctx->enc_type = 0;
  ctx->is_complex = 0;
  ctx->is_valid_array = 0;
  ctx->struct_alignment = 0;
  while (type->typegroup == 'S') {
    ++ctx->head;
    ctx->head->field = type->fields;
    ctx->head->parent_offset = 0;
    type = type->fields->type;
  }
}
static int __Pyx_BufFmt_ParseNumber(const char** ts) {
    int count;
    const char* t = *ts;
    if (*t < '0' || *t > '9') {
      return -1;
    } else {
        count = *t++ - '0';
        while (*t >= '0' && *t <= '9') {
            count *= 10;
            count += *t++ - '0';
        }
    }
    *ts = t;
    return count;
}
static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
    int number = __Pyx_BufFmt_ParseNumber(ts);
    if (number == -1)
        PyErr_Format(PyExc_ValueError,\
                     "Does not understand character buffer dtype format string ('%c')", **ts);
    return number;
}
static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
  PyErr_Format(PyExc_ValueError,
               "Unexpected format string character: '%c'", ch);
}
static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
  switch (ch) {
    case '?': return "'bool'";
    case 'c': return "'char'";
    case 'b': return "'signed char'";
    case 'B': return "'unsigned char'";
    case 'h': return "'short'";
    case 'H': return "'unsigned short'";
    case 'i': return "'int'";
    case 'I': return "'unsigned int'";
    case 'l': return "'long'";
    case 'L': return "'unsigned long'";
    case 'q': return "'long long'";
    case 'Q': return "'unsigned long long'";
    case 'f': return (is_complex ? "'complex float'" : "'float'");
    case 'd': return (is_complex ? "'complex double'" : "'double'");
    case 'g': return (is_complex ? "'complex long double'" : "'long double'");
    case 'T': return "a struct";
    case 'O': return "Python object";
    case 'P': return "a pointer";
    case 's': case 'p': return "a string";
    case 0: return "end";
    default: return "unparsable format string";
  }
}
static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return 2;
    case 'i': case 'I': case 'l': case 'L': return 4;
    case 'q': case 'Q': return 8;
    case 'f': return (is_complex ? 8 : 4);
    case 'd': return (is_complex ? 16 : 8);
    case 'g': {
      PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
      return 0;
    }
    case 'O': case 'P': return sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}
static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return sizeof(short);
    case 'i': case 'I': return sizeof(int);
    case 'l': case 'L': return sizeof(long);
    case 'q': case 'Q': return sizeof(PY_LONG_LONG);
    case 'f': return sizeof(float) * (is_complex ? 2 : 1);
    case 'd': return sizeof(double) * (is_complex ? 2 : 1);
    case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
    case 'O': case 'P': return sizeof(void*);
    default: {
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
  }
}
typedef struct { char c; short x; } __Pyx_st_short;
typedef struct { char c; int x; } __Pyx_st_int;
typedef struct { char c; long x; } __Pyx_st_long;
typedef struct { char c; float x; } __Pyx_st_float;
typedef struct { char c; double x; } __Pyx_st_double;
typedef struct { char c; long double x; } __Pyx_st_longdouble;
typedef struct { char c; void *x; } __Pyx_st_void_p;
typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) {
  CYTHON_UNUSED_VAR(is_complex);
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
    case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
    case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
    case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
    case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
    case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
    case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
    case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}
/* These are for computing the padding at the end of the struct to align
   on the first member of the struct. This will probably the same as above,
   but we don't have any guarantees.
 */
typedef struct { short x; char c; } __Pyx_pad_short;
typedef struct { int x; char c; } __Pyx_pad_int;
typedef struct { long x; char c; } __Pyx_pad_long;
typedef struct { float x; char c; } __Pyx_pad_float;
typedef struct { double x; char c; } __Pyx_pad_double;
typedef struct { long double x; char c; } __Pyx_pad_longdouble;
typedef struct { void *x; char c; } __Pyx_pad_void_p;
typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, int is_complex) {
  CYTHON_UNUSED_VAR(is_complex);
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
    case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
    case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
    case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
    case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
    case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
    case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
    case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}
static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
  switch (ch) {
    case 'c':
        return 'H';
    case 'b': case 'h': case 'i':
    case 'l': case 'q': case 's': case 'p':
        return 'I';
    case '?': case 'B': case 'H': case 'I': case 'L': case 'Q':
        return 'U';
    case 'f': case 'd': case 'g':
        return (is_complex ? 'C' : 'R');
    case 'O':
        return 'O';
    case 'P':
        return 'P';
    default: {
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
  }
}
static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
  if (ctx->head == NULL || ctx->head->field == &ctx->root) {
    const char* expected;
    const char* quote;
    if (ctx->head == NULL) {
      expected = "end";
      quote = "";
    } else {
      expected = ctx->head->field->type->name;
      quote = "'";
    }
    PyErr_Format(PyExc_ValueError,
                 "Buffer dtype mismatch, expected %s%s%s but got %s",
                 quote, expected, quote,
                 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
  } else {
    const __Pyx_StructField* field = ctx->head->field;
    const __Pyx_StructField* parent = (ctx->head - 1)->field;
    PyErr_Format(PyExc_ValueError,
                 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
                 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
                 parent->type->name, field->name);
  }
}
static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
  char group;
  size_t size, offset, arraysize = 1;
  if (ctx->enc_type == 0) return 0;
  if (ctx->head->field->type->arraysize[0]) {
    int i, ndim = 0;
    if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
        ctx->is_valid_array = ctx->head->field->type->ndim == 1;
        ndim = 1;
        if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
            PyErr_Format(PyExc_ValueError,
                         "Expected a dimension of size %zu, got %zu",
                         ctx->head->field->type->arraysize[0], ctx->enc_count);
            return -1;
        }
    }
    if (!ctx->is_valid_array) {
      PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
                   ctx->head->field->type->ndim, ndim);
      return -1;
    }
    for (i = 0; i < ctx->head->field->type->ndim; i++) {
      arraysize *= ctx->head->field->type->arraysize[i];
    }
    ctx->is_valid_array = 0;
    ctx->enc_count = 1;
  }
  group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
  do {
    const __Pyx_StructField* field = ctx->head->field;
    const __Pyx_TypeInfo* type = field->type;
    if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
      size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
    } else {
      size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
    }
    if (ctx->enc_packmode == '@') {
      size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
      size_t align_mod_offset;
      if (align_at == 0) return -1;
      align_mod_offset = ctx->fmt_offset % align_at;
      if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
      if (ctx->struct_alignment == 0)
          ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
                                                                 ctx->is_complex);
    }
    if (type->size != size || type->typegroup != group) {
      if (type->typegroup == 'C' && type->fields != NULL) {
        size_t parent_offset = ctx->head->parent_offset + field->offset;
        ++ctx->head;
        ctx->head->field = type->fields;
        ctx->head->parent_offset = parent_offset;
        continue;
      }
      if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
      } else {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return -1;
      }
    }
    offset = ctx->head->parent_offset + field->offset;
    if (ctx->fmt_offset != offset) {
      PyErr_Format(PyExc_ValueError,
                   "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
                   (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
      return -1;
    }
    ctx->fmt_offset += size;
    if (arraysize)
      ctx->fmt_offset += (arraysize - 1) * size;
    --ctx->enc_count;
    while (1) {
      if (field == &ctx->root) {
        ctx->head = NULL;
        if (ctx->enc_count != 0) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return -1;
        }
        break;
      }
      ctx->head->field = ++field;
      if (field->type == NULL) {
        --ctx->head;
        field = ctx->head->field;
        continue;
      } else if (field->type->typegroup == 'S') {
        size_t parent_offset = ctx->head->parent_offset + field->offset;
        if (field->type->fields->type == NULL) continue;
        field = field->type->fields;
        ++ctx->head;
        ctx->head->field = field;
        ctx->head->parent_offset = parent_offset;
        break;
      } else {
        break;
      }
    }
  } while (ctx->enc_count);
  ctx->enc_type = 0;
  ctx->is_complex = 0;
  return 0;
}
static int
__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
{
    const char *ts = *tsp;
    int i = 0, number, ndim;
    ++ts;
    if (ctx->new_count != 1) {
        PyErr_SetString(PyExc_ValueError,
                        "Cannot handle repeated arrays in format string");
        return -1;
    }
    if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return -1;
    ndim = ctx->head->field->type->ndim;
    while (*ts && *ts != ')') {
        switch (*ts) {
            case ' ': case '\f': case '\r': case '\n': case '\t': case '\v':  continue;
            default:  break;
        }
        number = __Pyx_BufFmt_ExpectNumber(&ts);
        if (number == -1) return -1;
        if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) {
            PyErr_Format(PyExc_ValueError,
                        "Expected a dimension of size %zu, got %d",
                        ctx->head->field->type->arraysize[i], number);
            return -1;
        }
        if (*ts != ',' && *ts != ')') {
            PyErr_Format(PyExc_ValueError,
                                "Expected a comma in format string, got '%c'", *ts);
            return -1;
        }
        if (*ts == ',') ts++;
        i++;
    }
    if (i != ndim) {
        PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
                            ctx->head->field->type->ndim, i);
        return -1;
    }
    if (!*ts) {
        PyErr_SetString(PyExc_ValueError,
                        "Unexpected end of format string, expected ')'");
        return -1;
    }
    ctx->is_valid_array = 1;
    ctx->new_count = 1;
    *tsp = ++ts;
    return 0;
}
static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
  int got_Z = 0;
  while (1) {
    switch(*ts) {
      case 0:
        if (ctx->enc_type != 0 && ctx->head == NULL) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return NULL;
        }
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        if (ctx->head != NULL) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return NULL;
        }
        return ts;
      case ' ':
      case '\r':
      case '\n':
        ++ts;
        break;
      case '<':
        if (!__Pyx_Is_Little_Endian()) {
          PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
          return NULL;
        }
        ctx->new_packmode = '=';
        ++ts;
        break;
      case '>':
      case '!':
        if (__Pyx_Is_Little_Endian()) {
          PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
          return NULL;
        }
        ctx->new_packmode = '=';
        ++ts;
        break;
      case '=':
      case '@':
      case '^':
        ctx->new_packmode = *ts++;
        break;
      case 'T':
        {
          const char* ts_after_sub;
          size_t i, struct_count = ctx->new_count;
          size_t struct_alignment = ctx->struct_alignment;
          ctx->new_count = 1;
          ++ts;
          if (*ts != '{') {
            PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
            return NULL;
          }
          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
          ctx->enc_type = 0;
          ctx->enc_count = 0;
          ctx->struct_alignment = 0;
          ++ts;
          ts_after_sub = ts;
          for (i = 0; i != struct_count; ++i) {
            ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
            if (!ts_after_sub) return NULL;
          }
          ts = ts_after_sub;
          if (struct_alignment) ctx->struct_alignment = struct_alignment;
        }
        break;
      case '}':
        {
          size_t alignment = ctx->struct_alignment;
          ++ts;
          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
          ctx->enc_type = 0;
          if (alignment && ctx->fmt_offset % alignment) {
            ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
          }
        }
        return ts;
      case 'x':
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        ctx->fmt_offset += ctx->new_count;
        ctx->new_count = 1;
        ctx->enc_count = 0;
        ctx->enc_type = 0;
        ctx->enc_packmode = ctx->new_packmode;
        ++ts;
        break;
      case 'Z':
        got_Z = 1;
        ++ts;
        if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
          __Pyx_BufFmt_RaiseUnexpectedChar('Z');
          return NULL;
        }
        CYTHON_FALLTHROUGH;
      case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
      case 'l': case 'L': case 'q': case 'Q':
      case 'f': case 'd': case 'g':
      case 'O': case 'p':
        if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) &&
            (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) {
          ctx->enc_count += ctx->new_count;
          ctx->new_count = 1;
          got_Z = 0;
          ++ts;
          break;
        }
        CYTHON_FALLTHROUGH;
      case 's':
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        ctx->enc_count = ctx->new_count;
        ctx->enc_packmode = ctx->new_packmode;
        ctx->enc_type = *ts;
        ctx->is_complex = got_Z;
        ++ts;
        ctx->new_count = 1;
        got_Z = 0;
        break;
      case ':':
        ++ts;
        while(*ts != ':') ++ts;
        ++ts;
        break;
      case '(':
        if (__pyx_buffmt_parse_array(ctx, &ts) < 0) return NULL;
        break;
      default:
        {
          int number = __Pyx_BufFmt_ExpectNumber(&ts);
          if (number == -1) return NULL;
          ctx->new_count = (size_t)number;
        }
    }
  }
}

/* TypeInfoCompare (used by MemviewSliceValidateAndInit) */
  static int
  __pyx_typeinfo_cmp(const __Pyx_TypeInfo *a, const __Pyx_TypeInfo *b)
  {
      int i;
      if (!a || !b)
          return 0;
      if (a == b)
          return 1;
      if (a->size != b->size || a->typegroup != b->typegroup ||
              a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
          if (a->typegroup == 'H' || b->typegroup == 'H') {
              return a->size == b->size;
          } else {
              return 0;
          }
      }
      if (a->ndim) {
          for (i = 0; i < a->ndim; i++)
              if (a->arraysize[i] != b->arraysize[i])
                  return 0;
      }
      if (a->typegroup == 'S') {
          if (a->flags != b->flags)
              return 0;
          if (a->fields || b->fields) {
              if (!(a->fields && b->fields))
                  return 0;
              for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
                  const __Pyx_StructField *field_a = a->fields + i;
                  const __Pyx_StructField *field_b = b->fields + i;
                  if (field_a->offset != field_b->offset ||
                      !__pyx_typeinfo_cmp(field_a->type, field_b->type))
                      return 0;
              }
              return !a->fields[i].type && !b->fields[i].type;
          }
      }
      return 1;
  }
  
/* MemviewSliceValidateAndInit (used by ObjectToMemviewSlice) */
  static int
  __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
  {
      if (buf->shape[dim] <= 1)
          return 1;
      if (buf->strides) {
          if (spec & __Pyx_MEMVIEW_CONTIG) {
              if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
                  if (unlikely(buf->strides[dim] != sizeof(void *))) {
                      PyErr_Format(PyExc_ValueError,
                                   "Buffer is not indirectly contiguous "
                                   "in dimension %d.", dim);
                      goto fail;
                  }
              } else if (unlikely(buf->strides[dim] != buf->itemsize)) {
                  PyErr_SetString(PyExc_ValueError,
                                  "Buffer and memoryview are not contiguous "
                                  "in the same dimension.");
                  goto fail;
              }
          }
          if (spec & __Pyx_MEMVIEW_FOLLOW) {
              Py_ssize_t stride = buf->strides[dim];
              if (stride < 0)
                  stride = -stride;
              if (unlikely(stride < buf->itemsize)) {
                  PyErr_SetString(PyExc_ValueError,
                                  "Buffer and memoryview are not contiguous "
                                  "in the same dimension.");
                  goto fail;
              }
          }
      } else {
          if (unlikely(spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1)) {
              PyErr_Format(PyExc_ValueError,
                           "C-contiguous buffer is not contiguous in "
                           "dimension %d", dim);
              goto fail;
          } else if (unlikely(spec & (__Pyx_MEMVIEW_PTR))) {
              PyErr_Format(PyExc_ValueError,
                           "C-contiguous buffer is not indirect in "
                           "dimension %d", dim);
              goto fail;
          } else if (unlikely(buf->suboffsets)) {
              PyErr_SetString(PyExc_ValueError,
                              "Buffer exposes suboffsets but no strides");
              goto fail;
          }
      }
      return 1;
  fail:
      return 0;
  }
  static int
  __pyx_check_suboffsets(Py_buffer *buf, int dim, int ndim, int spec)
  {
      CYTHON_UNUSED_VAR(ndim);
      if (spec & __Pyx_MEMVIEW_DIRECT) {
          if (unlikely(buf->suboffsets && buf->suboffsets[dim] >= 0)) {
              PyErr_Format(PyExc_ValueError,
                           "Buffer not compatible with direct access "
                           "in dimension %d.", dim);
              goto fail;
          }
      }
      if (spec & __Pyx_MEMVIEW_PTR) {
          if (unlikely(!buf->suboffsets || (buf->suboffsets[dim] < 0))) {
              PyErr_Format(PyExc_ValueError,
                           "Buffer is not indirectly accessible "
                           "in dimension %d.", dim);
              goto fail;
          }
      }
      return 1;
  fail:
      return 0;
  }
  static int
  __pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
  {
      int i;
      if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
          Py_ssize_t stride = 1;
          for (i = 0; i < ndim; i++) {
              if (unlikely(stride * buf->itemsize != buf->strides[i]  &&  buf->shape[i] > 1)) {
                  PyErr_SetString(PyExc_ValueError,
                      "Buffer not fortran contiguous.");
                  goto fail;
              }
              stride = stride * buf->shape[i];
          }
      } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
          Py_ssize_t stride = 1;
          for (i = ndim - 1; i >- 1; i--) {
              if (unlikely(stride * buf->itemsize != buf->strides[i]  &&  buf->shape[i] > 1)) {
                  PyErr_SetString(PyExc_ValueError,
                      "Buffer not C contiguous.");
                  goto fail;
              }
              stride = stride * buf->shape[i];
          }
      }
      return 1;
  fail:
      return 0;
  }
  static int __Pyx_ValidateAndInit_memviewslice(
                  int *axes_specs,
                  int c_or_f_flag,
                  int buf_flags,
                  int ndim,
                  const __Pyx_TypeInfo *dtype,
                  __Pyx_BufFmt_StackElem stack[],
                  __Pyx_memviewslice *memviewslice,
                  PyObject *original_obj)
  {
      struct __pyx_memoryview_obj *memview, *new_memview;
      __Pyx_RefNannyDeclarations
      Py_buffer *buf;
      int i, spec = 0, retval = -1;
      __Pyx_BufFmt_Context ctx;
      int from_memoryview = __pyx_memoryview_check(original_obj);
      __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
      if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
                                                              original_obj)->typeinfo)) {
          memview = (struct __pyx_memoryview_obj *) original_obj;
          new_memview = NULL;
      } else {
          memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
                                              original_obj, buf_flags, 0, dtype);
          new_memview = memview;
          if (unlikely(!memview))
              goto fail;
      }
      buf = &memview->view;
      if (unlikely(buf->ndim != ndim)) {
          PyErr_Format(PyExc_ValueError,
                  "Buffer has wrong number of dimensions (expected %d, got %d)",
                  ndim, buf->ndim);
          goto fail;
      }
      if (new_memview) {
          __Pyx_BufFmt_Init(&ctx, stack, dtype);
          if (unlikely(!__Pyx_BufFmt_CheckString(&ctx, buf->format))) goto fail;
      }
      if (unlikely((unsigned) buf->itemsize != dtype->size)) {
          PyErr_Format(PyExc_ValueError,
                       "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
                       "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
                       buf->itemsize,
                       (buf->itemsize > 1) ? "s" : "",
                       dtype->name,
                       dtype->size,
                       (dtype->size > 1) ? "s" : "");
          goto fail;
      }
      if (buf->len > 0) {
          for (i = 0; i < ndim; i++) {
              spec = axes_specs[i];
              if (unlikely(!__pyx_check_strides(buf, i, ndim, spec)))
                  goto fail;
              if (unlikely(!__pyx_check_suboffsets(buf, i, ndim, spec)))
                  goto fail;
          }
          if (unlikely(buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag)))
              goto fail;
      }
      if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
                                           new_memview != NULL) == -1)) {
          goto fail;
      }
      retval = 0;
      goto no_fail;
  fail:
      Py_XDECREF((PyObject*)new_memview);
      retval = -1;
  no_fail:
      __Pyx_RefNannyFinishContext();
      return retval;
  }
  
/* ObjectToMemviewSlice */
  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn_CK_MECHANISM_TYPE(PyObject *obj, int writable_flag) {
      __Pyx_memviewslice result = __Pyx_MEMSLICE_INIT;
      __Pyx_BufFmt_StackElem stack[1];
      int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
      int retcode;
      if (obj == Py_None) {
          result.memview = (struct __pyx_memoryview_obj *) Py_None;
          return result;
      }
      retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
                                                   PyBUF_RECORDS_RO | writable_flag, 1,
                                                   &__Pyx_TypeInfo_nn_CK_MECHANISM_TYPE, stack,
                                                   &result, obj);
      if (unlikely(retcode == -1))
          goto __pyx_fail;
      return result;
  __pyx_fail:
      result.memview = NULL;
      result.data = NULL;
      return result;
  }
  
/* MemviewDtypeToObject */
  static CYTHON_INLINE PyObject *__pyx_memview_get_nn_CK_MECHANISM_TYPE(const char *itemp) {
      return (PyObject *) __Pyx_PyLong_From_CK_ULONG(*(CK_MECHANISM_TYPE const *) itemp);
  }
  static CYTHON_INLINE int __pyx_memview_set_nn_CK_MECHANISM_TYPE(char *itemp, PyObject *obj) {
      CK_MECHANISM_TYPE value = __Pyx_PyLong_As_CK_ULONG(obj);
      if (unlikely((value == ((CK_MECHANISM_TYPE)-1)) && PyErr_Occurred()))
          return 0;
      *(CK_MECHANISM_TYPE *) itemp = value;
      return 1;
  }
  
static PyObject* __pyx_convert__to_py_CK_MECHANISM_INFO(CK_MECHANISM_INFO s) {
    PyObject* res;
    PyObject* member;
    res = __Pyx_PyDict_NewPresized(3); if (unlikely(!res)) return NULL;
    member = __Pyx_PyLong_From_CK_ULONG(s.ulMinKeySize); if (unlikely(!member)) goto bad;
    if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_ulMinKeySize, member) < 0)) goto bad;
    Py_DECREF(member);
    member = __Pyx_PyLong_From_CK_ULONG(s.ulMaxKeySize); if (unlikely(!member)) goto bad;
    if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_ulMaxKeySize, member) < 0)) goto bad;
    Py_DECREF(member);
    member = __Pyx_PyLong_From_CK_ULONG(s.flags); if (unlikely(!member)) goto bad;
    if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_flags, member) < 0)) goto bad;
    Py_DECREF(member);
    return res;
    bad:
    Py_XDECREF(member);
    Py_DECREF(res);
    return NULL;
  }
  /* ObjectToMemviewSlice */
  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn_CK_BYTE(PyObject *obj, int writable_flag) {
      __Pyx_memviewslice result = __Pyx_MEMSLICE_INIT;
      __Pyx_BufFmt_StackElem stack[1];
      int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
      int retcode;
      if (obj == Py_None) {
          result.memview = (struct __pyx_memoryview_obj *) Py_None;
          return result;
      }
      retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
                                                   PyBUF_RECORDS_RO | writable_flag, 1,
                                                   &__Pyx_TypeInfo_nn_CK_BYTE, stack,
                                                   &result, obj);
      if (unlikely(retcode == -1))
          goto __pyx_fail;
      return result;
  __pyx_fail:
      result.memview = NULL;
      result.data = NULL;
      return result;
  }
  
/* MemviewDtypeToObject */
  static CYTHON_INLINE PyObject *__pyx_memview_get_nn_CK_BYTE(const char *itemp) {
      return (PyObject *) __Pyx_PyLong_From_CK_BYTE(*(CK_BYTE const *) itemp);
  }
  static CYTHON_INLINE int __pyx_memview_set_nn_CK_BYTE(char *itemp, PyObject *obj) {
      CK_BYTE value = __Pyx_PyLong_As_CK_BYTE(obj);
      if (unlikely((value == ((CK_BYTE)-1)) && PyErr_Occurred()))
          return 0;
      *(CK_BYTE *) itemp = value;
      return 1;
  }
  
/* ObjectToMemviewSlice */
  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn_CK_OBJECT_HANDLE(PyObject *obj, int writable_flag) {
      __Pyx_memviewslice result = __Pyx_MEMSLICE_INIT;
      __Pyx_BufFmt_StackElem stack[1];
      int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
      int retcode;
      if (obj == Py_None) {
          result.memview = (struct __pyx_memoryview_obj *) Py_None;
          return result;
      }
      retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
                                                   PyBUF_RECORDS_RO | writable_flag, 1,
                                                   &__Pyx_TypeInfo_nn_CK_OBJECT_HANDLE, stack,
                                                   &result, obj);
      if (unlikely(retcode == -1))
          goto __pyx_fail;
      return result;
  __pyx_fail:
      result.memview = NULL;
      result.data = NULL;
      return result;
  }
  
/* MemviewDtypeToObject */
  static CYTHON_INLINE PyObject *__pyx_memview_get_nn_CK_OBJECT_HANDLE(const char *itemp) {
      return (PyObject *) __Pyx_PyLong_From_CK_ULONG(*(CK_OBJECT_HANDLE const *) itemp);
  }
  static CYTHON_INLINE int __pyx_memview_set_nn_CK_OBJECT_HANDLE(char *itemp, PyObject *obj) {
      CK_OBJECT_HANDLE value = __Pyx_PyLong_As_CK_ULONG(obj);
      if (unlikely((value == ((CK_OBJECT_HANDLE)-1)) && PyErr_Occurred()))
          return 0;
      *(CK_OBJECT_HANDLE *) itemp = value;
      return 1;
  }
  
/* ObjectToMemviewSlice */
  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn_CK_CHAR(PyObject *obj, int writable_flag) {
      __Pyx_memviewslice result = __Pyx_MEMSLICE_INIT;
      __Pyx_BufFmt_StackElem stack[1];
      int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
      int retcode;
      if (obj == Py_None) {
          result.memview = (struct __pyx_memoryview_obj *) Py_None;
          return result;
      }
      retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
                                                   PyBUF_RECORDS_RO | writable_flag, 1,
                                                   &__Pyx_TypeInfo_nn_CK_CHAR, stack,
                                                   &result, obj);
      if (unlikely(retcode == -1))
          goto __pyx_fail;
      return result;
  __pyx_fail:
      result.memview = NULL;
      result.data = NULL;
      return result;
  }
  
/* MemviewDtypeToObject */
  static CYTHON_INLINE PyObject *__pyx_memview_get_nn_CK_CHAR(const char *itemp) {
      return (PyObject *) __Pyx_PyLong_From_CK_CHAR(*(CK_CHAR const *) itemp);
  }
  static CYTHON_INLINE int __pyx_memview_set_nn_CK_CHAR(char *itemp, PyObject *obj) {
      CK_CHAR value = __Pyx_PyLong_As_CK_CHAR(obj);
      if (unlikely((value == ((CK_CHAR)-1)) && PyErr_Occurred()))
          return 0;
      *(CK_CHAR *) itemp = value;
      return 1;
  }
  
/* ObjectToMemviewSlice */
  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn_CK_SLOT_ID(PyObject *obj, int writable_flag) {
      __Pyx_memviewslice result = __Pyx_MEMSLICE_INIT;
      __Pyx_BufFmt_StackElem stack[1];
      int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
      int retcode;
      if (obj == Py_None) {
          result.memview = (struct __pyx_memoryview_obj *) Py_None;
          return result;
      }
      retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
                                                   PyBUF_RECORDS_RO | writable_flag, 1,
                                                   &__Pyx_TypeInfo_nn_CK_SLOT_ID, stack,
                                                   &result, obj);
      if (unlikely(retcode == -1))
          goto __pyx_fail;
      return result;
  __pyx_fail:
      result.memview = NULL;
      result.data = NULL;
      return result;
  }
  
/* MemviewDtypeToObject */
  static CYTHON_INLINE PyObject *__pyx_memview_get_nn_CK_SLOT_ID(const char *itemp) {
      return (PyObject *) __Pyx_PyLong_From_CK_ULONG(*(CK_SLOT_ID const *) itemp);
  }
  static CYTHON_INLINE int __pyx_memview_set_nn_CK_SLOT_ID(char *itemp, PyObject *obj) {
      CK_SLOT_ID value = __Pyx_PyLong_As_CK_ULONG(obj);
      if (unlikely((value == ((CK_SLOT_ID)-1)) && PyErr_Occurred()))
          return 0;
      *(CK_SLOT_ID *) itemp = value;
      return 1;
  }
  
/* MemviewSliceCopy */
  static __Pyx_memviewslice
  __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
                                   const char *mode, int ndim,
                                   size_t sizeof_dtype, int contig_flag,
                                   int dtype_is_object)
  {
      __Pyx_RefNannyDeclarations
      int i;
      __Pyx_memviewslice new_mvs = __Pyx_MEMSLICE_INIT;
      struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
      Py_buffer *buf = &from_memview->view;
      PyObject *shape_tuple = NULL;
      struct __pyx_array_obj *array_obj = NULL;
      struct __pyx_memoryview_obj *memview_obj = NULL;
      __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0);
      for (i = 0; i < ndim; i++) {
          if (unlikely(from_mvs->suboffsets[i] >= 0)) {
              PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with "
                                             "indirect dimensions (axis %d)", i);
              goto fail;
          }
      }
      shape_tuple = PyTuple_New(ndim);
      if (unlikely(!shape_tuple)) {
          goto fail;
      }
      __Pyx_GOTREF(shape_tuple);
      for(i = 0; i < ndim; i++) {
          PyObject *temp_int = PyLong_FromSsize_t(from_mvs->shape[i]);
          if(unlikely(!temp_int)) {
              goto fail;
          } else {
  #if CYTHON_ASSUME_SAFE_MACROS
              PyTuple_SET_ITEM(shape_tuple, i, temp_int);
  #else
              if (PyTuple_SetItem(shape_tuple, i, temp_int) < 0) {
                  goto fail;
              }
  #endif
          }
      }
      array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, mode, NULL);
      if (unlikely(!array_obj)) {
          goto fail;
      }
      __Pyx_GOTREF(array_obj);
      memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
                                      (PyObject *) array_obj, contig_flag,
                                      dtype_is_object,
                                      from_mvs->memview->typeinfo);
      if (unlikely(!memview_obj))
          goto fail;
      if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
          goto fail;
      if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
                                                  dtype_is_object) < 0))
          goto fail;
      goto no_fail;
  fail:
      __Pyx_XDECREF((PyObject *) new_mvs.memview);
      new_mvs.memview = NULL;
      new_mvs.data = NULL;
  no_fail:
      __Pyx_XDECREF(shape_tuple);
      __Pyx_XDECREF((PyObject *) array_obj);
      __Pyx_RefNannyFinishContext();
      return new_mvs;
  }
  
/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyLong_From_CK_RV(CK_RV value) {
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wconversion"
  #endif
      const CK_RV neg_one = (CK_RV) -1, const_zero = (CK_RV) 0;
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic pop
  #endif
      const int is_unsigned = neg_one > const_zero;
      if (is_unsigned) {
          if (sizeof(CK_RV) < sizeof(long)) {
              return PyLong_FromLong((long) value);
          } else if (sizeof(CK_RV) <= sizeof(unsigned long)) {
              return PyLong_FromUnsignedLong((unsigned long) value);
  #if !CYTHON_COMPILING_IN_PYPY
          } else if (sizeof(CK_RV) <= sizeof(unsigned PY_LONG_LONG)) {
              return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  #endif
          }
      } else {
          if (sizeof(CK_RV) <= sizeof(long)) {
              return PyLong_FromLong((long) value);
          } else if (sizeof(CK_RV) <= sizeof(PY_LONG_LONG)) {
              return PyLong_FromLongLong((PY_LONG_LONG) value);
          }
      }
      {
          unsigned char *bytes = (unsigned char *)&value;
  #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
          if (is_unsigned) {
              return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
          } else {
              return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
          }
  #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
          int one = 1; int little = (int)*(unsigned char *)&one;
          return _PyLong_FromByteArray(bytes, sizeof(CK_RV),
                                       little, !is_unsigned);
  #else
          int one = 1; int little = (int)*(unsigned char *)&one;
          PyObject *from_bytes, *result = NULL, *kwds = NULL;
          PyObject *py_bytes = NULL, *order_str = NULL;
          from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
          if (!from_bytes) return NULL;
          py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(CK_RV));
          if (!py_bytes) goto limited_bad;
          order_str = PyUnicode_FromString(little ? "little" : "big");
          if (!order_str) goto limited_bad;
          {
              PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
              if (!is_unsigned) {
                  kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                  if (!kwds) goto limited_bad;
                  if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
              }
              result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
          }
          limited_bad:
          Py_XDECREF(kwds);
          Py_XDECREF(order_str);
          Py_XDECREF(py_bytes);
          Py_XDECREF(from_bytes);
          return result;
  #endif
      }
  }
  
/* CIntFromPy */
  static CYTHON_INLINE CK_RV __Pyx_PyLong_As_CK_RV(PyObject *x) {
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wconversion"
  #endif
      const CK_RV neg_one = (CK_RV) -1, const_zero = (CK_RV) 0;
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic pop
  #endif
      const int is_unsigned = neg_one > const_zero;
      if (unlikely(!PyLong_Check(x))) {
          CK_RV val;
          PyObject *tmp = __Pyx_PyNumber_Long(x);
          if (!tmp) return (CK_RV) -1;
          val = __Pyx_PyLong_As_CK_RV(tmp);
          Py_DECREF(tmp);
          return val;
      }
      if (is_unsigned) {
  #if CYTHON_USE_PYLONG_INTERNALS
          if (unlikely(__Pyx_PyLong_IsNeg(x))) {
              goto raise_neg_overflow;
          } else if (__Pyx_PyLong_IsCompact(x)) {
              __PYX_VERIFY_RETURN_INT(CK_RV, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
          } else {
              const digit* digits = __Pyx_PyLong_Digits(x);
              assert(__Pyx_PyLong_DigitCount(x) > 1);
              switch (__Pyx_PyLong_DigitCount(x)) {
                  case 2:
                      if ((8 * sizeof(CK_RV) > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_RV, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_RV) >= 2 * PyLong_SHIFT)) {
                              return (CK_RV) (((((CK_RV)digits[1]) << PyLong_SHIFT) | (CK_RV)digits[0]));
                          }
                      }
                      break;
                  case 3:
                      if ((8 * sizeof(CK_RV) > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_RV, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_RV) >= 3 * PyLong_SHIFT)) {
                              return (CK_RV) (((((((CK_RV)digits[2]) << PyLong_SHIFT) | (CK_RV)digits[1]) << PyLong_SHIFT) | (CK_RV)digits[0]));
                          }
                      }
                      break;
                  case 4:
                      if ((8 * sizeof(CK_RV) > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_RV, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_RV) >= 4 * PyLong_SHIFT)) {
                              return (CK_RV) (((((((((CK_RV)digits[3]) << PyLong_SHIFT) | (CK_RV)digits[2]) << PyLong_SHIFT) | (CK_RV)digits[1]) << PyLong_SHIFT) | (CK_RV)digits[0]));
                          }
                      }
                      break;
              }
          }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
          if (unlikely(Py_SIZE(x) < 0)) {
              goto raise_neg_overflow;
          }
  #else
          {
              int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
              if (unlikely(result < 0))
                  return (CK_RV) -1;
              if (unlikely(result == 1))
                  goto raise_neg_overflow;
          }
  #endif
          if ((sizeof(CK_RV) <= sizeof(unsigned long))) {
              __PYX_VERIFY_RETURN_INT_EXC(CK_RV, unsigned long, PyLong_AsUnsignedLong(x))
          } else if ((sizeof(CK_RV) <= sizeof(unsigned PY_LONG_LONG))) {
              __PYX_VERIFY_RETURN_INT_EXC(CK_RV, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
          }
      } else {
  #if CYTHON_USE_PYLONG_INTERNALS
          if (__Pyx_PyLong_IsCompact(x)) {
              __PYX_VERIFY_RETURN_INT(CK_RV, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
          } else {
              const digit* digits = __Pyx_PyLong_Digits(x);
              assert(__Pyx_PyLong_DigitCount(x) > 1);
              switch (__Pyx_PyLong_SignedDigitCount(x)) {
                  case -2:
                      if ((8 * sizeof(CK_RV) - 1 > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_RV, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_RV) - 1 > 2 * PyLong_SHIFT)) {
                              return (CK_RV) (((CK_RV)-1)*(((((CK_RV)digits[1]) << PyLong_SHIFT) | (CK_RV)digits[0])));
                          }
                      }
                      break;
                  case 2:
                      if ((8 * sizeof(CK_RV) > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_RV, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_RV) - 1 > 2 * PyLong_SHIFT)) {
                              return (CK_RV) ((((((CK_RV)digits[1]) << PyLong_SHIFT) | (CK_RV)digits[0])));
                          }
                      }
                      break;
                  case -3:
                      if ((8 * sizeof(CK_RV) - 1 > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_RV, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_RV) - 1 > 3 * PyLong_SHIFT)) {
                              return (CK_RV) (((CK_RV)-1)*(((((((CK_RV)digits[2]) << PyLong_SHIFT) | (CK_RV)digits[1]) << PyLong_SHIFT) | (CK_RV)digits[0])));
                          }
                      }
                      break;
                  case 3:
                      if ((8 * sizeof(CK_RV) > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_RV, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_RV) - 1 > 3 * PyLong_SHIFT)) {
                              return (CK_RV) ((((((((CK_RV)digits[2]) << PyLong_SHIFT) | (CK_RV)digits[1]) << PyLong_SHIFT) | (CK_RV)digits[0])));
                          }
                      }
                      break;
                  case -4:
                      if ((8 * sizeof(CK_RV) - 1 > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_RV, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_RV) - 1 > 4 * PyLong_SHIFT)) {
                              return (CK_RV) (((CK_RV)-1)*(((((((((CK_RV)digits[3]) << PyLong_SHIFT) | (CK_RV)digits[2]) << PyLong_SHIFT) | (CK_RV)digits[1]) << PyLong_SHIFT) | (CK_RV)digits[0])));
                          }
                      }
                      break;
                  case 4:
                      if ((8 * sizeof(CK_RV) > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_RV, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_RV) - 1 > 4 * PyLong_SHIFT)) {
                              return (CK_RV) ((((((((((CK_RV)digits[3]) << PyLong_SHIFT) | (CK_RV)digits[2]) << PyLong_SHIFT) | (CK_RV)digits[1]) << PyLong_SHIFT) | (CK_RV)digits[0])));
                          }
                      }
                      break;
              }
          }
  #endif
          if ((sizeof(CK_RV) <= sizeof(long))) {
              __PYX_VERIFY_RETURN_INT_EXC(CK_RV, long, PyLong_AsLong(x))
          } else if ((sizeof(CK_RV) <= sizeof(PY_LONG_LONG))) {
              __PYX_VERIFY_RETURN_INT_EXC(CK_RV, PY_LONG_LONG, PyLong_AsLongLong(x))
          }
      }
      {
          CK_RV val;
          int ret = -1;
  #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
          Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
              x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
          if (unlikely(bytes_copied == -1)) {
          } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
              goto raise_overflow;
          } else {
              ret = 0;
          }
  #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
          int one = 1; int is_little = (int)*(unsigned char *)&one;
          unsigned char *bytes = (unsigned char *)&val;
          ret = _PyLong_AsByteArray((PyLongObject *)x,
                                      bytes, sizeof(val),
                                      is_little, !is_unsigned);
  #else
          PyErr_SetString(PyExc_RuntimeError,
                          "_PyLong_AsByteArray() or PyLong_AsNativeBytes() not available, cannot convert large enums");
          val = (CK_RV) -1;
  #endif
          if (unlikely(ret))
              return (CK_RV) -1;
          return val;
      }
  raise_overflow:
      PyErr_SetString(PyExc_OverflowError,
          "value too large to convert to CK_RV");
      return (CK_RV) -1;
  raise_neg_overflow:
      PyErr_SetString(PyExc_OverflowError,
          "can't convert negative value to CK_RV");
      return (CK_RV) -1;
  }
  
/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyLong_From_CK_ULONG(CK_ULONG value) {
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wconversion"
  #endif
      const CK_ULONG neg_one = (CK_ULONG) -1, const_zero = (CK_ULONG) 0;
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic pop
  #endif
      const int is_unsigned = neg_one > const_zero;
      if (is_unsigned) {
          if (sizeof(CK_ULONG) < sizeof(long)) {
              return PyLong_FromLong((long) value);
          } else if (sizeof(CK_ULONG) <= sizeof(unsigned long)) {
              return PyLong_FromUnsignedLong((unsigned long) value);
  #if !CYTHON_COMPILING_IN_PYPY
          } else if (sizeof(CK_ULONG) <= sizeof(unsigned PY_LONG_LONG)) {
              return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  #endif
          }
      } else {
          if (sizeof(CK_ULONG) <= sizeof(long)) {
              return PyLong_FromLong((long) value);
          } else if (sizeof(CK_ULONG) <= sizeof(PY_LONG_LONG)) {
              return PyLong_FromLongLong((PY_LONG_LONG) value);
          }
      }
      {
          unsigned char *bytes = (unsigned char *)&value;
  #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
          if (is_unsigned) {
              return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
          } else {
              return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
          }
  #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
          int one = 1; int little = (int)*(unsigned char *)&one;
          return _PyLong_FromByteArray(bytes, sizeof(CK_ULONG),
                                       little, !is_unsigned);
  #else
          int one = 1; int little = (int)*(unsigned char *)&one;
          PyObject *from_bytes, *result = NULL, *kwds = NULL;
          PyObject *py_bytes = NULL, *order_str = NULL;
          from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
          if (!from_bytes) return NULL;
          py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(CK_ULONG));
          if (!py_bytes) goto limited_bad;
          order_str = PyUnicode_FromString(little ? "little" : "big");
          if (!order_str) goto limited_bad;
          {
              PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
              if (!is_unsigned) {
                  kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                  if (!kwds) goto limited_bad;
                  if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
              }
              result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
          }
          limited_bad:
          Py_XDECREF(kwds);
          Py_XDECREF(order_str);
          Py_XDECREF(py_bytes);
          Py_XDECREF(from_bytes);
          return result;
  #endif
      }
  }
  
/* CIntFromPy */
  static CYTHON_INLINE size_t __Pyx_PyLong_As_size_t(PyObject *x) {
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wconversion"
  #endif
      const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic pop
  #endif
      const int is_unsigned = neg_one > const_zero;
      if (unlikely(!PyLong_Check(x))) {
          size_t val;
          PyObject *tmp = __Pyx_PyNumber_Long(x);
          if (!tmp) return (size_t) -1;
          val = __Pyx_PyLong_As_size_t(tmp);
          Py_DECREF(tmp);
          return val;
      }
      if (is_unsigned) {
  #if CYTHON_USE_PYLONG_INTERNALS
          if (unlikely(__Pyx_PyLong_IsNeg(x))) {
              goto raise_neg_overflow;
          } else if (__Pyx_PyLong_IsCompact(x)) {
              __PYX_VERIFY_RETURN_INT(size_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
          } else {
              const digit* digits = __Pyx_PyLong_Digits(x);
              assert(__Pyx_PyLong_DigitCount(x) > 1);
              switch (__Pyx_PyLong_DigitCount(x)) {
                  case 2:
                      if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(size_t) >= 2 * PyLong_SHIFT)) {
                              return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                          }
                      }
                      break;
                  case 3:
                      if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(size_t) >= 3 * PyLong_SHIFT)) {
                              return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                          }
                      }
                      break;
                  case 4:
                      if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(size_t) >= 4 * PyLong_SHIFT)) {
                              return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                          }
                      }
                      break;
              }
          }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
          if (unlikely(Py_SIZE(x) < 0)) {
              goto raise_neg_overflow;
          }
  #else
          {
              int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
              if (unlikely(result < 0))
                  return (size_t) -1;
              if (unlikely(result == 1))
                  goto raise_neg_overflow;
          }
  #endif
          if ((sizeof(size_t) <= sizeof(unsigned long))) {
              __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x))
          } else if ((sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG))) {
              __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
          }
      } else {
  #if CYTHON_USE_PYLONG_INTERNALS
          if (__Pyx_PyLong_IsCompact(x)) {
              __PYX_VERIFY_RETURN_INT(size_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
          } else {
              const digit* digits = __Pyx_PyLong_Digits(x);
              assert(__Pyx_PyLong_DigitCount(x) > 1);
              switch (__Pyx_PyLong_SignedDigitCount(x)) {
                  case -2:
                      if ((8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) {
                              return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                          }
                      }
                      break;
                  case 2:
                      if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) {
                              return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                          }
                      }
                      break;
                  case -3:
                      if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) {
                              return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                          }
                      }
                      break;
                  case 3:
                      if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) {
                              return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                          }
                      }
                      break;
                  case -4:
                      if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) {
                              return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                          }
                      }
                      break;
                  case 4:
                      if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) {
                              return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                          }
                      }
                      break;
              }
          }
  #endif
          if ((sizeof(size_t) <= sizeof(long))) {
              __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
          } else if ((sizeof(size_t) <= sizeof(PY_LONG_LONG))) {
              __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
          }
      }
      {
          size_t val;
          int ret = -1;
  #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
          Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
              x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
          if (unlikely(bytes_copied == -1)) {
          } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
              goto raise_overflow;
          } else {
              ret = 0;
          }
  #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
          int one = 1; int is_little = (int)*(unsigned char *)&one;
          unsigned char *bytes = (unsigned char *)&val;
          ret = _PyLong_AsByteArray((PyLongObject *)x,
                                      bytes, sizeof(val),
                                      is_little, !is_unsigned);
  #else
          PyObject *v;
          PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
          int bits, remaining_bits, is_negative = 0;
          int chunk_size = (sizeof(long) < 8) ? 30 : 62;
          if (likely(PyLong_CheckExact(x))) {
              v = __Pyx_NewRef(x);
          } else {
              v = PyNumber_Long(x);
              if (unlikely(!v)) return (size_t) -1;
              assert(PyLong_CheckExact(v));
          }
          {
              int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
              if (unlikely(result < 0)) {
                  Py_DECREF(v);
                  return (size_t) -1;
              }
              is_negative = result == 1;
          }
          if (is_unsigned && unlikely(is_negative)) {
              Py_DECREF(v);
              goto raise_neg_overflow;
          } else if (is_negative) {
              stepval = PyNumber_Invert(v);
              Py_DECREF(v);
              if (unlikely(!stepval))
                  return (size_t) -1;
          } else {
              stepval = v;
          }
          v = NULL;
          val = (size_t) 0;
          mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
          shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
          for (bits = 0; bits < (int) sizeof(size_t) * 8 - chunk_size; bits += chunk_size) {
              PyObject *tmp, *digit;
              long idigit;
              digit = PyNumber_And(stepval, mask);
              if (unlikely(!digit)) goto done;
              idigit = PyLong_AsLong(digit);
              Py_DECREF(digit);
              if (unlikely(idigit < 0)) goto done;
              val |= ((size_t) idigit) << bits;
              tmp = PyNumber_Rshift(stepval, shift);
              if (unlikely(!tmp)) goto done;
              Py_DECREF(stepval); stepval = tmp;
          }
          Py_DECREF(shift); shift = NULL;
          Py_DECREF(mask); mask = NULL;
          {
              long idigit = PyLong_AsLong(stepval);
              if (unlikely(idigit < 0)) goto done;
              remaining_bits = ((int) sizeof(size_t) * 8) - bits - (is_unsigned ? 0 : 1);
              if (unlikely(idigit >= (1L << remaining_bits)))
                  goto raise_overflow;
              val |= ((size_t) idigit) << bits;
          }
          if (!is_unsigned) {
              if (unlikely(val & (((size_t) 1) << (sizeof(size_t) * 8 - 1))))
                  goto raise_overflow;
              if (is_negative)
                  val = ~val;
          }
          ret = 0;
      done:
          Py_XDECREF(shift);
          Py_XDECREF(mask);
          Py_XDECREF(stepval);
  #endif
          if (unlikely(ret))
              return (size_t) -1;
          return val;
      }
  raise_overflow:
      PyErr_SetString(PyExc_OverflowError,
          "value too large to convert to size_t");
      return (size_t) -1;
  raise_neg_overflow:
      PyErr_SetString(PyExc_OverflowError,
          "can't convert negative value to size_t");
      return (size_t) -1;
  }
  
/* CIntFromPy */
  static CYTHON_INLINE CK_ULONG __Pyx_PyLong_As_CK_ULONG(PyObject *x) {
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wconversion"
  #endif
      const CK_ULONG neg_one = (CK_ULONG) -1, const_zero = (CK_ULONG) 0;
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic pop
  #endif
      const int is_unsigned = neg_one > const_zero;
      if (unlikely(!PyLong_Check(x))) {
          CK_ULONG val;
          PyObject *tmp = __Pyx_PyNumber_Long(x);
          if (!tmp) return (CK_ULONG) -1;
          val = __Pyx_PyLong_As_CK_ULONG(tmp);
          Py_DECREF(tmp);
          return val;
      }
      if (is_unsigned) {
  #if CYTHON_USE_PYLONG_INTERNALS
          if (unlikely(__Pyx_PyLong_IsNeg(x))) {
              goto raise_neg_overflow;
          } else if (__Pyx_PyLong_IsCompact(x)) {
              __PYX_VERIFY_RETURN_INT(CK_ULONG, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
          } else {
              const digit* digits = __Pyx_PyLong_Digits(x);
              assert(__Pyx_PyLong_DigitCount(x) > 1);
              switch (__Pyx_PyLong_DigitCount(x)) {
                  case 2:
                      if ((8 * sizeof(CK_ULONG) > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_ULONG, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_ULONG) >= 2 * PyLong_SHIFT)) {
                              return (CK_ULONG) (((((CK_ULONG)digits[1]) << PyLong_SHIFT) | (CK_ULONG)digits[0]));
                          }
                      }
                      break;
                  case 3:
                      if ((8 * sizeof(CK_ULONG) > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_ULONG, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_ULONG) >= 3 * PyLong_SHIFT)) {
                              return (CK_ULONG) (((((((CK_ULONG)digits[2]) << PyLong_SHIFT) | (CK_ULONG)digits[1]) << PyLong_SHIFT) | (CK_ULONG)digits[0]));
                          }
                      }
                      break;
                  case 4:
                      if ((8 * sizeof(CK_ULONG) > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_ULONG, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_ULONG) >= 4 * PyLong_SHIFT)) {
                              return (CK_ULONG) (((((((((CK_ULONG)digits[3]) << PyLong_SHIFT) | (CK_ULONG)digits[2]) << PyLong_SHIFT) | (CK_ULONG)digits[1]) << PyLong_SHIFT) | (CK_ULONG)digits[0]));
                          }
                      }
                      break;
              }
          }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
          if (unlikely(Py_SIZE(x) < 0)) {
              goto raise_neg_overflow;
          }
  #else
          {
              int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
              if (unlikely(result < 0))
                  return (CK_ULONG) -1;
              if (unlikely(result == 1))
                  goto raise_neg_overflow;
          }
  #endif
          if ((sizeof(CK_ULONG) <= sizeof(unsigned long))) {
              __PYX_VERIFY_RETURN_INT_EXC(CK_ULONG, unsigned long, PyLong_AsUnsignedLong(x))
          } else if ((sizeof(CK_ULONG) <= sizeof(unsigned PY_LONG_LONG))) {
              __PYX_VERIFY_RETURN_INT_EXC(CK_ULONG, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
          }
      } else {
  #if CYTHON_USE_PYLONG_INTERNALS
          if (__Pyx_PyLong_IsCompact(x)) {
              __PYX_VERIFY_RETURN_INT(CK_ULONG, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
          } else {
              const digit* digits = __Pyx_PyLong_Digits(x);
              assert(__Pyx_PyLong_DigitCount(x) > 1);
              switch (__Pyx_PyLong_SignedDigitCount(x)) {
                  case -2:
                      if ((8 * sizeof(CK_ULONG) - 1 > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_ULONG, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_ULONG) - 1 > 2 * PyLong_SHIFT)) {
                              return (CK_ULONG) (((CK_ULONG)-1)*(((((CK_ULONG)digits[1]) << PyLong_SHIFT) | (CK_ULONG)digits[0])));
                          }
                      }
                      break;
                  case 2:
                      if ((8 * sizeof(CK_ULONG) > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_ULONG, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_ULONG) - 1 > 2 * PyLong_SHIFT)) {
                              return (CK_ULONG) ((((((CK_ULONG)digits[1]) << PyLong_SHIFT) | (CK_ULONG)digits[0])));
                          }
                      }
                      break;
                  case -3:
                      if ((8 * sizeof(CK_ULONG) - 1 > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_ULONG, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_ULONG) - 1 > 3 * PyLong_SHIFT)) {
                              return (CK_ULONG) (((CK_ULONG)-1)*(((((((CK_ULONG)digits[2]) << PyLong_SHIFT) | (CK_ULONG)digits[1]) << PyLong_SHIFT) | (CK_ULONG)digits[0])));
                          }
                      }
                      break;
                  case 3:
                      if ((8 * sizeof(CK_ULONG) > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_ULONG, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_ULONG) - 1 > 3 * PyLong_SHIFT)) {
                              return (CK_ULONG) ((((((((CK_ULONG)digits[2]) << PyLong_SHIFT) | (CK_ULONG)digits[1]) << PyLong_SHIFT) | (CK_ULONG)digits[0])));
                          }
                      }
                      break;
                  case -4:
                      if ((8 * sizeof(CK_ULONG) - 1 > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_ULONG, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_ULONG) - 1 > 4 * PyLong_SHIFT)) {
                              return (CK_ULONG) (((CK_ULONG)-1)*(((((((((CK_ULONG)digits[3]) << PyLong_SHIFT) | (CK_ULONG)digits[2]) << PyLong_SHIFT) | (CK_ULONG)digits[1]) << PyLong_SHIFT) | (CK_ULONG)digits[0])));
                          }
                      }
                      break;
                  case 4:
                      if ((8 * sizeof(CK_ULONG) > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_ULONG, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_ULONG) - 1 > 4 * PyLong_SHIFT)) {
                              return (CK_ULONG) ((((((((((CK_ULONG)digits[3]) << PyLong_SHIFT) | (CK_ULONG)digits[2]) << PyLong_SHIFT) | (CK_ULONG)digits[1]) << PyLong_SHIFT) | (CK_ULONG)digits[0])));
                          }
                      }
                      break;
              }
          }
  #endif
          if ((sizeof(CK_ULONG) <= sizeof(long))) {
              __PYX_VERIFY_RETURN_INT_EXC(CK_ULONG, long, PyLong_AsLong(x))
          } else if ((sizeof(CK_ULONG) <= sizeof(PY_LONG_LONG))) {
              __PYX_VERIFY_RETURN_INT_EXC(CK_ULONG, PY_LONG_LONG, PyLong_AsLongLong(x))
          }
      }
      {
          CK_ULONG val;
          int ret = -1;
  #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
          Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
              x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
          if (unlikely(bytes_copied == -1)) {
          } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
              goto raise_overflow;
          } else {
              ret = 0;
          }
  #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
          int one = 1; int is_little = (int)*(unsigned char *)&one;
          unsigned char *bytes = (unsigned char *)&val;
          ret = _PyLong_AsByteArray((PyLongObject *)x,
                                      bytes, sizeof(val),
                                      is_little, !is_unsigned);
  #else
          PyObject *v;
          PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
          int bits, remaining_bits, is_negative = 0;
          int chunk_size = (sizeof(long) < 8) ? 30 : 62;
          if (likely(PyLong_CheckExact(x))) {
              v = __Pyx_NewRef(x);
          } else {
              v = PyNumber_Long(x);
              if (unlikely(!v)) return (CK_ULONG) -1;
              assert(PyLong_CheckExact(v));
          }
          {
              int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
              if (unlikely(result < 0)) {
                  Py_DECREF(v);
                  return (CK_ULONG) -1;
              }
              is_negative = result == 1;
          }
          if (is_unsigned && unlikely(is_negative)) {
              Py_DECREF(v);
              goto raise_neg_overflow;
          } else if (is_negative) {
              stepval = PyNumber_Invert(v);
              Py_DECREF(v);
              if (unlikely(!stepval))
                  return (CK_ULONG) -1;
          } else {
              stepval = v;
          }
          v = NULL;
          val = (CK_ULONG) 0;
          mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
          shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
          for (bits = 0; bits < (int) sizeof(CK_ULONG) * 8 - chunk_size; bits += chunk_size) {
              PyObject *tmp, *digit;
              long idigit;
              digit = PyNumber_And(stepval, mask);
              if (unlikely(!digit)) goto done;
              idigit = PyLong_AsLong(digit);
              Py_DECREF(digit);
              if (unlikely(idigit < 0)) goto done;
              val |= ((CK_ULONG) idigit) << bits;
              tmp = PyNumber_Rshift(stepval, shift);
              if (unlikely(!tmp)) goto done;
              Py_DECREF(stepval); stepval = tmp;
          }
          Py_DECREF(shift); shift = NULL;
          Py_DECREF(mask); mask = NULL;
          {
              long idigit = PyLong_AsLong(stepval);
              if (unlikely(idigit < 0)) goto done;
              remaining_bits = ((int) sizeof(CK_ULONG) * 8) - bits - (is_unsigned ? 0 : 1);
              if (unlikely(idigit >= (1L << remaining_bits)))
                  goto raise_overflow;
              val |= ((CK_ULONG) idigit) << bits;
          }
          if (!is_unsigned) {
              if (unlikely(val & (((CK_ULONG) 1) << (sizeof(CK_ULONG) * 8 - 1))))
                  goto raise_overflow;
              if (is_negative)
                  val = ~val;
          }
          ret = 0;
      done:
          Py_XDECREF(shift);
          Py_XDECREF(mask);
          Py_XDECREF(stepval);
  #endif
          if (unlikely(ret))
              return (CK_ULONG) -1;
          return val;
      }
  raise_overflow:
      PyErr_SetString(PyExc_OverflowError,
          "value too large to convert to CK_ULONG");
      return (CK_ULONG) -1;
  raise_neg_overflow:
      PyErr_SetString(PyExc_OverflowError,
          "can't convert negative value to CK_ULONG");
      return (CK_ULONG) -1;
  }
  
/* CIntFromPy */
  static CYTHON_INLINE CK_BYTE __Pyx_PyLong_As_CK_BYTE(PyObject *x) {
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wconversion"
  #endif
      const CK_BYTE neg_one = (CK_BYTE) -1, const_zero = (CK_BYTE) 0;
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic pop
  #endif
      const int is_unsigned = neg_one > const_zero;
      if (unlikely(!PyLong_Check(x))) {
          CK_BYTE val;
          PyObject *tmp = __Pyx_PyNumber_Long(x);
          if (!tmp) return (CK_BYTE) -1;
          val = __Pyx_PyLong_As_CK_BYTE(tmp);
          Py_DECREF(tmp);
          return val;
      }
      if (is_unsigned) {
  #if CYTHON_USE_PYLONG_INTERNALS
          if (unlikely(__Pyx_PyLong_IsNeg(x))) {
              goto raise_neg_overflow;
          } else if (__Pyx_PyLong_IsCompact(x)) {
              __PYX_VERIFY_RETURN_INT(CK_BYTE, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
          } else {
              const digit* digits = __Pyx_PyLong_Digits(x);
              assert(__Pyx_PyLong_DigitCount(x) > 1);
              switch (__Pyx_PyLong_DigitCount(x)) {
                  case 2:
                      if ((8 * sizeof(CK_BYTE) > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_BYTE, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_BYTE) >= 2 * PyLong_SHIFT)) {
                              return (CK_BYTE) (((((CK_BYTE)digits[1]) << PyLong_SHIFT) | (CK_BYTE)digits[0]));
                          }
                      }
                      break;
                  case 3:
                      if ((8 * sizeof(CK_BYTE) > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_BYTE, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_BYTE) >= 3 * PyLong_SHIFT)) {
                              return (CK_BYTE) (((((((CK_BYTE)digits[2]) << PyLong_SHIFT) | (CK_BYTE)digits[1]) << PyLong_SHIFT) | (CK_BYTE)digits[0]));
                          }
                      }
                      break;
                  case 4:
                      if ((8 * sizeof(CK_BYTE) > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_BYTE, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_BYTE) >= 4 * PyLong_SHIFT)) {
                              return (CK_BYTE) (((((((((CK_BYTE)digits[3]) << PyLong_SHIFT) | (CK_BYTE)digits[2]) << PyLong_SHIFT) | (CK_BYTE)digits[1]) << PyLong_SHIFT) | (CK_BYTE)digits[0]));
                          }
                      }
                      break;
              }
          }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
          if (unlikely(Py_SIZE(x) < 0)) {
              goto raise_neg_overflow;
          }
  #else
          {
              int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
              if (unlikely(result < 0))
                  return (CK_BYTE) -1;
              if (unlikely(result == 1))
                  goto raise_neg_overflow;
          }
  #endif
          if ((sizeof(CK_BYTE) <= sizeof(unsigned long))) {
              __PYX_VERIFY_RETURN_INT_EXC(CK_BYTE, unsigned long, PyLong_AsUnsignedLong(x))
          } else if ((sizeof(CK_BYTE) <= sizeof(unsigned PY_LONG_LONG))) {
              __PYX_VERIFY_RETURN_INT_EXC(CK_BYTE, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
          }
      } else {
  #if CYTHON_USE_PYLONG_INTERNALS
          if (__Pyx_PyLong_IsCompact(x)) {
              __PYX_VERIFY_RETURN_INT(CK_BYTE, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
          } else {
              const digit* digits = __Pyx_PyLong_Digits(x);
              assert(__Pyx_PyLong_DigitCount(x) > 1);
              switch (__Pyx_PyLong_SignedDigitCount(x)) {
                  case -2:
                      if ((8 * sizeof(CK_BYTE) - 1 > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_BYTE, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_BYTE) - 1 > 2 * PyLong_SHIFT)) {
                              return (CK_BYTE) (((CK_BYTE)-1)*(((((CK_BYTE)digits[1]) << PyLong_SHIFT) | (CK_BYTE)digits[0])));
                          }
                      }
                      break;
                  case 2:
                      if ((8 * sizeof(CK_BYTE) > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_BYTE, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_BYTE) - 1 > 2 * PyLong_SHIFT)) {
                              return (CK_BYTE) ((((((CK_BYTE)digits[1]) << PyLong_SHIFT) | (CK_BYTE)digits[0])));
                          }
                      }
                      break;
                  case -3:
                      if ((8 * sizeof(CK_BYTE) - 1 > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_BYTE, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_BYTE) - 1 > 3 * PyLong_SHIFT)) {
                              return (CK_BYTE) (((CK_BYTE)-1)*(((((((CK_BYTE)digits[2]) << PyLong_SHIFT) | (CK_BYTE)digits[1]) << PyLong_SHIFT) | (CK_BYTE)digits[0])));
                          }
                      }
                      break;
                  case 3:
                      if ((8 * sizeof(CK_BYTE) > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_BYTE, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_BYTE) - 1 > 3 * PyLong_SHIFT)) {
                              return (CK_BYTE) ((((((((CK_BYTE)digits[2]) << PyLong_SHIFT) | (CK_BYTE)digits[1]) << PyLong_SHIFT) | (CK_BYTE)digits[0])));
                          }
                      }
                      break;
                  case -4:
                      if ((8 * sizeof(CK_BYTE) - 1 > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_BYTE, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_BYTE) - 1 > 4 * PyLong_SHIFT)) {
                              return (CK_BYTE) (((CK_BYTE)-1)*(((((((((CK_BYTE)digits[3]) << PyLong_SHIFT) | (CK_BYTE)digits[2]) << PyLong_SHIFT) | (CK_BYTE)digits[1]) << PyLong_SHIFT) | (CK_BYTE)digits[0])));
                          }
                      }
                      break;
                  case 4:
                      if ((8 * sizeof(CK_BYTE) > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_BYTE, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_BYTE) - 1 > 4 * PyLong_SHIFT)) {
                              return (CK_BYTE) ((((((((((CK_BYTE)digits[3]) << PyLong_SHIFT) | (CK_BYTE)digits[2]) << PyLong_SHIFT) | (CK_BYTE)digits[1]) << PyLong_SHIFT) | (CK_BYTE)digits[0])));
                          }
                      }
                      break;
              }
          }
  #endif
          if ((sizeof(CK_BYTE) <= sizeof(long))) {
              __PYX_VERIFY_RETURN_INT_EXC(CK_BYTE, long, PyLong_AsLong(x))
          } else if ((sizeof(CK_BYTE) <= sizeof(PY_LONG_LONG))) {
              __PYX_VERIFY_RETURN_INT_EXC(CK_BYTE, PY_LONG_LONG, PyLong_AsLongLong(x))
          }
      }
      {
          CK_BYTE val;
          int ret = -1;
  #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
          Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
              x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
          if (unlikely(bytes_copied == -1)) {
          } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
              goto raise_overflow;
          } else {
              ret = 0;
          }
  #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
          int one = 1; int is_little = (int)*(unsigned char *)&one;
          unsigned char *bytes = (unsigned char *)&val;
          ret = _PyLong_AsByteArray((PyLongObject *)x,
                                      bytes, sizeof(val),
                                      is_little, !is_unsigned);
  #else
          PyObject *v;
          PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
          int bits, remaining_bits, is_negative = 0;
          int chunk_size = (sizeof(long) < 8) ? 30 : 62;
          if (likely(PyLong_CheckExact(x))) {
              v = __Pyx_NewRef(x);
          } else {
              v = PyNumber_Long(x);
              if (unlikely(!v)) return (CK_BYTE) -1;
              assert(PyLong_CheckExact(v));
          }
          {
              int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
              if (unlikely(result < 0)) {
                  Py_DECREF(v);
                  return (CK_BYTE) -1;
              }
              is_negative = result == 1;
          }
          if (is_unsigned && unlikely(is_negative)) {
              Py_DECREF(v);
              goto raise_neg_overflow;
          } else if (is_negative) {
              stepval = PyNumber_Invert(v);
              Py_DECREF(v);
              if (unlikely(!stepval))
                  return (CK_BYTE) -1;
          } else {
              stepval = v;
          }
          v = NULL;
          val = (CK_BYTE) 0;
          mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
          shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
          for (bits = 0; bits < (int) sizeof(CK_BYTE) * 8 - chunk_size; bits += chunk_size) {
              PyObject *tmp, *digit;
              long idigit;
              digit = PyNumber_And(stepval, mask);
              if (unlikely(!digit)) goto done;
              idigit = PyLong_AsLong(digit);
              Py_DECREF(digit);
              if (unlikely(idigit < 0)) goto done;
              val |= ((CK_BYTE) idigit) << bits;
              tmp = PyNumber_Rshift(stepval, shift);
              if (unlikely(!tmp)) goto done;
              Py_DECREF(stepval); stepval = tmp;
          }
          Py_DECREF(shift); shift = NULL;
          Py_DECREF(mask); mask = NULL;
          {
              long idigit = PyLong_AsLong(stepval);
              if (unlikely(idigit < 0)) goto done;
              remaining_bits = ((int) sizeof(CK_BYTE) * 8) - bits - (is_unsigned ? 0 : 1);
              if (unlikely(idigit >= (1L << remaining_bits)))
                  goto raise_overflow;
              val |= ((CK_BYTE) idigit) << bits;
          }
          if (!is_unsigned) {
              if (unlikely(val & (((CK_BYTE) 1) << (sizeof(CK_BYTE) * 8 - 1))))
                  goto raise_overflow;
              if (is_negative)
                  val = ~val;
          }
          ret = 0;
      done:
          Py_XDECREF(shift);
          Py_XDECREF(mask);
          Py_XDECREF(stepval);
  #endif
          if (unlikely(ret))
              return (CK_BYTE) -1;
          return val;
      }
  raise_overflow:
      PyErr_SetString(PyExc_OverflowError,
          "value too large to convert to CK_BYTE");
      return (CK_BYTE) -1;
  raise_neg_overflow:
      PyErr_SetString(PyExc_OverflowError,
          "can't convert negative value to CK_BYTE");
      return (CK_BYTE) -1;
  }
  
/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyLong_From_CK_BYTE(CK_BYTE value) {
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wconversion"
  #endif
      const CK_BYTE neg_one = (CK_BYTE) -1, const_zero = (CK_BYTE) 0;
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic pop
  #endif
      const int is_unsigned = neg_one > const_zero;
      if (is_unsigned) {
          if (sizeof(CK_BYTE) < sizeof(long)) {
              return PyLong_FromLong((long) value);
          } else if (sizeof(CK_BYTE) <= sizeof(unsigned long)) {
              return PyLong_FromUnsignedLong((unsigned long) value);
  #if !CYTHON_COMPILING_IN_PYPY
          } else if (sizeof(CK_BYTE) <= sizeof(unsigned PY_LONG_LONG)) {
              return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  #endif
          }
      } else {
          if (sizeof(CK_BYTE) <= sizeof(long)) {
              return PyLong_FromLong((long) value);
          } else if (sizeof(CK_BYTE) <= sizeof(PY_LONG_LONG)) {
              return PyLong_FromLongLong((PY_LONG_LONG) value);
          }
      }
      {
          unsigned char *bytes = (unsigned char *)&value;
  #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
          if (is_unsigned) {
              return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
          } else {
              return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
          }
  #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
          int one = 1; int little = (int)*(unsigned char *)&one;
          return _PyLong_FromByteArray(bytes, sizeof(CK_BYTE),
                                       little, !is_unsigned);
  #else
          int one = 1; int little = (int)*(unsigned char *)&one;
          PyObject *from_bytes, *result = NULL, *kwds = NULL;
          PyObject *py_bytes = NULL, *order_str = NULL;
          from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
          if (!from_bytes) return NULL;
          py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(CK_BYTE));
          if (!py_bytes) goto limited_bad;
          order_str = PyUnicode_FromString(little ? "little" : "big");
          if (!order_str) goto limited_bad;
          {
              PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
              if (!is_unsigned) {
                  kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                  if (!kwds) goto limited_bad;
                  if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
              }
              result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
          }
          limited_bad:
          Py_XDECREF(kwds);
          Py_XDECREF(order_str);
          Py_XDECREF(py_bytes);
          Py_XDECREF(from_bytes);
          return result;
  #endif
      }
  }
  
/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyLong_From_CK_USER_TYPE(CK_USER_TYPE value) {
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wconversion"
  #endif
      const CK_USER_TYPE neg_one = (CK_USER_TYPE) -1, const_zero = (CK_USER_TYPE) 0;
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic pop
  #endif
      const int is_unsigned = neg_one > const_zero;
      if (is_unsigned) {
          if (sizeof(CK_USER_TYPE) < sizeof(long)) {
              return PyLong_FromLong((long) value);
          } else if (sizeof(CK_USER_TYPE) <= sizeof(unsigned long)) {
              return PyLong_FromUnsignedLong((unsigned long) value);
  #if !CYTHON_COMPILING_IN_PYPY
          } else if (sizeof(CK_USER_TYPE) <= sizeof(unsigned PY_LONG_LONG)) {
              return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  #endif
          }
      } else {
          if (sizeof(CK_USER_TYPE) <= sizeof(long)) {
              return PyLong_FromLong((long) value);
          } else if (sizeof(CK_USER_TYPE) <= sizeof(PY_LONG_LONG)) {
              return PyLong_FromLongLong((PY_LONG_LONG) value);
          }
      }
      {
          unsigned char *bytes = (unsigned char *)&value;
  #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
          if (is_unsigned) {
              return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
          } else {
              return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
          }
  #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
          int one = 1; int little = (int)*(unsigned char *)&one;
          return _PyLong_FromByteArray(bytes, sizeof(CK_USER_TYPE),
                                       little, !is_unsigned);
  #else
          int one = 1; int little = (int)*(unsigned char *)&one;
          PyObject *from_bytes, *result = NULL, *kwds = NULL;
          PyObject *py_bytes = NULL, *order_str = NULL;
          from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
          if (!from_bytes) return NULL;
          py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(CK_USER_TYPE));
          if (!py_bytes) goto limited_bad;
          order_str = PyUnicode_FromString(little ? "little" : "big");
          if (!order_str) goto limited_bad;
          {
              PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
              if (!is_unsigned) {
                  kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                  if (!kwds) goto limited_bad;
                  if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
              }
              result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
          }
          limited_bad:
          Py_XDECREF(kwds);
          Py_XDECREF(order_str);
          Py_XDECREF(py_bytes);
          Py_XDECREF(from_bytes);
          return result;
  #endif
      }
  }
  
/* CIntFromPy */
  static CYTHON_INLINE CK_USER_TYPE __Pyx_PyLong_As_CK_USER_TYPE(PyObject *x) {
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wconversion"
  #endif
      const CK_USER_TYPE neg_one = (CK_USER_TYPE) -1, const_zero = (CK_USER_TYPE) 0;
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic pop
  #endif
      const int is_unsigned = neg_one > const_zero;
      if (unlikely(!PyLong_Check(x))) {
          CK_USER_TYPE val;
          PyObject *tmp = __Pyx_PyNumber_Long(x);
          if (!tmp) return (CK_USER_TYPE) -1;
          val = __Pyx_PyLong_As_CK_USER_TYPE(tmp);
          Py_DECREF(tmp);
          return val;
      }
      if (is_unsigned) {
  #if CYTHON_USE_PYLONG_INTERNALS
          if (unlikely(__Pyx_PyLong_IsNeg(x))) {
              goto raise_neg_overflow;
          } else if (__Pyx_PyLong_IsCompact(x)) {
              __PYX_VERIFY_RETURN_INT(CK_USER_TYPE, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
          } else {
              const digit* digits = __Pyx_PyLong_Digits(x);
              assert(__Pyx_PyLong_DigitCount(x) > 1);
              switch (__Pyx_PyLong_DigitCount(x)) {
                  case 2:
                      if ((8 * sizeof(CK_USER_TYPE) > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_USER_TYPE, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_USER_TYPE) >= 2 * PyLong_SHIFT)) {
                              return (CK_USER_TYPE) (((((CK_USER_TYPE)digits[1]) << PyLong_SHIFT) | (CK_USER_TYPE)digits[0]));
                          }
                      }
                      break;
                  case 3:
                      if ((8 * sizeof(CK_USER_TYPE) > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_USER_TYPE, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_USER_TYPE) >= 3 * PyLong_SHIFT)) {
                              return (CK_USER_TYPE) (((((((CK_USER_TYPE)digits[2]) << PyLong_SHIFT) | (CK_USER_TYPE)digits[1]) << PyLong_SHIFT) | (CK_USER_TYPE)digits[0]));
                          }
                      }
                      break;
                  case 4:
                      if ((8 * sizeof(CK_USER_TYPE) > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_USER_TYPE, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_USER_TYPE) >= 4 * PyLong_SHIFT)) {
                              return (CK_USER_TYPE) (((((((((CK_USER_TYPE)digits[3]) << PyLong_SHIFT) | (CK_USER_TYPE)digits[2]) << PyLong_SHIFT) | (CK_USER_TYPE)digits[1]) << PyLong_SHIFT) | (CK_USER_TYPE)digits[0]));
                          }
                      }
                      break;
              }
          }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
          if (unlikely(Py_SIZE(x) < 0)) {
              goto raise_neg_overflow;
          }
  #else
          {
              int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
              if (unlikely(result < 0))
                  return (CK_USER_TYPE) -1;
              if (unlikely(result == 1))
                  goto raise_neg_overflow;
          }
  #endif
          if ((sizeof(CK_USER_TYPE) <= sizeof(unsigned long))) {
              __PYX_VERIFY_RETURN_INT_EXC(CK_USER_TYPE, unsigned long, PyLong_AsUnsignedLong(x))
          } else if ((sizeof(CK_USER_TYPE) <= sizeof(unsigned PY_LONG_LONG))) {
              __PYX_VERIFY_RETURN_INT_EXC(CK_USER_TYPE, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
          }
      } else {
  #if CYTHON_USE_PYLONG_INTERNALS
          if (__Pyx_PyLong_IsCompact(x)) {
              __PYX_VERIFY_RETURN_INT(CK_USER_TYPE, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
          } else {
              const digit* digits = __Pyx_PyLong_Digits(x);
              assert(__Pyx_PyLong_DigitCount(x) > 1);
              switch (__Pyx_PyLong_SignedDigitCount(x)) {
                  case -2:
                      if ((8 * sizeof(CK_USER_TYPE) - 1 > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_USER_TYPE, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_USER_TYPE) - 1 > 2 * PyLong_SHIFT)) {
                              return (CK_USER_TYPE) (((CK_USER_TYPE)-1)*(((((CK_USER_TYPE)digits[1]) << PyLong_SHIFT) | (CK_USER_TYPE)digits[0])));
                          }
                      }
                      break;
                  case 2:
                      if ((8 * sizeof(CK_USER_TYPE) > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_USER_TYPE, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_USER_TYPE) - 1 > 2 * PyLong_SHIFT)) {
                              return (CK_USER_TYPE) ((((((CK_USER_TYPE)digits[1]) << PyLong_SHIFT) | (CK_USER_TYPE)digits[0])));
                          }
                      }
                      break;
                  case -3:
                      if ((8 * sizeof(CK_USER_TYPE) - 1 > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_USER_TYPE, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_USER_TYPE) - 1 > 3 * PyLong_SHIFT)) {
                              return (CK_USER_TYPE) (((CK_USER_TYPE)-1)*(((((((CK_USER_TYPE)digits[2]) << PyLong_SHIFT) | (CK_USER_TYPE)digits[1]) << PyLong_SHIFT) | (CK_USER_TYPE)digits[0])));
                          }
                      }
                      break;
                  case 3:
                      if ((8 * sizeof(CK_USER_TYPE) > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_USER_TYPE, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_USER_TYPE) - 1 > 3 * PyLong_SHIFT)) {
                              return (CK_USER_TYPE) ((((((((CK_USER_TYPE)digits[2]) << PyLong_SHIFT) | (CK_USER_TYPE)digits[1]) << PyLong_SHIFT) | (CK_USER_TYPE)digits[0])));
                          }
                      }
                      break;
                  case -4:
                      if ((8 * sizeof(CK_USER_TYPE) - 1 > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_USER_TYPE, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_USER_TYPE) - 1 > 4 * PyLong_SHIFT)) {
                              return (CK_USER_TYPE) (((CK_USER_TYPE)-1)*(((((((((CK_USER_TYPE)digits[3]) << PyLong_SHIFT) | (CK_USER_TYPE)digits[2]) << PyLong_SHIFT) | (CK_USER_TYPE)digits[1]) << PyLong_SHIFT) | (CK_USER_TYPE)digits[0])));
                          }
                      }
                      break;
                  case 4:
                      if ((8 * sizeof(CK_USER_TYPE) > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_USER_TYPE, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_USER_TYPE) - 1 > 4 * PyLong_SHIFT)) {
                              return (CK_USER_TYPE) ((((((((((CK_USER_TYPE)digits[3]) << PyLong_SHIFT) | (CK_USER_TYPE)digits[2]) << PyLong_SHIFT) | (CK_USER_TYPE)digits[1]) << PyLong_SHIFT) | (CK_USER_TYPE)digits[0])));
                          }
                      }
                      break;
              }
          }
  #endif
          if ((sizeof(CK_USER_TYPE) <= sizeof(long))) {
              __PYX_VERIFY_RETURN_INT_EXC(CK_USER_TYPE, long, PyLong_AsLong(x))
          } else if ((sizeof(CK_USER_TYPE) <= sizeof(PY_LONG_LONG))) {
              __PYX_VERIFY_RETURN_INT_EXC(CK_USER_TYPE, PY_LONG_LONG, PyLong_AsLongLong(x))
          }
      }
      {
          CK_USER_TYPE val;
          int ret = -1;
  #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
          Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
              x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
          if (unlikely(bytes_copied == -1)) {
          } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
              goto raise_overflow;
          } else {
              ret = 0;
          }
  #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
          int one = 1; int is_little = (int)*(unsigned char *)&one;
          unsigned char *bytes = (unsigned char *)&val;
          ret = _PyLong_AsByteArray((PyLongObject *)x,
                                      bytes, sizeof(val),
                                      is_little, !is_unsigned);
  #else
          PyErr_SetString(PyExc_RuntimeError,
                          "_PyLong_AsByteArray() or PyLong_AsNativeBytes() not available, cannot convert large enums");
          val = (CK_USER_TYPE) -1;
  #endif
          if (unlikely(ret))
              return (CK_USER_TYPE) -1;
          return val;
      }
  raise_overflow:
      PyErr_SetString(PyExc_OverflowError,
          "value too large to convert to CK_USER_TYPE");
      return (CK_USER_TYPE) -1;
  raise_neg_overflow:
      PyErr_SetString(PyExc_OverflowError,
          "can't convert negative value to CK_USER_TYPE");
      return (CK_USER_TYPE) -1;
  }
  
/* CIntFromPy */
  static CYTHON_INLINE unsigned int __Pyx_PyLong_As_unsigned_int(PyObject *x) {
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wconversion"
  #endif
      const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0;
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic pop
  #endif
      const int is_unsigned = neg_one > const_zero;
      if (unlikely(!PyLong_Check(x))) {
          unsigned int val;
          PyObject *tmp = __Pyx_PyNumber_Long(x);
          if (!tmp) return (unsigned int) -1;
          val = __Pyx_PyLong_As_unsigned_int(tmp);
          Py_DECREF(tmp);
          return val;
      }
      if (is_unsigned) {
  #if CYTHON_USE_PYLONG_INTERNALS
          if (unlikely(__Pyx_PyLong_IsNeg(x))) {
              goto raise_neg_overflow;
          } else if (__Pyx_PyLong_IsCompact(x)) {
              __PYX_VERIFY_RETURN_INT(unsigned int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
          } else {
              const digit* digits = __Pyx_PyLong_Digits(x);
              assert(__Pyx_PyLong_DigitCount(x) > 1);
              switch (__Pyx_PyLong_DigitCount(x)) {
                  case 2:
                      if ((8 * sizeof(unsigned int) > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(unsigned int) >= 2 * PyLong_SHIFT)) {
                              return (unsigned int) (((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
                          }
                      }
                      break;
                  case 3:
                      if ((8 * sizeof(unsigned int) > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(unsigned int) >= 3 * PyLong_SHIFT)) {
                              return (unsigned int) (((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
                          }
                      }
                      break;
                  case 4:
                      if ((8 * sizeof(unsigned int) > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(unsigned int) >= 4 * PyLong_SHIFT)) {
                              return (unsigned int) (((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
                          }
                      }
                      break;
              }
          }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
          if (unlikely(Py_SIZE(x) < 0)) {
              goto raise_neg_overflow;
          }
  #else
          {
              int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
              if (unlikely(result < 0))
                  return (unsigned int) -1;
              if (unlikely(result == 1))
                  goto raise_neg_overflow;
          }
  #endif
          if ((sizeof(unsigned int) <= sizeof(unsigned long))) {
              __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned long, PyLong_AsUnsignedLong(x))
          } else if ((sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG))) {
              __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
          }
      } else {
  #if CYTHON_USE_PYLONG_INTERNALS
          if (__Pyx_PyLong_IsCompact(x)) {
              __PYX_VERIFY_RETURN_INT(unsigned int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
          } else {
              const digit* digits = __Pyx_PyLong_Digits(x);
              assert(__Pyx_PyLong_DigitCount(x) > 1);
              switch (__Pyx_PyLong_SignedDigitCount(x)) {
                  case -2:
                      if ((8 * sizeof(unsigned int) - 1 > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT)) {
                              return (unsigned int) (((unsigned int)-1)*(((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                          }
                      }
                      break;
                  case 2:
                      if ((8 * sizeof(unsigned int) > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT)) {
                              return (unsigned int) ((((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                          }
                      }
                      break;
                  case -3:
                      if ((8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT)) {
                              return (unsigned int) (((unsigned int)-1)*(((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                          }
                      }
                      break;
                  case 3:
                      if ((8 * sizeof(unsigned int) > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT)) {
                              return (unsigned int) ((((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                          }
                      }
                      break;
                  case -4:
                      if ((8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT)) {
                              return (unsigned int) (((unsigned int)-1)*(((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                          }
                      }
                      break;
                  case 4:
                      if ((8 * sizeof(unsigned int) > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT)) {
                              return (unsigned int) ((((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                          }
                      }
                      break;
              }
          }
  #endif
          if ((sizeof(unsigned int) <= sizeof(long))) {
              __PYX_VERIFY_RETURN_INT_EXC(unsigned int, long, PyLong_AsLong(x))
          } else if ((sizeof(unsigned int) <= sizeof(PY_LONG_LONG))) {
              __PYX_VERIFY_RETURN_INT_EXC(unsigned int, PY_LONG_LONG, PyLong_AsLongLong(x))
          }
      }
      {
          unsigned int val;
          int ret = -1;
  #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
          Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
              x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
          if (unlikely(bytes_copied == -1)) {
          } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
              goto raise_overflow;
          } else {
              ret = 0;
          }
  #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
          int one = 1; int is_little = (int)*(unsigned char *)&one;
          unsigned char *bytes = (unsigned char *)&val;
          ret = _PyLong_AsByteArray((PyLongObject *)x,
                                      bytes, sizeof(val),
                                      is_little, !is_unsigned);
  #else
          PyObject *v;
          PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
          int bits, remaining_bits, is_negative = 0;
          int chunk_size = (sizeof(long) < 8) ? 30 : 62;
          if (likely(PyLong_CheckExact(x))) {
              v = __Pyx_NewRef(x);
          } else {
              v = PyNumber_Long(x);
              if (unlikely(!v)) return (unsigned int) -1;
              assert(PyLong_CheckExact(v));
          }
          {
              int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
              if (unlikely(result < 0)) {
                  Py_DECREF(v);
                  return (unsigned int) -1;
              }
              is_negative = result == 1;
          }
          if (is_unsigned && unlikely(is_negative)) {
              Py_DECREF(v);
              goto raise_neg_overflow;
          } else if (is_negative) {
              stepval = PyNumber_Invert(v);
              Py_DECREF(v);
              if (unlikely(!stepval))
                  return (unsigned int) -1;
          } else {
              stepval = v;
          }
          v = NULL;
          val = (unsigned int) 0;
          mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
          shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
          for (bits = 0; bits < (int) sizeof(unsigned int) * 8 - chunk_size; bits += chunk_size) {
              PyObject *tmp, *digit;
              long idigit;
              digit = PyNumber_And(stepval, mask);
              if (unlikely(!digit)) goto done;
              idigit = PyLong_AsLong(digit);
              Py_DECREF(digit);
              if (unlikely(idigit < 0)) goto done;
              val |= ((unsigned int) idigit) << bits;
              tmp = PyNumber_Rshift(stepval, shift);
              if (unlikely(!tmp)) goto done;
              Py_DECREF(stepval); stepval = tmp;
          }
          Py_DECREF(shift); shift = NULL;
          Py_DECREF(mask); mask = NULL;
          {
              long idigit = PyLong_AsLong(stepval);
              if (unlikely(idigit < 0)) goto done;
              remaining_bits = ((int) sizeof(unsigned int) * 8) - bits - (is_unsigned ? 0 : 1);
              if (unlikely(idigit >= (1L << remaining_bits)))
                  goto raise_overflow;
              val |= ((unsigned int) idigit) << bits;
          }
          if (!is_unsigned) {
              if (unlikely(val & (((unsigned int) 1) << (sizeof(unsigned int) * 8 - 1))))
                  goto raise_overflow;
              if (is_negative)
                  val = ~val;
          }
          ret = 0;
      done:
          Py_XDECREF(shift);
          Py_XDECREF(mask);
          Py_XDECREF(stepval);
  #endif
          if (unlikely(ret))
              return (unsigned int) -1;
          return val;
      }
  raise_overflow:
      PyErr_SetString(PyExc_OverflowError,
          "value too large to convert to unsigned int");
      return (unsigned int) -1;
  raise_neg_overflow:
      PyErr_SetString(PyExc_OverflowError,
          "can't convert negative value to unsigned int");
      return (unsigned int) -1;
  }
  
/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyLong_From_CK_CHAR(CK_CHAR value) {
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wconversion"
  #endif
      const CK_CHAR neg_one = (CK_CHAR) -1, const_zero = (CK_CHAR) 0;
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic pop
  #endif
      const int is_unsigned = neg_one > const_zero;
      if (is_unsigned) {
          if (sizeof(CK_CHAR) < sizeof(long)) {
              return PyLong_FromLong((long) value);
          } else if (sizeof(CK_CHAR) <= sizeof(unsigned long)) {
              return PyLong_FromUnsignedLong((unsigned long) value);
  #if !CYTHON_COMPILING_IN_PYPY
          } else if (sizeof(CK_CHAR) <= sizeof(unsigned PY_LONG_LONG)) {
              return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  #endif
          }
      } else {
          if (sizeof(CK_CHAR) <= sizeof(long)) {
              return PyLong_FromLong((long) value);
          } else if (sizeof(CK_CHAR) <= sizeof(PY_LONG_LONG)) {
              return PyLong_FromLongLong((PY_LONG_LONG) value);
          }
      }
      {
          unsigned char *bytes = (unsigned char *)&value;
  #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
          if (is_unsigned) {
              return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
          } else {
              return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
          }
  #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
          int one = 1; int little = (int)*(unsigned char *)&one;
          return _PyLong_FromByteArray(bytes, sizeof(CK_CHAR),
                                       little, !is_unsigned);
  #else
          int one = 1; int little = (int)*(unsigned char *)&one;
          PyObject *from_bytes, *result = NULL, *kwds = NULL;
          PyObject *py_bytes = NULL, *order_str = NULL;
          from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
          if (!from_bytes) return NULL;
          py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(CK_CHAR));
          if (!py_bytes) goto limited_bad;
          order_str = PyUnicode_FromString(little ? "little" : "big");
          if (!order_str) goto limited_bad;
          {
              PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
              if (!is_unsigned) {
                  kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                  if (!kwds) goto limited_bad;
                  if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
              }
              result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
          }
          limited_bad:
          Py_XDECREF(kwds);
          Py_XDECREF(order_str);
          Py_XDECREF(py_bytes);
          Py_XDECREF(from_bytes);
          return result;
  #endif
      }
  }
  
/* CIntFromPy */
  static CYTHON_INLINE CK_CHAR __Pyx_PyLong_As_CK_CHAR(PyObject *x) {
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wconversion"
  #endif
      const CK_CHAR neg_one = (CK_CHAR) -1, const_zero = (CK_CHAR) 0;
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic pop
  #endif
      const int is_unsigned = neg_one > const_zero;
      if (unlikely(!PyLong_Check(x))) {
          CK_CHAR val;
          PyObject *tmp = __Pyx_PyNumber_Long(x);
          if (!tmp) return (CK_CHAR) -1;
          val = __Pyx_PyLong_As_CK_CHAR(tmp);
          Py_DECREF(tmp);
          return val;
      }
      if (is_unsigned) {
  #if CYTHON_USE_PYLONG_INTERNALS
          if (unlikely(__Pyx_PyLong_IsNeg(x))) {
              goto raise_neg_overflow;
          } else if (__Pyx_PyLong_IsCompact(x)) {
              __PYX_VERIFY_RETURN_INT(CK_CHAR, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
          } else {
              const digit* digits = __Pyx_PyLong_Digits(x);
              assert(__Pyx_PyLong_DigitCount(x) > 1);
              switch (__Pyx_PyLong_DigitCount(x)) {
                  case 2:
                      if ((8 * sizeof(CK_CHAR) > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_CHAR, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_CHAR) >= 2 * PyLong_SHIFT)) {
                              return (CK_CHAR) (((((CK_CHAR)digits[1]) << PyLong_SHIFT) | (CK_CHAR)digits[0]));
                          }
                      }
                      break;
                  case 3:
                      if ((8 * sizeof(CK_CHAR) > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_CHAR, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_CHAR) >= 3 * PyLong_SHIFT)) {
                              return (CK_CHAR) (((((((CK_CHAR)digits[2]) << PyLong_SHIFT) | (CK_CHAR)digits[1]) << PyLong_SHIFT) | (CK_CHAR)digits[0]));
                          }
                      }
                      break;
                  case 4:
                      if ((8 * sizeof(CK_CHAR) > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_CHAR, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_CHAR) >= 4 * PyLong_SHIFT)) {
                              return (CK_CHAR) (((((((((CK_CHAR)digits[3]) << PyLong_SHIFT) | (CK_CHAR)digits[2]) << PyLong_SHIFT) | (CK_CHAR)digits[1]) << PyLong_SHIFT) | (CK_CHAR)digits[0]));
                          }
                      }
                      break;
              }
          }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
          if (unlikely(Py_SIZE(x) < 0)) {
              goto raise_neg_overflow;
          }
  #else
          {
              int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
              if (unlikely(result < 0))
                  return (CK_CHAR) -1;
              if (unlikely(result == 1))
                  goto raise_neg_overflow;
          }
  #endif
          if ((sizeof(CK_CHAR) <= sizeof(unsigned long))) {
              __PYX_VERIFY_RETURN_INT_EXC(CK_CHAR, unsigned long, PyLong_AsUnsignedLong(x))
          } else if ((sizeof(CK_CHAR) <= sizeof(unsigned PY_LONG_LONG))) {
              __PYX_VERIFY_RETURN_INT_EXC(CK_CHAR, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
          }
      } else {
  #if CYTHON_USE_PYLONG_INTERNALS
          if (__Pyx_PyLong_IsCompact(x)) {
              __PYX_VERIFY_RETURN_INT(CK_CHAR, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
          } else {
              const digit* digits = __Pyx_PyLong_Digits(x);
              assert(__Pyx_PyLong_DigitCount(x) > 1);
              switch (__Pyx_PyLong_SignedDigitCount(x)) {
                  case -2:
                      if ((8 * sizeof(CK_CHAR) - 1 > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_CHAR, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_CHAR) - 1 > 2 * PyLong_SHIFT)) {
                              return (CK_CHAR) (((CK_CHAR)-1)*(((((CK_CHAR)digits[1]) << PyLong_SHIFT) | (CK_CHAR)digits[0])));
                          }
                      }
                      break;
                  case 2:
                      if ((8 * sizeof(CK_CHAR) > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_CHAR, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_CHAR) - 1 > 2 * PyLong_SHIFT)) {
                              return (CK_CHAR) ((((((CK_CHAR)digits[1]) << PyLong_SHIFT) | (CK_CHAR)digits[0])));
                          }
                      }
                      break;
                  case -3:
                      if ((8 * sizeof(CK_CHAR) - 1 > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_CHAR, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_CHAR) - 1 > 3 * PyLong_SHIFT)) {
                              return (CK_CHAR) (((CK_CHAR)-1)*(((((((CK_CHAR)digits[2]) << PyLong_SHIFT) | (CK_CHAR)digits[1]) << PyLong_SHIFT) | (CK_CHAR)digits[0])));
                          }
                      }
                      break;
                  case 3:
                      if ((8 * sizeof(CK_CHAR) > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_CHAR, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_CHAR) - 1 > 3 * PyLong_SHIFT)) {
                              return (CK_CHAR) ((((((((CK_CHAR)digits[2]) << PyLong_SHIFT) | (CK_CHAR)digits[1]) << PyLong_SHIFT) | (CK_CHAR)digits[0])));
                          }
                      }
                      break;
                  case -4:
                      if ((8 * sizeof(CK_CHAR) - 1 > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_CHAR, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_CHAR) - 1 > 4 * PyLong_SHIFT)) {
                              return (CK_CHAR) (((CK_CHAR)-1)*(((((((((CK_CHAR)digits[3]) << PyLong_SHIFT) | (CK_CHAR)digits[2]) << PyLong_SHIFT) | (CK_CHAR)digits[1]) << PyLong_SHIFT) | (CK_CHAR)digits[0])));
                          }
                      }
                      break;
                  case 4:
                      if ((8 * sizeof(CK_CHAR) > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(CK_CHAR, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(CK_CHAR) - 1 > 4 * PyLong_SHIFT)) {
                              return (CK_CHAR) ((((((((((CK_CHAR)digits[3]) << PyLong_SHIFT) | (CK_CHAR)digits[2]) << PyLong_SHIFT) | (CK_CHAR)digits[1]) << PyLong_SHIFT) | (CK_CHAR)digits[0])));
                          }
                      }
                      break;
              }
          }
  #endif
          if ((sizeof(CK_CHAR) <= sizeof(long))) {
              __PYX_VERIFY_RETURN_INT_EXC(CK_CHAR, long, PyLong_AsLong(x))
          } else if ((sizeof(CK_CHAR) <= sizeof(PY_LONG_LONG))) {
              __PYX_VERIFY_RETURN_INT_EXC(CK_CHAR, PY_LONG_LONG, PyLong_AsLongLong(x))
          }
      }
      {
          CK_CHAR val;
          int ret = -1;
  #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
          Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
              x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
          if (unlikely(bytes_copied == -1)) {
          } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
              goto raise_overflow;
          } else {
              ret = 0;
          }
  #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
          int one = 1; int is_little = (int)*(unsigned char *)&one;
          unsigned char *bytes = (unsigned char *)&val;
          ret = _PyLong_AsByteArray((PyLongObject *)x,
                                      bytes, sizeof(val),
                                      is_little, !is_unsigned);
  #else
          PyObject *v;
          PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
          int bits, remaining_bits, is_negative = 0;
          int chunk_size = (sizeof(long) < 8) ? 30 : 62;
          if (likely(PyLong_CheckExact(x))) {
              v = __Pyx_NewRef(x);
          } else {
              v = PyNumber_Long(x);
              if (unlikely(!v)) return (CK_CHAR) -1;
              assert(PyLong_CheckExact(v));
          }
          {
              int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
              if (unlikely(result < 0)) {
                  Py_DECREF(v);
                  return (CK_CHAR) -1;
              }
              is_negative = result == 1;
          }
          if (is_unsigned && unlikely(is_negative)) {
              Py_DECREF(v);
              goto raise_neg_overflow;
          } else if (is_negative) {
              stepval = PyNumber_Invert(v);
              Py_DECREF(v);
              if (unlikely(!stepval))
                  return (CK_CHAR) -1;
          } else {
              stepval = v;
          }
          v = NULL;
          val = (CK_CHAR) 0;
          mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
          shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
          for (bits = 0; bits < (int) sizeof(CK_CHAR) * 8 - chunk_size; bits += chunk_size) {
              PyObject *tmp, *digit;
              long idigit;
              digit = PyNumber_And(stepval, mask);
              if (unlikely(!digit)) goto done;
              idigit = PyLong_AsLong(digit);
              Py_DECREF(digit);
              if (unlikely(idigit < 0)) goto done;
              val |= ((CK_CHAR) idigit) << bits;
              tmp = PyNumber_Rshift(stepval, shift);
              if (unlikely(!tmp)) goto done;
              Py_DECREF(stepval); stepval = tmp;
          }
          Py_DECREF(shift); shift = NULL;
          Py_DECREF(mask); mask = NULL;
          {
              long idigit = PyLong_AsLong(stepval);
              if (unlikely(idigit < 0)) goto done;
              remaining_bits = ((int) sizeof(CK_CHAR) * 8) - bits - (is_unsigned ? 0 : 1);
              if (unlikely(idigit >= (1L << remaining_bits)))
                  goto raise_overflow;
              val |= ((CK_CHAR) idigit) << bits;
          }
          if (!is_unsigned) {
              if (unlikely(val & (((CK_CHAR) 1) << (sizeof(CK_CHAR) * 8 - 1))))
                  goto raise_overflow;
              if (is_negative)
                  val = ~val;
          }
          ret = 0;
      done:
          Py_XDECREF(shift);
          Py_XDECREF(mask);
          Py_XDECREF(stepval);
  #endif
          if (unlikely(ret))
              return (CK_CHAR) -1;
          return val;
      }
  raise_overflow:
      PyErr_SetString(PyExc_OverflowError,
          "value too large to convert to CK_CHAR");
      return (CK_CHAR) -1;
  raise_neg_overflow:
      PyErr_SetString(PyExc_OverflowError,
          "can't convert negative value to CK_CHAR");
      return (CK_CHAR) -1;
  }
  
/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value) {
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wconversion"
  #endif
      const long neg_one = (long) -1, const_zero = (long) 0;
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic pop
  #endif
      const int is_unsigned = neg_one > const_zero;
      if (is_unsigned) {
          if (sizeof(long) < sizeof(long)) {
              return PyLong_FromLong((long) value);
          } else if (sizeof(long) <= sizeof(unsigned long)) {
              return PyLong_FromUnsignedLong((unsigned long) value);
  #if !CYTHON_COMPILING_IN_PYPY
          } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
              return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  #endif
          }
      } else {
          if (sizeof(long) <= sizeof(long)) {
              return PyLong_FromLong((long) value);
          } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
              return PyLong_FromLongLong((PY_LONG_LONG) value);
          }
      }
      {
          unsigned char *bytes = (unsigned char *)&value;
  #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
          if (is_unsigned) {
              return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
          } else {
              return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
          }
  #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
          int one = 1; int little = (int)*(unsigned char *)&one;
          return _PyLong_FromByteArray(bytes, sizeof(long),
                                       little, !is_unsigned);
  #else
          int one = 1; int little = (int)*(unsigned char *)&one;
          PyObject *from_bytes, *result = NULL, *kwds = NULL;
          PyObject *py_bytes = NULL, *order_str = NULL;
          from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
          if (!from_bytes) return NULL;
          py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long));
          if (!py_bytes) goto limited_bad;
          order_str = PyUnicode_FromString(little ? "little" : "big");
          if (!order_str) goto limited_bad;
          {
              PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
              if (!is_unsigned) {
                  kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                  if (!kwds) goto limited_bad;
                  if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
              }
              result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
          }
          limited_bad:
          Py_XDECREF(kwds);
          Py_XDECREF(order_str);
          Py_XDECREF(py_bytes);
          Py_XDECREF(from_bytes);
          return result;
  #endif
      }
  }
  
/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyLong_From_unsigned_int(unsigned int value) {
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wconversion"
  #endif
      const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0;
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic pop
  #endif
      const int is_unsigned = neg_one > const_zero;
      if (is_unsigned) {
          if (sizeof(unsigned int) < sizeof(long)) {
              return PyLong_FromLong((long) value);
          } else if (sizeof(unsigned int) <= sizeof(unsigned long)) {
              return PyLong_FromUnsignedLong((unsigned long) value);
  #if !CYTHON_COMPILING_IN_PYPY
          } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) {
              return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  #endif
          }
      } else {
          if (sizeof(unsigned int) <= sizeof(long)) {
              return PyLong_FromLong((long) value);
          } else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) {
              return PyLong_FromLongLong((PY_LONG_LONG) value);
          }
      }
      {
          unsigned char *bytes = (unsigned char *)&value;
  #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
          if (is_unsigned) {
              return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
          } else {
              return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
          }
  #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
          int one = 1; int little = (int)*(unsigned char *)&one;
          return _PyLong_FromByteArray(bytes, sizeof(unsigned int),
                                       little, !is_unsigned);
  #else
          int one = 1; int little = (int)*(unsigned char *)&one;
          PyObject *from_bytes, *result = NULL, *kwds = NULL;
          PyObject *py_bytes = NULL, *order_str = NULL;
          from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
          if (!from_bytes) return NULL;
          py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(unsigned int));
          if (!py_bytes) goto limited_bad;
          order_str = PyUnicode_FromString(little ? "little" : "big");
          if (!order_str) goto limited_bad;
          {
              PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
              if (!is_unsigned) {
                  kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                  if (!kwds) goto limited_bad;
                  if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
              }
              result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
          }
          limited_bad:
          Py_XDECREF(kwds);
          Py_XDECREF(order_str);
          Py_XDECREF(py_bytes);
          Py_XDECREF(from_bytes);
          return result;
  #endif
      }
  }
  
/* UpdateUnpickledDict */
  static int __Pyx__UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index) {
      PyObject *state_dict = __Pyx_PySequence_ITEM(state, index);
      if (unlikely(!state_dict)) {
          return -1;
      }
      int non_empty = PyObject_IsTrue(state_dict);
      if (non_empty == 0) {
          Py_DECREF(state_dict);
          return 0;
      } else if (unlikely(non_empty == -1)) {
          return -1;
      }
      PyObject *dict;
      #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
      dict = PyObject_GetAttrString(obj, "__dict__");
      #else
      dict = PyObject_GenericGetDict(obj, NULL);
      #endif
      if (unlikely(!dict)) {
          Py_DECREF(state_dict);
          return -1;
      }
      int result;
      if (likely(PyDict_CheckExact(dict))) {
          result = PyDict_Update(dict, state_dict);
      } else {
          PyObject *obj_result = __Pyx_PyObject_CallMethod1(dict, __pyx_mstate_global->__pyx_n_u_update, state_dict);
          if (likely(obj_result)) {
              Py_DECREF(obj_result);
              result = 0;
          } else {
              result = -1;
          }
      }
      Py_DECREF(state_dict);
      Py_DECREF(dict);
      return result;
  }
  static int __Pyx_UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index) {
      Py_ssize_t state_size = __Pyx_PyTuple_GET_SIZE(state);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely(state_size == -1)) return -1;
      #endif
      if (state_size <= index) {
          return 0;
      }
      return __Pyx__UpdateUnpickledDict(obj, state, index);
  }
  
/* CheckUnpickleChecksum */
  static void __Pyx_RaiseUnpickleChecksumError(long checksum, long checksum1, long checksum2, long checksum3, const char *members) {
      PyObject *pickle_module = PyImport_ImportModule("pickle");
      if (unlikely(!pickle_module)) return;
      PyObject *pickle_error = PyObject_GetAttrString(pickle_module, "PickleError");
      Py_DECREF(pickle_module);
      if (unlikely(!pickle_error)) return;
      if (checksum2 == checksum1) {
          PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x) = (%s))",
              checksum, checksum1, members);
      } else if (checksum3 == checksum2) {
          PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x, 0x%x) = (%s))",
              checksum, checksum1, checksum2, members);
      } else {
          PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x, 0x%x, 0x%x) = (%s))",
              checksum, checksum1, checksum2, checksum3, members);
      }
      Py_DECREF(pickle_error);
  }
  static int __Pyx_CheckUnpickleChecksum(long checksum, long checksum1, long checksum2, long checksum3, const char *members) {
      int found = 0;
      found |= checksum1 == checksum;
      found |= checksum2 == checksum;
      found |= checksum3 == checksum;
      if (likely(found))
          return 0;
      __Pyx_RaiseUnpickleChecksumError(checksum, checksum1, checksum2, checksum3, members);
      return -1;
  }
  
/* CIntFromPy */
  static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *x) {
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wconversion"
  #endif
      const int neg_one = (int) -1, const_zero = (int) 0;
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic pop
  #endif
      const int is_unsigned = neg_one > const_zero;
      if (unlikely(!PyLong_Check(x))) {
          int val;
          PyObject *tmp = __Pyx_PyNumber_Long(x);
          if (!tmp) return (int) -1;
          val = __Pyx_PyLong_As_int(tmp);
          Py_DECREF(tmp);
          return val;
      }
      if (is_unsigned) {
  #if CYTHON_USE_PYLONG_INTERNALS
          if (unlikely(__Pyx_PyLong_IsNeg(x))) {
              goto raise_neg_overflow;
          } else if (__Pyx_PyLong_IsCompact(x)) {
              __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
          } else {
              const digit* digits = __Pyx_PyLong_Digits(x);
              assert(__Pyx_PyLong_DigitCount(x) > 1);
              switch (__Pyx_PyLong_DigitCount(x)) {
                  case 2:
                      if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) {
                              return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                          }
                      }
                      break;
                  case 3:
                      if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) {
                              return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                          }
                      }
                      break;
                  case 4:
                      if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) {
                              return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                          }
                      }
                      break;
              }
          }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
          if (unlikely(Py_SIZE(x) < 0)) {
              goto raise_neg_overflow;
          }
  #else
          {
              int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
              if (unlikely(result < 0))
                  return (int) -1;
              if (unlikely(result == 1))
                  goto raise_neg_overflow;
          }
  #endif
          if ((sizeof(int) <= sizeof(unsigned long))) {
              __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
          } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) {
              __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
          }
      } else {
  #if CYTHON_USE_PYLONG_INTERNALS
          if (__Pyx_PyLong_IsCompact(x)) {
              __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
          } else {
              const digit* digits = __Pyx_PyLong_Digits(x);
              assert(__Pyx_PyLong_DigitCount(x) > 1);
              switch (__Pyx_PyLong_SignedDigitCount(x)) {
                  case -2:
                      if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
                              return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                          }
                      }
                      break;
                  case 2:
                      if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
                              return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                          }
                      }
                      break;
                  case -3:
                      if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
                              return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                          }
                      }
                      break;
                  case 3:
                      if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
                              return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                          }
                      }
                      break;
                  case -4:
                      if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
                              return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                          }
                      }
                      break;
                  case 4:
                      if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
                              return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                          }
                      }
                      break;
              }
          }
  #endif
          if ((sizeof(int) <= sizeof(long))) {
              __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
          } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) {
              __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
          }
      }
      {
          int val;
          int ret = -1;
  #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
          Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
              x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
          if (unlikely(bytes_copied == -1)) {
          } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
              goto raise_overflow;
          } else {
              ret = 0;
          }
  #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
          int one = 1; int is_little = (int)*(unsigned char *)&one;
          unsigned char *bytes = (unsigned char *)&val;
          ret = _PyLong_AsByteArray((PyLongObject *)x,
                                      bytes, sizeof(val),
                                      is_little, !is_unsigned);
  #else
          PyObject *v;
          PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
          int bits, remaining_bits, is_negative = 0;
          int chunk_size = (sizeof(long) < 8) ? 30 : 62;
          if (likely(PyLong_CheckExact(x))) {
              v = __Pyx_NewRef(x);
          } else {
              v = PyNumber_Long(x);
              if (unlikely(!v)) return (int) -1;
              assert(PyLong_CheckExact(v));
          }
          {
              int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
              if (unlikely(result < 0)) {
                  Py_DECREF(v);
                  return (int) -1;
              }
              is_negative = result == 1;
          }
          if (is_unsigned && unlikely(is_negative)) {
              Py_DECREF(v);
              goto raise_neg_overflow;
          } else if (is_negative) {
              stepval = PyNumber_Invert(v);
              Py_DECREF(v);
              if (unlikely(!stepval))
                  return (int) -1;
          } else {
              stepval = v;
          }
          v = NULL;
          val = (int) 0;
          mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
          shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
          for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) {
              PyObject *tmp, *digit;
              long idigit;
              digit = PyNumber_And(stepval, mask);
              if (unlikely(!digit)) goto done;
              idigit = PyLong_AsLong(digit);
              Py_DECREF(digit);
              if (unlikely(idigit < 0)) goto done;
              val |= ((int) idigit) << bits;
              tmp = PyNumber_Rshift(stepval, shift);
              if (unlikely(!tmp)) goto done;
              Py_DECREF(stepval); stepval = tmp;
          }
          Py_DECREF(shift); shift = NULL;
          Py_DECREF(mask); mask = NULL;
          {
              long idigit = PyLong_AsLong(stepval);
              if (unlikely(idigit < 0)) goto done;
              remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1);
              if (unlikely(idigit >= (1L << remaining_bits)))
                  goto raise_overflow;
              val |= ((int) idigit) << bits;
          }
          if (!is_unsigned) {
              if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1))))
                  goto raise_overflow;
              if (is_negative)
                  val = ~val;
          }
          ret = 0;
      done:
          Py_XDECREF(shift);
          Py_XDECREF(mask);
          Py_XDECREF(stepval);
  #endif
          if (unlikely(ret))
              return (int) -1;
          return val;
      }
  raise_overflow:
      PyErr_SetString(PyExc_OverflowError,
          "value too large to convert to int");
      return (int) -1;
  raise_neg_overflow:
      PyErr_SetString(PyExc_OverflowError,
          "can't convert negative value to int");
      return (int) -1;
  }
  
/* CIntFromPy */
  static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *x) {
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wconversion"
  #endif
      const long neg_one = (long) -1, const_zero = (long) 0;
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic pop
  #endif
      const int is_unsigned = neg_one > const_zero;
      if (unlikely(!PyLong_Check(x))) {
          long val;
          PyObject *tmp = __Pyx_PyNumber_Long(x);
          if (!tmp) return (long) -1;
          val = __Pyx_PyLong_As_long(tmp);
          Py_DECREF(tmp);
          return val;
      }
      if (is_unsigned) {
  #if CYTHON_USE_PYLONG_INTERNALS
          if (unlikely(__Pyx_PyLong_IsNeg(x))) {
              goto raise_neg_overflow;
          } else if (__Pyx_PyLong_IsCompact(x)) {
              __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
          } else {
              const digit* digits = __Pyx_PyLong_Digits(x);
              assert(__Pyx_PyLong_DigitCount(x) > 1);
              switch (__Pyx_PyLong_DigitCount(x)) {
                  case 2:
                      if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) {
                              return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                          }
                      }
                      break;
                  case 3:
                      if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) {
                              return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                          }
                      }
                      break;
                  case 4:
                      if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) {
                              return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                          }
                      }
                      break;
              }
          }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
          if (unlikely(Py_SIZE(x) < 0)) {
              goto raise_neg_overflow;
          }
  #else
          {
              int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
              if (unlikely(result < 0))
                  return (long) -1;
              if (unlikely(result == 1))
                  goto raise_neg_overflow;
          }
  #endif
          if ((sizeof(long) <= sizeof(unsigned long))) {
              __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
          } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) {
              __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
          }
      } else {
  #if CYTHON_USE_PYLONG_INTERNALS
          if (__Pyx_PyLong_IsCompact(x)) {
              __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
          } else {
              const digit* digits = __Pyx_PyLong_Digits(x);
              assert(__Pyx_PyLong_DigitCount(x) > 1);
              switch (__Pyx_PyLong_SignedDigitCount(x)) {
                  case -2:
                      if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
                              return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                          }
                      }
                      break;
                  case 2:
                      if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
                              return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                          }
                      }
                      break;
                  case -3:
                      if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
                              return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                          }
                      }
                      break;
                  case 3:
                      if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
                              return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                          }
                      }
                      break;
                  case -4:
                      if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
                              return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                          }
                      }
                      break;
                  case 4:
                      if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
                              return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                          }
                      }
                      break;
              }
          }
  #endif
          if ((sizeof(long) <= sizeof(long))) {
              __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
          } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) {
              __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
          }
      }
      {
          long val;
          int ret = -1;
  #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
          Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
              x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
          if (unlikely(bytes_copied == -1)) {
          } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
              goto raise_overflow;
          } else {
              ret = 0;
          }
  #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
          int one = 1; int is_little = (int)*(unsigned char *)&one;
          unsigned char *bytes = (unsigned char *)&val;
          ret = _PyLong_AsByteArray((PyLongObject *)x,
                                      bytes, sizeof(val),
                                      is_little, !is_unsigned);
  #else
          PyObject *v;
          PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
          int bits, remaining_bits, is_negative = 0;
          int chunk_size = (sizeof(long) < 8) ? 30 : 62;
          if (likely(PyLong_CheckExact(x))) {
              v = __Pyx_NewRef(x);
          } else {
              v = PyNumber_Long(x);
              if (unlikely(!v)) return (long) -1;
              assert(PyLong_CheckExact(v));
          }
          {
              int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
              if (unlikely(result < 0)) {
                  Py_DECREF(v);
                  return (long) -1;
              }
              is_negative = result == 1;
          }
          if (is_unsigned && unlikely(is_negative)) {
              Py_DECREF(v);
              goto raise_neg_overflow;
          } else if (is_negative) {
              stepval = PyNumber_Invert(v);
              Py_DECREF(v);
              if (unlikely(!stepval))
                  return (long) -1;
          } else {
              stepval = v;
          }
          v = NULL;
          val = (long) 0;
          mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
          shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
          for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) {
              PyObject *tmp, *digit;
              long idigit;
              digit = PyNumber_And(stepval, mask);
              if (unlikely(!digit)) goto done;
              idigit = PyLong_AsLong(digit);
              Py_DECREF(digit);
              if (unlikely(idigit < 0)) goto done;
              val |= ((long) idigit) << bits;
              tmp = PyNumber_Rshift(stepval, shift);
              if (unlikely(!tmp)) goto done;
              Py_DECREF(stepval); stepval = tmp;
          }
          Py_DECREF(shift); shift = NULL;
          Py_DECREF(mask); mask = NULL;
          {
              long idigit = PyLong_AsLong(stepval);
              if (unlikely(idigit < 0)) goto done;
              remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1);
              if (unlikely(idigit >= (1L << remaining_bits)))
                  goto raise_overflow;
              val |= ((long) idigit) << bits;
          }
          if (!is_unsigned) {
              if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1))))
                  goto raise_overflow;
              if (is_negative)
                  val = ~val;
          }
          ret = 0;
      done:
          Py_XDECREF(shift);
          Py_XDECREF(mask);
          Py_XDECREF(stepval);
  #endif
          if (unlikely(ret))
              return (long) -1;
          return val;
      }
  raise_overflow:
      PyErr_SetString(PyExc_OverflowError,
          "value too large to convert to long");
      return (long) -1;
  raise_neg_overflow:
      PyErr_SetString(PyExc_OverflowError,
          "can't convert negative value to long");
      return (long) -1;
  }
  
/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value) {
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wconversion"
  #endif
      const int neg_one = (int) -1, const_zero = (int) 0;
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic pop
  #endif
      const int is_unsigned = neg_one > const_zero;
      if (is_unsigned) {
          if (sizeof(int) < sizeof(long)) {
              return PyLong_FromLong((long) value);
          } else if (sizeof(int) <= sizeof(unsigned long)) {
              return PyLong_FromUnsignedLong((unsigned long) value);
  #if !CYTHON_COMPILING_IN_PYPY
          } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
              return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  #endif
          }
      } else {
          if (sizeof(int) <= sizeof(long)) {
              return PyLong_FromLong((long) value);
          } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
              return PyLong_FromLongLong((PY_LONG_LONG) value);
          }
      }
      {
          unsigned char *bytes = (unsigned char *)&value;
  #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
          if (is_unsigned) {
              return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
          } else {
              return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
          }
  #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
          int one = 1; int little = (int)*(unsigned char *)&one;
          return _PyLong_FromByteArray(bytes, sizeof(int),
                                       little, !is_unsigned);
  #else
          int one = 1; int little = (int)*(unsigned char *)&one;
          PyObject *from_bytes, *result = NULL, *kwds = NULL;
          PyObject *py_bytes = NULL, *order_str = NULL;
          from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
          if (!from_bytes) return NULL;
          py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int));
          if (!py_bytes) goto limited_bad;
          order_str = PyUnicode_FromString(little ? "little" : "big");
          if (!order_str) goto limited_bad;
          {
              PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
              if (!is_unsigned) {
                  kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                  if (!kwds) goto limited_bad;
                  if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
              }
              result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
          }
          limited_bad:
          Py_XDECREF(kwds);
          Py_XDECREF(order_str);
          Py_XDECREF(py_bytes);
          Py_XDECREF(from_bytes);
          return result;
  #endif
      }
  }
  
/* CIntFromPy */
  static CYTHON_INLINE char __Pyx_PyLong_As_char(PyObject *x) {
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wconversion"
  #endif
      const char neg_one = (char) -1, const_zero = (char) 0;
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic pop
  #endif
      const int is_unsigned = neg_one > const_zero;
      if (unlikely(!PyLong_Check(x))) {
          char val;
          PyObject *tmp = __Pyx_PyNumber_Long(x);
          if (!tmp) return (char) -1;
          val = __Pyx_PyLong_As_char(tmp);
          Py_DECREF(tmp);
          return val;
      }
      if (is_unsigned) {
  #if CYTHON_USE_PYLONG_INTERNALS
          if (unlikely(__Pyx_PyLong_IsNeg(x))) {
              goto raise_neg_overflow;
          } else if (__Pyx_PyLong_IsCompact(x)) {
              __PYX_VERIFY_RETURN_INT(char, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
          } else {
              const digit* digits = __Pyx_PyLong_Digits(x);
              assert(__Pyx_PyLong_DigitCount(x) > 1);
              switch (__Pyx_PyLong_DigitCount(x)) {
                  case 2:
                      if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(char) >= 2 * PyLong_SHIFT)) {
                              return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
                          }
                      }
                      break;
                  case 3:
                      if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(char) >= 3 * PyLong_SHIFT)) {
                              return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
                          }
                      }
                      break;
                  case 4:
                      if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(char) >= 4 * PyLong_SHIFT)) {
                              return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
                          }
                      }
                      break;
              }
          }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
          if (unlikely(Py_SIZE(x) < 0)) {
              goto raise_neg_overflow;
          }
  #else
          {
              int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
              if (unlikely(result < 0))
                  return (char) -1;
              if (unlikely(result == 1))
                  goto raise_neg_overflow;
          }
  #endif
          if ((sizeof(char) <= sizeof(unsigned long))) {
              __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x))
          } else if ((sizeof(char) <= sizeof(unsigned PY_LONG_LONG))) {
              __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
          }
      } else {
  #if CYTHON_USE_PYLONG_INTERNALS
          if (__Pyx_PyLong_IsCompact(x)) {
              __PYX_VERIFY_RETURN_INT(char, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
          } else {
              const digit* digits = __Pyx_PyLong_Digits(x);
              assert(__Pyx_PyLong_DigitCount(x) > 1);
              switch (__Pyx_PyLong_SignedDigitCount(x)) {
                  case -2:
                      if ((8 * sizeof(char) - 1 > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) {
                              return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                          }
                      }
                      break;
                  case 2:
                      if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) {
                              return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                          }
                      }
                      break;
                  case -3:
                      if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) {
                              return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                          }
                      }
                      break;
                  case 3:
                      if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) {
                              return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                          }
                      }
                      break;
                  case -4:
                      if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(char) - 1 > 4 * PyLong_SHIFT)) {
                              return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                          }
                      }
                      break;
                  case 4:
                      if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(char) - 1 > 4 * PyLong_SHIFT)) {
                              return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                          }
                      }
                      break;
              }
          }
  #endif
          if ((sizeof(char) <= sizeof(long))) {
              __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x))
          } else if ((sizeof(char) <= sizeof(PY_LONG_LONG))) {
              __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x))
          }
      }
      {
          char val;
          int ret = -1;
  #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
          Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
              x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
          if (unlikely(bytes_copied == -1)) {
          } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
              goto raise_overflow;
          } else {
              ret = 0;
          }
  #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
          int one = 1; int is_little = (int)*(unsigned char *)&one;
          unsigned char *bytes = (unsigned char *)&val;
          ret = _PyLong_AsByteArray((PyLongObject *)x,
                                      bytes, sizeof(val),
                                      is_little, !is_unsigned);
  #else
          PyObject *v;
          PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
          int bits, remaining_bits, is_negative = 0;
          int chunk_size = (sizeof(long) < 8) ? 30 : 62;
          if (likely(PyLong_CheckExact(x))) {
              v = __Pyx_NewRef(x);
          } else {
              v = PyNumber_Long(x);
              if (unlikely(!v)) return (char) -1;
              assert(PyLong_CheckExact(v));
          }
          {
              int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
              if (unlikely(result < 0)) {
                  Py_DECREF(v);
                  return (char) -1;
              }
              is_negative = result == 1;
          }
          if (is_unsigned && unlikely(is_negative)) {
              Py_DECREF(v);
              goto raise_neg_overflow;
          } else if (is_negative) {
              stepval = PyNumber_Invert(v);
              Py_DECREF(v);
              if (unlikely(!stepval))
                  return (char) -1;
          } else {
              stepval = v;
          }
          v = NULL;
          val = (char) 0;
          mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
          shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
          for (bits = 0; bits < (int) sizeof(char) * 8 - chunk_size; bits += chunk_size) {
              PyObject *tmp, *digit;
              long idigit;
              digit = PyNumber_And(stepval, mask);
              if (unlikely(!digit)) goto done;
              idigit = PyLong_AsLong(digit);
              Py_DECREF(digit);
              if (unlikely(idigit < 0)) goto done;
              val |= ((char) idigit) << bits;
              tmp = PyNumber_Rshift(stepval, shift);
              if (unlikely(!tmp)) goto done;
              Py_DECREF(stepval); stepval = tmp;
          }
          Py_DECREF(shift); shift = NULL;
          Py_DECREF(mask); mask = NULL;
          {
              long idigit = PyLong_AsLong(stepval);
              if (unlikely(idigit < 0)) goto done;
              remaining_bits = ((int) sizeof(char) * 8) - bits - (is_unsigned ? 0 : 1);
              if (unlikely(idigit >= (1L << remaining_bits)))
                  goto raise_overflow;
              val |= ((char) idigit) << bits;
          }
          if (!is_unsigned) {
              if (unlikely(val & (((char) 1) << (sizeof(char) * 8 - 1))))
                  goto raise_overflow;
              if (is_negative)
                  val = ~val;
          }
          ret = 0;
      done:
          Py_XDECREF(shift);
          Py_XDECREF(mask);
          Py_XDECREF(stepval);
  #endif
          if (unlikely(ret))
              return (char) -1;
          return val;
      }
  raise_overflow:
      PyErr_SetString(PyExc_OverflowError,
          "value too large to convert to char");
      return (char) -1;
  raise_neg_overflow:
      PyErr_SetString(PyExc_OverflowError,
          "can't convert negative value to char");
      return (char) -1;
  }
  
/* FormatTypeName */
  #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000
  static __Pyx_TypeName
  __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp)
  {
      PyObject *module = NULL, *name = NULL, *result = NULL;
      #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
      name = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
                                                 __pyx_mstate_global->__pyx_n_u_qualname);
      #else
      name = PyType_GetQualName(tp);
      #endif
      if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) goto bad;
      module = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
                                                 __pyx_mstate_global->__pyx_n_u_module);
      if (unlikely(module == NULL) || unlikely(!PyUnicode_Check(module))) goto bad;
      if (PyUnicode_CompareWithASCIIString(module, "builtins") == 0) {
          result = name;
          name = NULL;
          goto done;
      }
      result = PyUnicode_FromFormat("%U.%U", module, name);
      if (unlikely(result == NULL)) goto bad;
    done:
      Py_XDECREF(name);
      Py_XDECREF(module);
      return result;
    bad:
      PyErr_Clear();
      if (name) {
          result = name;
          name = NULL;
      } else {
          result = __Pyx_NewRef(__pyx_mstate_global->__pyx_kp_u__12);
      }
      goto done;
  }
  #endif
  
/* GetRuntimeVersion */
  #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
  void __Pyx_init_runtime_version(void) {
      if (__Pyx_cached_runtime_version == 0) {
          const char* rt_version = Py_GetVersion();
          unsigned long version = 0;
          unsigned long factor = 0x01000000UL;
          unsigned int digit = 0;
          int i = 0;
          while (factor) {
              while ('0' <= rt_version[i] && rt_version[i] <= '9') {
                  digit = digit * 10 + (unsigned int) (rt_version[i] - '0');
                  ++i;
              }
              version += factor * digit;
              if (rt_version[i] != '.')
                  break;
              digit = 0;
              factor >>= 8;
              ++i;
          }
          __Pyx_cached_runtime_version = version;
      }
  }
  #endif
  static unsigned long __Pyx_get_runtime_version(void) {
  #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000
      return Py_Version & ~0xFFUL;
  #else
      return __Pyx_cached_runtime_version;
  #endif
  }
  
/* CStringEquals */
  static CYTHON_INLINE int __Pyx_StrEq(const char *s1, const char *s2) {
      while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
      return *s1 == *s2;
  }
  
/* CheckBinaryVersion */
  static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) {
      const unsigned long MAJOR_MINOR = 0xFFFF0000UL;
      if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR))
          return 0;
      if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR)))
          return 1;
      {
          char message[200];
          PyOS_snprintf(message, sizeof(message),
                        "compile time Python version %d.%d "
                        "of module '%.100s' "
                        "%s "
                        "runtime version %d.%d",
                         (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF),
                         __Pyx_MODULE_NAME,
                         (allow_newer) ? "was newer than" : "does not match",
                         (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF)
         );
          return PyErr_WarnEx(NULL, message, 1);
      }
  }
  
/* NewCodeObj */
  #if CYTHON_COMPILING_IN_LIMITED_API
      static PyObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f,
                                         PyObject *code, PyObject *c, PyObject* n, PyObject *v,
                                         PyObject *fv, PyObject *cell, PyObject* fn,
                                         PyObject *name, int fline, PyObject *lnos) {
          PyObject *exception_table = NULL;
          PyObject *types_module=NULL, *code_type=NULL, *result=NULL;
          #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
          PyObject *version_info;
          PyObject *py_minor_version = NULL;
          #endif
          long minor_version = 0;
          PyObject *type, *value, *traceback;
          PyErr_Fetch(&type, &value, &traceback);
          #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000
          minor_version = 11;
          #else
          if (!(version_info = PySys_GetObject("version_info"))) goto end;
          if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end;
          minor_version = PyLong_AsLong(py_minor_version);
          Py_DECREF(py_minor_version);
          if (minor_version == -1 && PyErr_Occurred()) goto end;
          #endif
          if (!(types_module = PyImport_ImportModule("types"))) goto end;
          if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end;
          if (minor_version <= 7) {
              (void)p;
              result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOOO", a, k, l, s, f, code,
                            c, n, v, fn, name, fline, lnos, fv, cell);
          } else if (minor_version <= 10) {
              result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOOO", a,p, k, l, s, f, code,
                            c, n, v, fn, name, fline, lnos, fv, cell);
          } else {
              if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end;
              result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOOOO", a,p, k, l, s, f, code,
                            c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell);
          }
      end:
          Py_XDECREF(code_type);
          Py_XDECREF(exception_table);
          Py_XDECREF(types_module);
          if (type) {
              PyErr_Restore(type, value, traceback);
          }
          return result;
      }
  #elif PY_VERSION_HEX >= 0x030B0000
    static PyCodeObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f,
                                           PyObject *code, PyObject *c, PyObject* n, PyObject *v,
                                           PyObject *fv, PyObject *cell, PyObject* fn,
                                           PyObject *name, int fline, PyObject *lnos) {
      PyCodeObject *result;
      result =
        #if PY_VERSION_HEX >= 0x030C0000
          PyUnstable_Code_NewWithPosOnlyArgs
        #else
          PyCode_NewWithPosOnlyArgs
        #endif
          (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, __pyx_mstate_global->__pyx_empty_bytes);
      #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030c00A1
      if (likely(result))
          result->_co_firsttraceable = 0;
      #endif
      return result;
    }
  #elif !CYTHON_COMPILING_IN_PYPY
    #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
            PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #else
    #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
            PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #endif
  static PyObject* __Pyx_PyCode_New(
          const __Pyx_PyCode_New_function_description descr,
          PyObject * const *varnames,
          PyObject *filename,
          PyObject *funcname,
          PyObject *line_table,
          PyObject *tuple_dedup_map
  ) {
      PyObject *code_obj = NULL, *varnames_tuple_dedup = NULL, *code_bytes = NULL;
      Py_ssize_t var_count = (Py_ssize_t) descr.nlocals;
      PyObject *varnames_tuple = PyTuple_New(var_count);
      if (unlikely(!varnames_tuple)) return NULL;
      for (Py_ssize_t i=0; i < var_count; i++) {
          Py_INCREF(varnames[i]);
          if (__Pyx_PyTuple_SET_ITEM(varnames_tuple, i, varnames[i]) != (0)) goto done;
      }
      #if CYTHON_COMPILING_IN_LIMITED_API
      varnames_tuple_dedup = PyDict_GetItem(tuple_dedup_map, varnames_tuple);
      if (!varnames_tuple_dedup) {
          if (unlikely(PyDict_SetItem(tuple_dedup_map, varnames_tuple, varnames_tuple) < 0)) goto done;
          varnames_tuple_dedup = varnames_tuple;
      }
      #else
      varnames_tuple_dedup = PyDict_SetDefault(tuple_dedup_map, varnames_tuple, varnames_tuple);
      if (unlikely(!varnames_tuple_dedup)) goto done;
      #endif
      #if CYTHON_AVOID_BORROWED_REFS
      Py_INCREF(varnames_tuple_dedup);
      #endif
      if (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table != NULL && !CYTHON_COMPILING_IN_GRAAL) {
          Py_ssize_t line_table_length = __Pyx_PyBytes_GET_SIZE(line_table);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely(line_table_length == -1)) goto done;
          #endif
          Py_ssize_t code_len = (line_table_length * 2 + 4) & ~3LL;
          code_bytes = PyBytes_FromStringAndSize(NULL, code_len);
          if (unlikely(!code_bytes)) goto done;
          char* c_code_bytes = PyBytes_AsString(code_bytes);
          if (unlikely(!c_code_bytes)) goto done;
          memset(c_code_bytes, 0, (size_t) code_len);
      }
      code_obj = (PyObject*) __Pyx__PyCode_New(
          (int) descr.argcount,
          (int) descr.num_posonly_args,
          (int) descr.num_kwonly_args,
          (int) descr.nlocals,
          0,
          (int) descr.flags,
          code_bytes ? code_bytes : __pyx_mstate_global->__pyx_empty_bytes,
          __pyx_mstate_global->__pyx_empty_tuple,
          __pyx_mstate_global->__pyx_empty_tuple,
          varnames_tuple_dedup,
          __pyx_mstate_global->__pyx_empty_tuple,
          __pyx_mstate_global->__pyx_empty_tuple,
          filename,
          funcname,
          (int) descr.first_line,
          (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table) ? line_table : __pyx_mstate_global->__pyx_empty_bytes
      );
  done:
      Py_XDECREF(code_bytes);
      #if CYTHON_AVOID_BORROWED_REFS
      Py_XDECREF(varnames_tuple_dedup);
      #endif
      Py_DECREF(varnames_tuple);
      return code_obj;
  }
  
/* DecompressString */
  static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo) {
      PyObject *module = NULL, *decompress, *compressed_bytes, *decompressed;
      const char* module_name = algo == 3 ? "compression.zstd" : algo == 2 ? "bz2" : "zlib";
      PyObject *methodname = PyUnicode_FromString("decompress");
      if (unlikely(!methodname)) return NULL;
      #if __PYX_LIMITED_VERSION_HEX >= 0x030e0000
      if (algo == 3) {
          PyObject *fromlist = Py_BuildValue("[O]", methodname);
          if (unlikely(!fromlist)) goto bad;
          module = PyImport_ImportModuleLevel("compression.zstd", NULL, NULL, fromlist, 0);
          Py_DECREF(fromlist);
      } else
      #endif
          module = PyImport_ImportModule(module_name);
      if (unlikely(!module)) goto import_failed;
      decompress = PyObject_GetAttr(module, methodname);
      if (unlikely(!decompress)) goto import_failed;
      {
          #ifdef __cplusplus
              char *memview_bytes = const_cast<char*>(s);
          #else
              #if defined(__clang__)
                #pragma clang diagnostic push
                #pragma clang diagnostic ignored "-Wcast-qual"
              #elif !defined(__INTEL_COMPILER) && defined(__GNUC__)
                #pragma GCC diagnostic push
                #pragma GCC diagnostic ignored "-Wcast-qual"
              #endif
              char *memview_bytes = (char*) s;
              #if defined(__clang__)
                #pragma clang diagnostic pop
              #elif !defined(__INTEL_COMPILER) && defined(__GNUC__)
                #pragma GCC diagnostic pop
              #endif
          #endif
          #if CYTHON_COMPILING_IN_LIMITED_API && !defined(PyBUF_READ)
          int memview_flags = 0x100;
          #else
          int memview_flags = PyBUF_READ;
          #endif
          compressed_bytes = PyMemoryView_FromMemory(memview_bytes, length, memview_flags);
      }
      if (unlikely(!compressed_bytes)) {
          Py_DECREF(decompress);
          goto bad;
      }
      decompressed = PyObject_CallFunctionObjArgs(decompress, compressed_bytes, NULL);
      Py_DECREF(compressed_bytes);
      Py_DECREF(decompress);
      Py_DECREF(module);
      Py_DECREF(methodname);
      return decompressed;
  import_failed:
      PyErr_Format(PyExc_ImportError,
          "Failed to import '%.20s.decompress' - cannot initialise module strings. "
          "String compression was configured with the C macro 'CYTHON_COMPRESS_STRINGS=%d'.",
          module_name, algo);
  bad:
      Py_XDECREF(module);
      Py_DECREF(methodname);
      return NULL;
  }
  
#include <string.h>
static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) {
    size_t len = strlen(s);
    if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) {
        PyErr_SetString(PyExc_OverflowError, "byte string is too long");
        return -1;
    }
    return (Py_ssize_t) len;
}
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    Py_ssize_t len = __Pyx_ssize_strlen(c_str);
    if (unlikely(len < 0)) return NULL;
    return __Pyx_PyUnicode_FromStringAndSize(c_str, len);
}
static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) {
    Py_ssize_t len = __Pyx_ssize_strlen(c_str);
    if (unlikely(len < 0)) return NULL;
    return PyByteArray_FromStringAndSize(c_str, len);
}
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
#if CYTHON_COMPILING_IN_LIMITED_API
    {
        const char* result;
        Py_ssize_t unicode_length;
        CYTHON_MAYBE_UNUSED_VAR(unicode_length); // only for __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        #if __PYX_LIMITED_VERSION_HEX < 0x030A0000
        if (unlikely(PyArg_Parse(o, "s#", &result, length) < 0)) return NULL;
        #else
        result = PyUnicode_AsUTF8AndSize(o, length);
        #endif
        #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        unicode_length = PyUnicode_GetLength(o);
        if (unlikely(unicode_length < 0)) return NULL;
        if (unlikely(unicode_length != *length)) {
            PyUnicode_AsASCIIString(o);
            return NULL;
        }
        #endif
        return result;
    }
#else
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    if (likely(PyUnicode_IS_ASCII(o))) {
        *length = PyUnicode_GET_LENGTH(o);
        return PyUnicode_AsUTF8(o);
    } else {
        PyUnicode_AsASCIIString(o);
        return NULL;
    }
#else
    return PyUnicode_AsUTF8AndSize(o, length);
#endif
#endif
}
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
    if (PyUnicode_Check(o)) {
        return __Pyx_PyUnicode_AsStringAndSize(o, length);
    } else
#endif
    if (PyByteArray_Check(o)) {
#if (CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) || (CYTHON_COMPILING_IN_PYPY && (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)))
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
#else
        *length = PyByteArray_Size(o);
        if (*length == -1) return NULL;
        return PyByteArray_AsString(o);
#endif
    } else
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
    int retval;
    if (unlikely(!x)) return -1;
    retval = __Pyx_PyObject_IsTrue(x);
    Py_DECREF(x);
    return retval;
}
static PyObject* __Pyx_PyNumber_LongWrongResultType(PyObject* result) {
    __Pyx_TypeName result_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(result));
    if (PyLong_Check(result)) {
        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
                "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ").  "
                "The ability to return an instance of a strict subclass of int is deprecated, "
                "and may be removed in a future version of Python.",
                result_type_name)) {
            __Pyx_DECREF_TypeName(result_type_name);
            Py_DECREF(result);
            return NULL;
        }
        __Pyx_DECREF_TypeName(result_type_name);
        return result;
    }
    PyErr_Format(PyExc_TypeError,
                 "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ")",
                 result_type_name);
    __Pyx_DECREF_TypeName(result_type_name);
    Py_DECREF(result);
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x) {
#if CYTHON_USE_TYPE_SLOTS
  PyNumberMethods *m;
#endif
  PyObject *res = NULL;
  if (likely(PyLong_Check(x)))
      return __Pyx_NewRef(x);
#if CYTHON_USE_TYPE_SLOTS
  m = Py_TYPE(x)->tp_as_number;
  if (likely(m && m->nb_int)) {
      res = m->nb_int(x);
  }
#else
  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
      res = PyNumber_Long(x);
  }
#endif
  if (likely(res)) {
      if (unlikely(!PyLong_CheckExact(res))) {
          return __Pyx_PyNumber_LongWrongResultType(res);
      }
  }
  else if (!PyErr_Occurred()) {
      PyErr_SetString(PyExc_TypeError,
                      "an integer is required");
  }
  return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(__Pyx_PyLong_IsCompact(b))) {
        return __Pyx_PyLong_CompactValue(b);
    } else {
      const digit* digits = __Pyx_PyLong_Digits(b);
      const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b);
      switch (size) {
         case 2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
      }
    }
    #endif
    return PyLong_AsSsize_t(b);
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyLong_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
  if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
    return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
  } else {
    Py_ssize_t ival;
    PyObject *x;
    x = PyNumber_Index(o);
    if (!x) return -1;
    ival = PyLong_AsLong(x);
    Py_DECREF(x);
    return ival;
  }
}
static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b) {
    CYTHON_UNUSED_VAR(b);
    return __Pyx_NewRef(Py_None);
}
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  return __Pyx_NewRef(b ? Py_True: Py_False);
}
static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t ival) {
    return PyLong_FromSize_t(ival);
}


  /* MultiPhaseInitModuleState */
  #if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE
  #ifndef CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  #if (CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000)
    #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 1
  #else
    #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 0
  #endif
  #endif
  #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE && !CYTHON_ATOMICS
  #error "Module state with PEP489 requires atomics. Currently that's one of\
   C11, C++11, gcc atomic intrinsics or MSVC atomic intrinsics"
  #endif
  #if !CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  #define __Pyx_ModuleStateLookup_Lock()
  #define __Pyx_ModuleStateLookup_Unlock()
  #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000
  static PyMutex __Pyx_ModuleStateLookup_mutex = {0};
  #define __Pyx_ModuleStateLookup_Lock() PyMutex_Lock(&__Pyx_ModuleStateLookup_mutex)
  #define __Pyx_ModuleStateLookup_Unlock() PyMutex_Unlock(&__Pyx_ModuleStateLookup_mutex)
  #elif defined(__cplusplus) && __cplusplus >= 201103L
  #include <mutex>
  static std::mutex __Pyx_ModuleStateLookup_mutex;
  #define __Pyx_ModuleStateLookup_Lock() __Pyx_ModuleStateLookup_mutex.lock()
  #define __Pyx_ModuleStateLookup_Unlock() __Pyx_ModuleStateLookup_mutex.unlock()
  #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ > 201112L) && !defined(__STDC_NO_THREADS__)
  #include <threads.h>
  static mtx_t __Pyx_ModuleStateLookup_mutex;
  static once_flag __Pyx_ModuleStateLookup_mutex_once_flag = ONCE_FLAG_INIT;
  static void __Pyx_ModuleStateLookup_initialize_mutex(void) {
      mtx_init(&__Pyx_ModuleStateLookup_mutex, mtx_plain);
  }
  #define __Pyx_ModuleStateLookup_Lock()\
    call_once(&__Pyx_ModuleStateLookup_mutex_once_flag, __Pyx_ModuleStateLookup_initialize_mutex);\
    mtx_lock(&__Pyx_ModuleStateLookup_mutex)
  #define __Pyx_ModuleStateLookup_Unlock() mtx_unlock(&__Pyx_ModuleStateLookup_mutex)
  #elif defined(HAVE_PTHREAD_H)
  #include <pthread.h>
  static pthread_mutex_t __Pyx_ModuleStateLookup_mutex = PTHREAD_MUTEX_INITIALIZER;
  #define __Pyx_ModuleStateLookup_Lock() pthread_mutex_lock(&__Pyx_ModuleStateLookup_mutex)
  #define __Pyx_ModuleStateLookup_Unlock() pthread_mutex_unlock(&__Pyx_ModuleStateLookup_mutex)
  #elif defined(_WIN32)
  #include <Windows.h>  // synchapi.h on its own doesn't work
  static SRWLOCK __Pyx_ModuleStateLookup_mutex = SRWLOCK_INIT;
  #define __Pyx_ModuleStateLookup_Lock() AcquireSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex)
  #define __Pyx_ModuleStateLookup_Unlock() ReleaseSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex)
  #else
  #error "No suitable lock available for CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE.\
   Requires C standard >= C11, or C++ standard >= C++11,\
   or pthreads, or the Windows 32 API, or Python >= 3.13."
  #endif
  typedef struct {
      int64_t id;
      PyObject *module;
  } __Pyx_InterpreterIdAndModule;
  typedef struct {
      char interpreter_id_as_index;
      Py_ssize_t count;
      Py_ssize_t allocated;
      __Pyx_InterpreterIdAndModule table[1];
  } __Pyx_ModuleStateLookupData;
  #define __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE 32
  #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  static __pyx_atomic_int_type __Pyx_ModuleStateLookup_read_counter = 0;
  #endif
  #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  static __pyx_atomic_ptr_type __Pyx_ModuleStateLookup_data = 0;
  #else
  static __Pyx_ModuleStateLookupData* __Pyx_ModuleStateLookup_data = NULL;
  #endif
  static __Pyx_InterpreterIdAndModule* __Pyx_State_FindModuleStateLookupTableLowerBound(
          __Pyx_InterpreterIdAndModule* table,
          Py_ssize_t count,
          int64_t interpreterId) {
      __Pyx_InterpreterIdAndModule* begin = table;
      __Pyx_InterpreterIdAndModule* end = begin + count;
      if (begin->id == interpreterId) {
          return begin;
      }
      while ((end - begin) > __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) {
          __Pyx_InterpreterIdAndModule* halfway = begin + (end - begin)/2;
          if (halfway->id == interpreterId) {
              return halfway;
          }
          if (halfway->id < interpreterId) {
              begin = halfway;
          } else {
              end = halfway;
          }
      }
      for (; begin < end; ++begin) {
          if (begin->id >= interpreterId) return begin;
      }
      return begin;
  }
  static PyObject *__Pyx_State_FindModule(CYTHON_UNUSED void* dummy) {
      int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
      if (interpreter_id == -1) return NULL;
  #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
      __Pyx_ModuleStateLookupData* data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data);
      {
          __pyx_atomic_incr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
          if (likely(data)) {
              __Pyx_ModuleStateLookupData* new_data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_acquire(&__Pyx_ModuleStateLookup_data);
              if (likely(data == new_data)) {
                  goto read_finished;
              }
          }
          __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
          __Pyx_ModuleStateLookup_Lock();
          __pyx_atomic_incr_relaxed(&__Pyx_ModuleStateLookup_read_counter);
          data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data);
          __Pyx_ModuleStateLookup_Unlock();
      }
    read_finished:;
  #else
      __Pyx_ModuleStateLookupData* data = __Pyx_ModuleStateLookup_data;
  #endif
      __Pyx_InterpreterIdAndModule* found = NULL;
      if (unlikely(!data)) goto end;
      if (data->interpreter_id_as_index) {
          if (interpreter_id < data->count) {
              found = data->table+interpreter_id;
          }
      } else {
          found = __Pyx_State_FindModuleStateLookupTableLowerBound(
              data->table, data->count, interpreter_id);
      }
    end:
      {
          PyObject *result=NULL;
          if (found && found->id == interpreter_id) {
              result = found->module;
          }
  #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
          __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
  #endif
          return result;
      }
  }
  #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  static void __Pyx_ModuleStateLookup_wait_until_no_readers(void) {
      while (__pyx_atomic_load(&__Pyx_ModuleStateLookup_read_counter) != 0);
  }
  #else
  #define __Pyx_ModuleStateLookup_wait_until_no_readers()
  #endif
  static int __Pyx_State_AddModuleInterpIdAsIndex(__Pyx_ModuleStateLookupData **old_data, PyObject* module, int64_t interpreter_id) {
      Py_ssize_t to_allocate = (*old_data)->allocated;
      while (to_allocate <= interpreter_id) {
          if (to_allocate == 0) to_allocate = 1;
          else to_allocate *= 2;
      }
      __Pyx_ModuleStateLookupData *new_data = *old_data;
      if (to_allocate != (*old_data)->allocated) {
           new_data = (__Pyx_ModuleStateLookupData *)realloc(
              *old_data,
              sizeof(__Pyx_ModuleStateLookupData)+(to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule));
          if (!new_data) {
              PyErr_NoMemory();
              return -1;
          }
          for (Py_ssize_t i = new_data->allocated; i < to_allocate; ++i) {
              new_data->table[i].id = i;
              new_data->table[i].module = NULL;
          }
          new_data->allocated = to_allocate;
      }
      new_data->table[interpreter_id].module = module;
      if (new_data->count < interpreter_id+1) {
          new_data->count = interpreter_id+1;
      }
      *old_data = new_data;
      return 0;
  }
  static void __Pyx_State_ConvertFromInterpIdAsIndex(__Pyx_ModuleStateLookupData *data) {
      __Pyx_InterpreterIdAndModule *read = data->table;
      __Pyx_InterpreterIdAndModule *write = data->table;
      __Pyx_InterpreterIdAndModule *end = read + data->count;
      for (; read<end; ++read) {
          if (read->module) {
              write->id = read->id;
              write->module = read->module;
              ++write;
          }
      }
      data->count = write - data->table;
      for (; write<end; ++write) {
          write->id = 0;
          write->module = NULL;
      }
      data->interpreter_id_as_index = 0;
  }
  static int __Pyx_State_AddModule(PyObject* module, CYTHON_UNUSED void* dummy) {
      int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
      if (interpreter_id == -1) return -1;
      int result = 0;
      __Pyx_ModuleStateLookup_Lock();
  #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
      __Pyx_ModuleStateLookupData *old_data = (__Pyx_ModuleStateLookupData *)
              __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0);
  #else
      __Pyx_ModuleStateLookupData *old_data = __Pyx_ModuleStateLookup_data;
  #endif
      __Pyx_ModuleStateLookupData *new_data = old_data;
      if (!new_data) {
          new_data = (__Pyx_ModuleStateLookupData *)calloc(1, sizeof(__Pyx_ModuleStateLookupData));
          if (!new_data) {
              result = -1;
              PyErr_NoMemory();
              goto end;
          }
          new_data->allocated = 1;
          new_data->interpreter_id_as_index = 1;
      }
      __Pyx_ModuleStateLookup_wait_until_no_readers();
      if (new_data->interpreter_id_as_index) {
          if (interpreter_id < __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) {
              result = __Pyx_State_AddModuleInterpIdAsIndex(&new_data, module, interpreter_id);
              goto end;
          }
          __Pyx_State_ConvertFromInterpIdAsIndex(new_data);
      }
      {
          Py_ssize_t insert_at = 0;
          {
              __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound(
                  new_data->table, new_data->count, interpreter_id);
              assert(lower_bound);
              insert_at = lower_bound - new_data->table;
              if (unlikely(insert_at < new_data->count && lower_bound->id == interpreter_id)) {
                  lower_bound->module = module;
                  goto end;  // already in table, nothing more to do
              }
          }
          if (new_data->count+1 >= new_data->allocated) {
              Py_ssize_t to_allocate = (new_data->count+1)*2;
              new_data =
                  (__Pyx_ModuleStateLookupData*)realloc(
                      new_data,
                      sizeof(__Pyx_ModuleStateLookupData) +
                      (to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule));
              if (!new_data) {
                  result = -1;
                  new_data = old_data;
                  PyErr_NoMemory();
                  goto end;
              }
              new_data->allocated = to_allocate;
          }
          ++new_data->count;
          int64_t last_id = interpreter_id;
          PyObject *last_module = module;
          for (Py_ssize_t i=insert_at; i<new_data->count; ++i) {
              int64_t current_id = new_data->table[i].id;
              new_data->table[i].id = last_id;
              last_id = current_id;
              PyObject *current_module = new_data->table[i].module;
              new_data->table[i].module = last_module;
              last_module = current_module;
          }
      }
    end:
  #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
      __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, new_data);
  #else
      __Pyx_ModuleStateLookup_data = new_data;
  #endif
      __Pyx_ModuleStateLookup_Unlock();
      return result;
  }
  static int __Pyx_State_RemoveModule(CYTHON_UNUSED void* dummy) {
      int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
      if (interpreter_id == -1) return -1;
      __Pyx_ModuleStateLookup_Lock();
  #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
      __Pyx_ModuleStateLookupData *data = (__Pyx_ModuleStateLookupData *)
              __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0);
  #else
      __Pyx_ModuleStateLookupData *data = __Pyx_ModuleStateLookup_data;
  #endif
      if (data->interpreter_id_as_index) {
          if (interpreter_id < data->count) {
              data->table[interpreter_id].module = NULL;
          }
          goto done;
      }
      {
          __Pyx_ModuleStateLookup_wait_until_no_readers();
          __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound(
              data->table, data->count, interpreter_id);
          if (!lower_bound) goto done;
          if (lower_bound->id != interpreter_id) goto done;
          __Pyx_InterpreterIdAndModule *end = data->table+data->count;
          for (;lower_bound<end-1; ++lower_bound) {
              lower_bound->id = (lower_bound+1)->id;
              lower_bound->module = (lower_bound+1)->module;
          }
      }
      --data->count;
      if (data->count == 0) {
          free(data);
          data = NULL;
      }
    done:
  #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
      __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, data);
  #else
      __Pyx_ModuleStateLookup_data = data;
  #endif
      __Pyx_ModuleStateLookup_Unlock();
      return 0;
  }
  #endif
  
/* #### Code section: utility_code_pragmas_end ### */
#ifdef _MSC_VER
#pragma warning( pop )
#endif



/* #### Code section: end ### */
#endif /* Py_PYTHON_H */
